[Crosstoolchain-logs] [device-tree-compiler] 28/198: Factor signal checks out of test scripts
Hector Oron
zumbi at moszumanska.debian.org
Thu Dec 8 17:06:50 UTC 2016
This is an automated email from the git hooks/post-receive script.
zumbi pushed a commit to branch upstream/1.4.x
in repository device-tree-compiler.
commit c879a8a28b168b3b448ca8a107e3386eda6829c7
Author: David Gibson <david at gibson.dropbear.id.au>
Date: Fri Feb 3 16:12:06 2012 +1100
Factor signal checks out of test scripts
Several test scripts now have some code to check for a program returning
a signal, and reporting a suitable failure. This patch moves this
duplicated code into a helper function in tests.sh. At the same time we
remove a bashism found in the current copies (using the non portablr $[ ]
construct for arithmetic).
Signed-off-by: David Gibson <david at gibson.dropbear.id.au>
---
tests/dtc-checkfails.sh | 5 +----
tests/fdtget-runtest.sh | 5 +----
tests/fdtput-runtest.sh | 11 +++--------
tests/tests.sh | 8 ++++++++
4 files changed, 13 insertions(+), 16 deletions(-)
diff --git a/tests/dtc-checkfails.sh b/tests/dtc-checkfails.sh
index 87992a0..3f77b13 100755
--- a/tests/dtc-checkfails.sh
+++ b/tests/dtc-checkfails.sh
@@ -17,10 +17,7 @@ trap "rm -f $LOG" 0
verbose_run_log "$LOG" $VALGRIND "$DTC" -o /dev/null "$@"
ret="$?"
-if [ "$ret" -gt 127 ]; then
- signame=$(kill -l $[ret - 128])
- FAIL "Killed by SIG$signame"
-fi
+FAIL_IF_SIGNAL $ret
for c in $CHECKS; do
if ! grep -E "^(ERROR)|(Warning) \($c\):" $LOG > /dev/null; then
diff --git a/tests/fdtget-runtest.sh b/tests/fdtget-runtest.sh
index 44c3529..42dc00c 100755
--- a/tests/fdtget-runtest.sh
+++ b/tests/fdtget-runtest.sh
@@ -18,10 +18,7 @@ if [ "$ret" -ne 0 -a "$expect" = "ERR" ]; then
PASS
fi
-if [ "$ret" -gt 127 ]; then
- signame=$(kill -l $[ret - 128])
- FAIL "Killed by SIG$signame"
-fi
+FAIL_IF_SIGNAL $ret
diff $EXPECT $LOG
ret="$?"
diff --git a/tests/fdtput-runtest.sh b/tests/fdtput-runtest.sh
index c4b2135..9178d2f 100644
--- a/tests/fdtput-runtest.sh
+++ b/tests/fdtput-runtest.sh
@@ -29,19 +29,14 @@ ret="$?"
if [ "$ret" -ne 0 -a "$expect" = "ERR" ]; then
PASS
fi
-if [ "$ret" -gt 127 ]; then
- signame=$(kill -l $[ret - 128])
- FAIL "Killed by SIG$signame"
-fi
+
+FAIL_IF_SIGNAL $ret
# Now fdtget to read the value
verbose_run_log "$LOG" $VALGRIND "$DTGET" "$dtb" "$node" "$property" $flags
ret="$?"
-if [ "$ret" -gt 127 ]; then
- signame=$(kill -l $[ret - 128])
- FAIL "Killed by SIG$signame"
-fi
+FAIL_IF_SIGNAL $ret
diff $EXPECT $LOG
ret="$?"
diff --git a/tests/tests.sh b/tests/tests.sh
index 6e5e76a..3b7c6c8 100644
--- a/tests/tests.sh
+++ b/tests/tests.sh
@@ -10,6 +10,14 @@ FAIL () {
exit 2
}
+FAIL_IF_SIGNAL () {
+ ret="$1"
+ if [ "$ret" -gt 127 ]; then
+ signame=$(kill -l $((ret - 128)))
+ FAIL "Killed by SIG$signame"
+ fi
+}
+
DTC=../dtc
DTGET=../fdtget
DTPUT=../fdtput
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/crosstoolchain/device-tree-compiler.git
More information about the Crosstoolchain-logs
mailing list