blob: 4d14b652fa2e726a8591d7baebc6425708acb88f [file] [log] [blame]
Denis Vlasenko27e15012008-09-28 17:19:02 +00001#!/bin/sh
2
Denys Vlasenkod4e4fdb2017-07-03 21:31:16 +02003run_testsuite=false
Denys Vlasenko8cab6672012-04-20 14:48:00 +02004run_testsuite=true
5
Denys Vlasenkod4e4fdb2017-07-03 21:31:16 +02006run_single_test=false
7run_single_test=true
8
Denys Vlasenkoff0e8752010-05-10 04:16:43 +02009test -d "$1" || { echo "'$1' is not a directory"; exit 1; }
10test -x "$1/scripts/randomtest" || { echo "No scripts/randomtest in '$1'"; exit 1; }
11
12export LIBC="uclibc"
Denys Vlasenko26777aa2010-11-22 23:49:10 +010013export CROSS_COMPILER_PREFIX="i686-"
Denys Vlasenkoff0e8752010-05-10 04:16:43 +020014export MAKEOPTS="-j9"
15
Denis Vlasenko27e15012008-09-28 17:19:02 +000016cnt=0
17fail=0
Denis Vlasenko27e15012008-09-28 17:19:02 +000018while sleep 1; do
Denys Vlasenkoff0e8752010-05-10 04:16:43 +020019 echo "Passes: $cnt Failures: $fail"
20 dir="test.$$"
21 while test -e "$dir" -o -e "failed.$dir"; do
22 dir="test.$$.$RANDOM"
23 done
24 echo "Running randconfig test in $dir..."
25 if ! "$1/scripts/randomtest" "$1" "$dir" >/dev/null; then
26 mv -- "$dir" "failed.$dir"
27 echo "Failed build in: failed.$dir"
28 exit 1 # you may comment this out...
29 let fail++
Denys Vlasenko8cab6672012-04-20 14:48:00 +020030 continue
31 fi
32 if $run_testsuite; then
Denys Vlasenkoff0e8752010-05-10 04:16:43 +020033 (
34 cd -- "$dir/testsuite" || exit 1
35 echo "Running testsuite in $dir..."
36 SKIP_KNOWN_BUGS=1 SKIP_INTERNET_TESTS=1 ./runtest -v >runtest.log 2>&1
37 )
38 if test $? != 0; then
39 echo "Failed runtest in $dir"
Denys Vlasenkode912f02016-12-12 11:08:51 +010040 grep ^FAIL -- "$dir/testsuite/runtest.log"
Denys Vlasenko8cab6672012-04-20 14:48:00 +020041 exit 1 # you may comment this out...
42 let fail++
43 continue
Denys Vlasenkoff0e8752010-05-10 04:16:43 +020044 fi
45 tail -n10 -- "$dir/testsuite/runtest.log"
Denys Vlasenkoff0e8752010-05-10 04:16:43 +020046 fi
Denys Vlasenkod4e4fdb2017-07-03 21:31:16 +020047 if $run_single_test; then
48 (
49 cd -- "$dir" || exit 1
50 echo "Running make_single_applets.sh in $dir..."
51
52 if grep -q '# CONFIG_FEATURE_TFTP_GET is not set' .config \
53 && grep -q '# CONFIG_FEATURE_TFTP_PUT is not set' .config \
54 ; then
55 # If both off, tftp[d] is ifdefed out and test fails.
56 # Enable one:
57 sed 's/# CONFIG_FEATURE_TFTP_GET is not set/CONFIG_FEATURE_TFTP_GET=y/' -i .config
58 fi
59
60 ./make_single_applets.sh
61 )
62 if test $? != 0; then
63 echo "Failed make_single_applets.sh in $dir"
64 exit 1 # you may comment this out...
65 let fail++
66 continue
67 fi
68 fi
Denys Vlasenko8cab6672012-04-20 14:48:00 +020069 rm -rf -- "$dir"
Denys Vlasenkoff0e8752010-05-10 04:16:43 +020070 let cnt++
Denis Vlasenko27e15012008-09-28 17:19:02 +000071done