9 |
unset LC_TIME |
unset LC_TIME |
10 |
unset LC_ALL |
unset LC_ALL |
11 |
|
|
12 |
test -x hush || { |
if test ! -x hush; then |
13 |
echo "No ./hush - creating a link to ../../busybox" |
if test ! -x ../../busybox; then |
14 |
ln -s ../../busybox hush |
echo "Can't run tests. Put hush binary into this directory (`pwd`)" |
15 |
} |
exit 1 |
16 |
|
fi |
17 |
|
echo "No ./hush - creating a link to ../../busybox" |
18 |
|
ln -s ../../busybox hush |
19 |
|
fi |
20 |
|
if test ! -f .config; then |
21 |
|
if test ! -f ../../.config; then |
22 |
|
echo "Missing .config file" |
23 |
|
exit 1 |
24 |
|
fi |
25 |
|
cp ../../.config . || exit 1 |
26 |
|
fi |
27 |
|
|
28 |
PATH="$PWD:$PATH" # for hush and recho/zecho/printenv |
eval $(sed -e '/^#/d' -e '/^$/d' -e 's:^:export :' .config) |
29 |
|
|
30 |
|
PATH="`pwd`:$PATH" # for hush and recho/zecho/printenv |
31 |
export PATH |
export PATH |
32 |
|
|
33 |
THIS_SH="$PWD/hush" |
THIS_SH="`pwd`/hush" |
34 |
export THIS_SH |
export THIS_SH |
35 |
|
|
36 |
do_test() |
do_test() |
37 |
{ |
{ |
38 |
test -d "$1" || return 0 |
test -d "$1" || return 0 |
39 |
# echo Running tests in directory "$1" |
d=${d%/} |
40 |
( |
# echo Running tests in directory "$1" |
41 |
cd "$1" || { echo "cannot cd $1!"; exit 1; } |
( |
42 |
for x in run-*; do |
tret=0 |
43 |
test -f "$x" || continue |
cd "$1" || { echo "cannot cd $1!"; exit 1; } |
44 |
case "$x" in |
for x in run-*; do |
45 |
"$0"|run-minimal|run-gprof) ;; |
test -f "$x" || continue |
46 |
*.orig|*~) ;; |
case "$x" in |
47 |
#*) echo $x ; sh $x ;; |
"$0"|run-minimal|run-gprof) ;; |
48 |
*) |
*.orig|*~) ;; |
49 |
sh "$x" >"../$1-$x.fail" 2>&1 && \ |
#*) echo $x ; sh $x ;; |
50 |
{ echo "$1/$x: ok"; rm "../$1-$x.fail"; } || echo "$1/$x: fail"; |
*) |
51 |
;; |
sh "$x" >"../$1-$x.fail" 2>&1 && \ |
52 |
esac |
{ echo "$1/$x: ok"; rm "../$1-$x.fail"; } || echo "$1/$x: fail"; |
53 |
done |
;; |
54 |
# Many bash run-XXX scripts just do this, |
esac |
55 |
# no point in duplication it all over the place |
done |
56 |
for x in *.tests; do |
# Many bash run-XXX scripts just do this, |
57 |
|
# no point in duplication it all over the place |
58 |
|
for x in *.tests; do |
59 |
test -x "$x" || continue |
test -x "$x" || continue |
60 |
name="${x%%.tests}" |
name="${x%%.tests}" |
61 |
test -f "$name.right" || continue |
test -f "$name.right" || continue |
62 |
# echo Running test: "$name.right" |
# echo Running test: "$x" |
63 |
{ |
( |
64 |
"$THIS_SH" "./$x" >"$name.xx" 2>&1 |
"$THIS_SH" "./$x" >"$name.xx" 2>&1 |
65 |
diff -u "$name.xx" "$name.right" >"../$1-$x.fail" && rm -f "$name.xx" "../$1-$x.fail" |
# filter C library differences |
66 |
} && echo "$1/$x: ok" || echo "$1/$x: fail" |
sed -i \ |
67 |
done |
-e "/: invalid option /s:'::g" \ |
68 |
) |
"$name.xx" |
69 |
|
test $? -eq 77 && rm -f "../$1-$x.fail" && exit 77 |
70 |
|
diff -u "$name.xx" "$name.right" >"../$1-$x.fail" && rm -f "$name.xx" "../$1-$x.fail" |
71 |
|
) |
72 |
|
case $? in |
73 |
|
0) echo "$1/$x: ok";; |
74 |
|
77) echo "$1/$x: skip (feature disabled)";; |
75 |
|
*) echo "$1/$x: fail"; tret=1;; |
76 |
|
esac |
77 |
|
done |
78 |
|
exit ${tret} |
79 |
|
) |
80 |
} |
} |
81 |
|
|
82 |
# Main part of this script |
# Main part of this script |
83 |
# Usage: run-all [directories] |
# Usage: run-all [directories] |
84 |
|
|
85 |
|
ret=0 |
86 |
|
|
87 |
if [ $# -lt 1 ]; then |
if [ $# -lt 1 ]; then |
88 |
# All sub directories |
# All sub directories |
89 |
modules=`ls -d hush-*` |
modules=`ls -d hush-*` |
90 |
|
|
91 |
for module in $modules; do |
for module in $modules; do |
92 |
do_test $module |
do_test $module || ret=1 |
93 |
done |
done |
94 |
else |
else |
95 |
while [ $# -ge 1 ]; do |
while [ $# -ge 1 ]; do |
96 |
if [ -d $1 ]; then |
if [ -d $1 ]; then |
97 |
do_test $1 |
do_test $1 || ret=1 |
98 |
fi |
fi |
99 |
shift |
shift |
100 |
done |
done |
101 |
fi |
fi |
102 |
|
|
103 |
|
exit ${ret} |