[PATCH 3/3] Add a script to run cross-compiled configure tests on target
Uri Simchoni
urisimchoni at gmail.com
Thu Apr 30 14:21:50 MDT 2015
This script reads the cross-answers file generated/amended by configure,
and for each line with unknown result runs the corresponding test and
generates the result.
The script is designed to run on targets with rudimentary facilities
(shell, sed, awk, no GNU extensions), and has been tested to run with
busybox.
General use is to put this script along with compiled tests and the
amended cross-answers file in a directory and pipe the cross-answers
file to this script:
./run-cross-tests < cross-answers.txt > new-cross-answers.txt
---
buildtools/scripts/run-cross-tests.sh | 43 +++++++++++++++++++++++++++++++++++
1 file changed, 43 insertions(+)
create mode 100755 buildtools/scripts/run-cross-tests.sh
diff --git a/buildtools/scripts/run-cross-tests.sh b/buildtools/scripts/run-cross-tests.sh
new file mode 100755
index 0000000..1b71323
--- /dev/null
+++ b/buildtools/scripts/run-cross-tests.sh
@@ -0,0 +1,43 @@
+#!/bin/sh
+
+get_result()
+{
+ local rc
+ local out
+ rc=$1
+ out=$2
+
+# ugly heuristic - assume that if
+# the output contains more than one line then
+# the test doesn't really care about it
+# trim it to one line
+# also sanitize - remove double-quotes
+ out=`echo $out | sed -n -e "y/\"/'/" -e '1 p'`
+
+ if [ "$rc" = "0" ] && [ -z "$out" ] ; then
+ res="OK"
+ elif [ "$rc" = "0" ] ; then
+ res=`echo "\"$out\""`
+ elif [ "$rc" = "1" ] && [ -z "$out" ] ; then
+ res="FAIL"
+ else
+ res=`echo "($rc \"$out\")"`
+ fi
+
+ echo $res
+}
+
+while read line
+do
+ if echo $line | awk 'BEGIN { st=1 } /[^:]*:[[:space:]]*UNKNOWN,.*/ { st = 0} END {exit st}'
+ then
+ msg=`echo $line | awk -F':' '{print $1}'`
+ cmd=`echo $line | sed -rn 's/[^:]*:[[:space:]]*UNKNOWN,(.*)/\1/p'`
+ out=`eval $cmd`
+ rc=$?
+ res=`get_result $rc $out`
+ echo "$msg: $res"
+ else
+ echo $line
+ fi
+done
--
1.9.1
More information about the samba-technical
mailing list