[apparmor] [patch] inprove runtests-py*.sh
Christian Boltz
apparmor at cboltz.de
Mon Jul 14 20:37:52 UTC 2014
Hello,
this patch changes runtests-py*.sh (scripts for manually running the
utils/test/*.py testcases) to
- sleep 10 seconds after each failed test to make failures more annoying
^W^W^W^Wgive people a chance to read failure details
- print a list of failed tests at the end
Also avoid duplicate code by letting runtests-py2.sh call runtests-py3.sh.
=== modified file 'utils/test/runtests-py2.sh'
--- utils/test/runtests-py2.sh 2014-02-13 00:59:27 +0000
+++ utils/test/runtests-py2.sh 2014-07-14 20:29:55 +0000
@@ -1,1 +1,5 @@
-for file in *.py ; do echo "running $file..." ; python $file; echo; done
+#!/bin/bash
+
+RUNTESTS_PY__PYTHON_BINARY=python2
+source runtests-py3.sh
+
=== modified file 'utils/test/runtests-py3.sh'
--- utils/test/runtests-py3.sh 2014-02-13 00:59:27 +0000
+++ utils/test/runtests-py3.sh 2014-07-14 20:33:20 +0000
@@ -1,1 +1,31 @@
-for file in *.py ; do echo "running $file..." ; python3 $file; echo; done
+#!/bin/bash
+# ------------------------------------------------------------------
+#
+# Copyright (C) 2014 Christian Boltz
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of version 2 of the GNU General Public
+# License published by the Free Software Foundation.
+#
+# ------------------------------------------------------------------
+
+test -z "$RUNTESTS_PY__PYTHON_BINARY" && RUNTESTS_PY__PYTHON_BINARY=python3
+
+failed=""
+for file in *.py ; do
+ echo "running $file..."
+ "$RUNTESTS_PY__PYTHON_BINARY" $file || {
+ failed="$failed $file"
+ echo "*** test $file failed - giving you some time to read the output... ***"
+ sleep 10
+ }
+ echo
+done
+
+test -n "$failed" && {
+ echo
+ echo "*** The following tests failed:"
+ echo "*** $failed"
+ exit 1
+}
+
Regards,
Christian Boltz
--
> [HD mit badblocks] NACK, es kommt immer auf den Anwendungszweck an.
> Für ein Lern- / Experimentiersystem lohnt sich keine neue HD, solange
> es zu funktionieren scheint.
Experimente auf welchem Sektor? Spanabhebende Storage-Lösungen?
[> Al Bogner und Thomas Dreher in suse-linux]
More information about the AppArmor
mailing list