diff --git a/tests/hwsim/run-all.sh b/tests/hwsim/run-all.sh index 5d409cfe0..984d75474 100755 --- a/tests/hwsim/run-all.sh +++ b/tests/hwsim/run-all.sh @@ -6,8 +6,10 @@ umask 0002 if [ "x$1" = "xconcurrent-valgrind" ]; then ./start-p2p-concurrent.sh valgrind DATE=`ls -1tr logs | tail -1 | cut -f1 -d-` + rm logs/last-debug for i in autogo discovery grpform; do - ./run-tests.py -e logs/$DATE-failed-$i -f test_p2p_$i.py || errors=1 + ./run-tests.py -l logs/$DATE-run-$i -e logs/$DATE-failed-$i -f test_p2p_$i.py || errors=1 + cat logs/$DATE-run-$i >> logs/last-debug done ./stop-wifi.sh valgrind failures=`grep "ERROR SUMMARY" logs/$DATE-valgrind-* | grep -v " 0 errors" | wc -l` @@ -22,8 +24,10 @@ if [ "x$1" = "xconcurrent-valgrind" ]; then elif [ "x$1" = "xconcurrent" ]; then ./start-p2p-concurrent.sh DATE=`ls -1tr logs | tail -1 | cut -f1 -d-` + rm logs/last-debug for i in autogo discovery grpform; do - ./run-tests.py -e logs/$DATE-failed-$i -f test_p2p_$i.py || errors=1 + ./run-tests.py -l logs/$DATE-run-$i -e logs/$DATE-failed-$i -f test_p2p_$i.py || errors=1 + cat logs/$DATE-run-$i >> logs/last-debug done ./stop-wifi.sh if [ $errors -gt 0 ]; then @@ -33,7 +37,8 @@ elif [ "x$1" = "xconcurrent" ]; then elif [ "x$1" = "xvalgrind" ]; then ./start.sh valgrind DATE=`ls -1tr logs | tail -1 | cut -f1 -d-` - ./run-tests.py -e logs/$DATE-failed || errors=1 + ./run-tests.py -l logs/$DATE-run -e logs/$DATE-failed || errors=1 + cat logs/$DATE-run > logs/last-debug ./stop-wifi.sh valgrind failures=`grep "ERROR SUMMARY" logs/$DATE-valgrind-* | grep -v " 0 errors" | wc -l` if [ $failures -gt 0 ]; then @@ -47,7 +52,8 @@ elif [ "x$1" = "xvalgrind" ]; then else ./start.sh DATE=`ls -1tr logs | tail -1 | cut -f1 -d-` - ./run-tests.py -e logs/$DATE-failed || errors=1 + ./run-tests.py -l logs/$DATE-run -e logs/$DATE-failed || errors=1 + cat logs/$DATE-run > logs/last-debug ./stop-wifi.sh if [ $errors -gt 0 ]; then tar czf /tmp/hwsim-tests-$DATE-FAILED.tar.gz logs/$DATE* diff --git a/tests/hwsim/run-tests.py b/tests/hwsim/run-tests.py index 51cad6d39..ba24ca0cf 100755 --- a/tests/hwsim/run-tests.py +++ b/tests/hwsim/run-tests.py @@ -30,6 +30,7 @@ def reset_devs(dev, apdev): def main(): test_file = None error_file = None + log_file = None idx = 1 if len(sys.argv) > 1 and sys.argv[1] == '-d': logging.basicConfig(level=logging.DEBUG) @@ -37,6 +38,10 @@ def main(): elif len(sys.argv) > 1 and sys.argv[1] == '-q': logging.basicConfig(level=logging.WARNING) idx = idx + 1 + elif len(sys.argv) > 2 and sys.argv[1] == '-l': + log_file = sys.argv[2] + logging.basicConfig(filename=log_file,level=logging.DEBUG) + idx = idx + 2 else: logging.basicConfig(level=logging.INFO) @@ -91,6 +96,8 @@ def main(): continue reset_devs(dev, apdev) logger.info("START " + t.__name__) + if log_file: + print "START " + t.__name__ if t.__doc__: logger.info("Test: " + t.__doc__) for d in dev: @@ -106,10 +113,14 @@ def main(): t(dev) passed.append(t.__name__) logger.info("PASS " + t.__name__) + if log_file: + print "PASS " + t.__name__ except Exception, e: logger.info(e) failed.append(t.__name__) logger.info("FAIL " + t.__name__) + if log_file: + print "FAIL " + t.__name__ for d in dev: try: d.request("NOTE TEST-STOP " + t.__name__) @@ -129,6 +140,8 @@ def main(): f.close() sys.exit(1) logger.info("passed all " + str(len(passed)) + " test case(s)") + if log_file: + print "passed all " + str(len(passed)) + " test case(s)" if __name__ == "__main__": main()