diff --git a/tests/hwsim/run-all.sh b/tests/hwsim/run-all.sh index 51b230ba4..3ef4666f7 100755 --- a/tests/hwsim/run-all.sh +++ b/tests/hwsim/run-all.sh @@ -3,8 +3,10 @@ errors=0 umask 0002 ./start.sh -./run-tests.py || errors=1 +DATE=`ls -1tr logs | tail -1 | cut -f1 -d-` +./run-tests.py -e logs/$DATE-failed || errors=1 ./stop-wifi.sh if [ $errors -gt 0 ]; then + tar czf /tmp/hwsim-tests-$DATE-FAILED.tar.gz logs/$DATE* exit 1 fi diff --git a/tests/hwsim/run-tests.py b/tests/hwsim/run-tests.py index c1de3308c..7bdd41496 100755 --- a/tests/hwsim/run-tests.py +++ b/tests/hwsim/run-tests.py @@ -25,6 +25,7 @@ def reset_devs(dev, apdev): def main(): test_file = None + error_file = None idx = 1 if len(sys.argv) > 1 and sys.argv[1] == '-d': logging.basicConfig(level=logging.DEBUG) @@ -35,6 +36,10 @@ def main(): else: logging.basicConfig(level=logging.INFO) + if len(sys.argv) > idx + 1 and sys.argv[idx] == '-e': + error_file = sys.argv[idx + 1] + idx = idx + 2 + if len(sys.argv) > idx + 1 and sys.argv[idx] == '-f': test_file = sys.argv[idx + 1] idx = idx + 2 @@ -107,6 +112,10 @@ def main(): if len(failed): print "passed " + str(len(passed)) + " test case(s)" print "failed tests: " + str(failed) + if error_file: + f = open(error_file, 'w') + f.write(str(failed) + '\n') + f.close() sys.exit(1) print "passed all " + str(len(passed)) + " test case(s)"