Date: Sat, 14 Apr 2012 00:38:50 +0000 (UTC) From: Monthadar Al Jaberi <monthadar@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r234255 - projects/net80211_testsuite/wtap/005 Message-ID: <201204140038.q3E0coqb005110@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: monthadar Date: Sat Apr 14 00:38:50 2012 New Revision: 234255 URL: http://svn.freebsd.org/changeset/base/234255 Log: * Modified so that the test script returns 0 on success otherwise failure, which is returned in teardown(); * Added info() routine that should be used instead of calling echo directly; * Modified loggin format to print the number of the test on each log line; * Modified loggin output to print the name of the test and date of running the test; * Modified teardown() to explicitly unlink the wtap simulator visibility between the nodes; Approved by: adrian (mentor) Modified: projects/net80211_testsuite/wtap/005/test.sh Modified: projects/net80211_testsuite/wtap/005/test.sh ============================================================================== --- projects/net80211_testsuite/wtap/005/test.sh Sat Apr 14 00:36:13 2012 (r234254) +++ projects/net80211_testsuite/wtap/005/test.sh Sat Apr 14 00:38:50 2012 (r234255) @@ -6,10 +6,11 @@ # + vimage - to configure/destroy vtap nodes # The name of the test that will be printed in the begining +TEST_NBR="005" TEST_NAME="2 nodes and 2 PROXY nodes" -# Global flags -FLAG_QUIET=0 +# Return value from this test, 0 success failure otherwise +TEST_RESULT=127 # The number of nodes to test NBR_NODES=2 @@ -19,22 +20,13 @@ IP_SUBNET="192.168.2." cmd() { - if [ $FLAG_QUIET = 1 ]; then - echo "*** " $* >> output - $* >> output - else - echo "*** " $* - $* - fi + echo "***${TEST_NBR}*** " $* + $* } info() { - if [ $FLAG_QUIET = 1 ]; then - echo "*** " $* >> output - else - echo "*** " $* - fi + echo "***${TEST_NBR}*** " $* } descr() @@ -73,8 +65,8 @@ EOL setup() { # Initialize output file - echo "" > output - echo "TEST: ${TEST_NAME}" + info "TEST: ${TEST_NAME}" + info `date` # Create wtap/vimage nodes for i in `seq 1 ${NBR_NODES}`; do @@ -167,15 +159,25 @@ run() done done if [ $NBR_FAIL = 0 ]; then - echo "ALL TESTS PASSED" + info "ALL TESTS PASSED" + TEST_RESULT=0 else - echo "FAILED ${NBR_FAIL} of ${NBR_TESTS} TESTS" + info "FAILED ${NBR_FAIL} of ${NBR_TESTS} TESTS" fi } teardown() { cmd vis_map c + # Unlink all links + # XXX: this is a limitation of the current plugin, + # no way to reset vis_map without unload wtap. + n="`expr ${NBR_NODES} - 1`" + for i in `seq 0 ${n}`; do + j="`expr ${i} + 1`" + cmd vis_map d $i $j + cmd vis_map d $j $i + done cmd jexec 2 ifconfig bridge0 destroy cmd jexec 3 ifconfig bridge1 destroy # Bring epair back to host view, we bring both back @@ -198,6 +200,7 @@ teardown() done cmd vimage -d 3 cmd vimage -d 4 + exit ${TEST_RESULT} } EXEC_SETUP=0 @@ -206,9 +209,6 @@ EXEC_TEARDOWN=0 while [ "$#" -gt "0" ] do case $1 in - -q) - FLAG_QUIET=1 - ;; 'all') EXEC_SETUP=1 EXEC_RUN=1 @@ -228,7 +228,7 @@ do exit 0 ;; *) - echo "$0 {all | setup | run | teardown | descr [-q]}" + echo "$0 {all | setup | run | teardown | descr}" exit 127 ;; esac
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201204140038.q3E0coqb005110>