From owner-svn-src-projects@FreeBSD.ORG Sat Apr 14 00:40:13 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A4BE2106566B; Sat, 14 Apr 2012 00:40:13 +0000 (UTC) (envelope-from monthadar@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 902528FC12; Sat, 14 Apr 2012 00:40:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q3E0eDZa005265; Sat, 14 Apr 2012 00:40:13 GMT (envelope-from monthadar@svn.freebsd.org) Received: (from monthadar@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q3E0eDdD005263; Sat, 14 Apr 2012 00:40:13 GMT (envelope-from monthadar@svn.freebsd.org) Message-Id: <201204140040.q3E0eDdD005263@svn.freebsd.org> From: Monthadar Al Jaberi Date: Sat, 14 Apr 2012 00:40:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r234258 - projects/net80211_testsuite/wtap/002 X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Apr 2012 00:40:13 -0000 Author: monthadar Date: Sat Apr 14 00:40:13 2012 New Revision: 234258 URL: http://svn.freebsd.org/changeset/base/234258 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; * Fixed ascii diagram in descr(); * Modified teardown() to explicitly unlink the wtap simulator visibility between the nodes; Approved by: adrian (mentor) Modified: projects/net80211_testsuite/wtap/002/test.sh Modified: projects/net80211_testsuite/wtap/002/test.sh ============================================================================== --- projects/net80211_testsuite/wtap/002/test.sh Sat Apr 14 00:39:40 2012 (r234257) +++ projects/net80211_testsuite/wtap/002/test.sh Sat Apr 14 00:40:13 2012 (r234258) @@ -6,10 +6,11 @@ # + vimage - to configure/destroy vtap nodes # The name of the test that will be printed in the begining +TEST_NBR="002" TEST_NAME="4 nodes in line-topology with HWMPROOT NORMAL" -# 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=4 @@ -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() @@ -58,10 +50,10 @@ It: * After a grace period the forwarding information for each of B,C and D is checked to contain correct number of hops: - ----NHOP 3 --------- - / ---NHOP 2------- | - |/ -NHOP 1-- | | - ||/ | | | + ----NHOP 3 ------------ + / ---NHOP 2------- | + |/ -NHOP 1-- | | + ||/ | | | A <-----> B <-> C <-> D It is expected that the initial creation and discovery phase @@ -75,8 +67,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 @@ -142,14 +134,25 @@ run() fi 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 n="`expr ${NBR_NODES} - 1`" for i in `seq 0 ${n}`; do vnet="`expr ${i} + 1`" @@ -160,6 +163,7 @@ teardown() cmd wtap d ${wtap_if} cmd vimage -d ${i} done + exit ${TEST_RESULT} } EXEC_SETUP=0 @@ -168,9 +172,6 @@ EXEC_TEARDOWN=0 while [ "$#" -gt "0" ] do case $1 in - -q) - FLAG_QUIET=1 - ;; 'all') EXEC_SETUP=1 EXEC_RUN=1 @@ -190,7 +191,7 @@ do exit 0 ;; *) - echo "$0 {all | setup | run | teardown | descr [-q]}" + echo "$0 {all | setup | run | teardown | descr}" exit 127 ;; esac