diff options
author | Botao Sun <botao.sun@linaro.org> | 2014-10-19 23:06:33 +1100 |
---|---|---|
committer | Milosz Wasilewski <milosz.wasilewski@linaro.org> | 2014-10-20 13:20:05 +0000 |
commit | 0e30f8fbad2b6ec30f1287cf61a48a5b1922720d (patch) | |
tree | ce240487f13b6314a1e30c18d2eab45e0c5b1bc3 | |
parent | 8f9f3a378d1f4c2cb56684f3b811f2373c5f7f57 (diff) |
device-tree.sh and sh-test-lib: POSIX Compliant Update.
This change is to make the test script to be POSIX compliant.
Original patch comes from:
Lucas Dutra Nunes <ldnunes@ossystems.com.br>
Signed-off by: Botao Sun <botao.sun@linaro.org>
Change-Id: I60c7d18312c6cf296367602aa9430cdc1a9c15f7
-rwxr-xr-x | ubuntu/scripts/device-tree.sh | 9 | ||||
-rwxr-xr-x[-rw-r--r--] | ubuntu/scripts/include/sh-test-lib | 29 |
2 files changed, 18 insertions, 20 deletions
diff --git a/ubuntu/scripts/device-tree.sh b/ubuntu/scripts/device-tree.sh index 199d1c4..f85a042 100755 --- a/ubuntu/scripts/device-tree.sh +++ b/ubuntu/scripts/device-tree.sh @@ -1,8 +1,8 @@ -#!/bin/bash +#!/bin/sh # # Device Tree test cases for Linux Linaro ubuntu # -# Copyright (C) 2012 - 2014, Linaro Limited. +# Copyright (C) 2010 - 2014, Linaro Limited. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -20,9 +20,8 @@ # # Author: Ricardo Salveti <rsalveti@linaro.org> # Maintainer Botao Sun <botao.sun@linaro.org> -# -source include/sh-test-lib +. include/sh-test-lib ## Test case definitions @@ -65,4 +64,4 @@ test_has_proc_device_tree test_device_tree_model_not_empty # clean exit so lava-test can trust the results -exit 0
\ No newline at end of file +exit 0 diff --git a/ubuntu/scripts/include/sh-test-lib b/ubuntu/scripts/include/sh-test-lib index 6c0e8f2..f57a2ef 100644..100755 --- a/ubuntu/scripts/include/sh-test-lib +++ b/ubuntu/scripts/include/sh-test-lib @@ -1,8 +1,8 @@ -#!/bin/bash +#!/bin/sh # # Shared shell library for test management # -# Copyright (C) 2012, Linaro Limited. +# Copyright (C) 2010 - 2014, Linaro Limited. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -19,22 +19,22 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # Author: Ricardo Salveti <rsalveti@linaro.org> -# +# Maintainer Botao Sun <botao.sun@linaro.org> -function error_msg() { - local msg=$1 +error_msg() { + local msg="$1" test -z "$msg" && msg="Unknown error" echo "ERROR: $msg" >&2 exit 1 } -function warn_msg() { - local msg=$1 +warn_msg() { + local msg="$1" test -z "$msg" && msg="Unknown error" - echo "WARNING: $msg\n" >&2 + printf "WARNING: %s\n\n" "$msg" >&2 } -function check_return_fail() { +check_return_fail() { if [ $? -ne 0 ]; then fail_test "$1" return 0 @@ -43,20 +43,19 @@ function check_return_fail() { fi } -function fail_test() { - local reason=$1 +fail_test() { + local reason="$1" echo "${TEST}: FAIL - ${reason}" } -function pass_test() { +pass_test() { echo "${TEST}: PASS" } -function check_root() { - if [ $UID -eq 0 ]; then +check_root() { + if [ $(id -ru) -eq 0 ]; then return 0 else return 1 fi } - |