minix/test/run
Lionel Sambuc 5180c3cfb9 Installing posix tests in /usr/tests/minix-posix
The goal is to enable anyone to simply run our current test suite.

Change-Id: I27d8856cb82a4be2baa5dc5273526383b7f4fc2c
2013-03-13 10:43:16 +01:00

80 lines
2.1 KiB
Bash
Executable file

#!/bin/sh
# Initialization
PATH=:/bin:/usr/bin
export PATH
rm -rf DIR* # remove any old junk lying around
passed=`expr 0` # count number of tests run correctly
failed=`expr 0` # count number of tests that failed
skipped=`expr 0` # count number of tests that were skipped
total=`expr 0` # total number of tests tried
badones= # list of tests that failed
# Tests which require setuid
setuids="test11 test33 test43 test44 test46 test56 test60 test61 test65"
tests=" 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 \
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 \
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 \
61 62 63 64 65 66 67 68\
sh1.sh sh2.sh interp.sh"
tests_no=`expr 0`
# Directory must be owned by bin
[ "$USER" != root ] || chown bin .
# If root, make sure the setuid tests have the correct permissions
[ "$USER" = root ] && chown root ${setuids}
[ "$USER" = root ] && chmod 4755 ${setuids}
# Count tests
for i in `echo $tests`; do
if [ -x ./test$i ]; then
tests_no=`expr $tests_no + 1`
fi
done
# Print test welcome message
clear
echo "Running POSIX compliance test suite. There are $tests_no tests in total."
echo " "
# Provide an argument for test63
ARGS_63=`pwd`/mod
# Run all the tests, keeping track of who failed.
for i in `echo $tests`
do
if [ -x ./test$i ]
then
total=`expr $total + 1`
FAIL=0
unset ARG
testid="`echo $i | sed 's/\..*//'`"
ARG=`eval echo "\\${ARGS_$testid}"`
if [ "$USER" = root ]
then su - bin -c "cd `pwd`; ./test$i $ARG" || FAIL=1
else ./test$i $ARG || FAIL=1
fi
if [ $FAIL -eq 0 ]
then passed=`expr $passed + 1`
else failed=`expr $failed + 1`
badones=`echo $badones " " $i`
fi
else
skipped=`expr $skipped + 1`
fi
done
# Print results of the tests.
echo " "
if test $total = $passed
then echo All $passed tests completed without error \($skipped skipped\).
else echo Testing completed. Score: $passed passed, $failed failed, \
skipped $skipped
echo The following tests failed: $badones
fi
# echo " "