shell: sync ash/hush test scripts
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
66139330fc
commit
2ff01bb699
2 changed files with 25 additions and 8 deletions
|
@ -47,6 +47,7 @@ do_test()
|
||||||
# $1 but with / replaced by # so that it can be used as filename part
|
# $1 but with / replaced by # so that it can be used as filename part
|
||||||
noslash=`echo "$1" | sed 's:/:#:g'`
|
noslash=`echo "$1" | sed 's:/:#:g'`
|
||||||
(
|
(
|
||||||
|
tret=0
|
||||||
cd "$1" || { echo "cannot cd $1!"; exit 1; }
|
cd "$1" || { echo "cannot cd $1!"; exit 1; }
|
||||||
for x in run-*; do
|
for x in run-*; do
|
||||||
test -f "$x" || continue
|
test -f "$x" || continue
|
||||||
|
@ -69,13 +70,25 @@ do_test()
|
||||||
test -f "$name.right" || continue
|
test -f "$name.right" || continue
|
||||||
# echo Running test: "$x"
|
# echo Running test: "$x"
|
||||||
echo -n "$1/$x:"
|
echo -n "$1/$x:"
|
||||||
{
|
(
|
||||||
"$THIS_SH" "./$x" 2>&1 | \
|
"$THIS_SH" "./$x" 2>&1 | \
|
||||||
grep -va "^ash: using fallback suid method$" >"$name.xx"
|
grep -va "^ash: using fallback suid method$" >"$name.xx"
|
||||||
|
r=$?
|
||||||
|
# filter C library differences
|
||||||
|
sed -i \
|
||||||
|
-e "/: invalid option /s:'::g" \
|
||||||
|
"$name.xx"
|
||||||
|
test $r -eq 77 && rm -f "$TOPDIR/$noslash-$x.fail" && exit 77
|
||||||
diff -u "$name.xx" "$name.right" >"$TOPDIR/$noslash-$x.fail" \
|
diff -u "$name.xx" "$name.right" >"$TOPDIR/$noslash-$x.fail" \
|
||||||
&& rm -f "$name.xx" "$TOPDIR/$noslash-$x.fail"
|
&& rm -f "$name.xx" "$TOPDIR/$noslash-$x.fail"
|
||||||
} && echo " ok" || echo " fail"
|
)
|
||||||
|
case $? in
|
||||||
|
0) echo " ok";;
|
||||||
|
77) echo " skip (feature disabled)";;
|
||||||
|
*) echo " fail ($?)"; tret=1;;
|
||||||
|
esac
|
||||||
done
|
done
|
||||||
|
exit $tret
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,4 +116,4 @@ else
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exit ${ret}
|
exit $ret
|
||||||
|
|
|
@ -29,7 +29,7 @@ fi
|
||||||
|
|
||||||
eval $(sed -e '/^#/d' -e '/^$/d' -e 's:^:export :' .config)
|
eval $(sed -e '/^#/d' -e '/^$/d' -e 's:^:export :' .config)
|
||||||
|
|
||||||
PATH="`pwd`:$PATH" # for hush and recho/zecho/printenv
|
PATH="`pwd`:$PATH" # for hush
|
||||||
export PATH
|
export PATH
|
||||||
|
|
||||||
THIS_SH="`pwd`/hush"
|
THIS_SH="`pwd`/hush"
|
||||||
|
@ -67,7 +67,8 @@ do_test()
|
||||||
# echo Running test: "$x"
|
# echo Running test: "$x"
|
||||||
echo -n "$1/$x:"
|
echo -n "$1/$x:"
|
||||||
(
|
(
|
||||||
"$THIS_SH" "./$x" >"$name.xx" 2>&1
|
"$THIS_SH" "./$x" 2>&1 | \
|
||||||
|
grep -va "^hush: using fallback suid method$" >"$name.xx"
|
||||||
r=$?
|
r=$?
|
||||||
# filter C library differences
|
# filter C library differences
|
||||||
sed -i \
|
sed -i \
|
||||||
|
@ -83,7 +84,7 @@ do_test()
|
||||||
*) echo " fail ($?)"; tret=1;;
|
*) echo " fail ($?)"; tret=1;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
exit ${tret}
|
exit $tret
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,6 +96,9 @@ ret=0
|
||||||
if [ $# -lt 1 ]; then
|
if [ $# -lt 1 ]; then
|
||||||
# All sub directories
|
# All sub directories
|
||||||
modules=`ls -d hush-*`
|
modules=`ls -d hush-*`
|
||||||
|
# If you want to test hush against ash testsuite
|
||||||
|
# (have to copy ash_test dir to current dir first):
|
||||||
|
#modules=`ls -d hush-* ash_test/ash-*`
|
||||||
|
|
||||||
for module in $modules; do
|
for module in $modules; do
|
||||||
do_test $module || ret=1
|
do_test $module || ret=1
|
||||||
|
@ -108,4 +112,4 @@ else
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exit ${ret}
|
exit $ret
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue