tests: Check test output more carefully.
authorBen Pfaff <blp@nicira.com>
Fri, 29 Apr 2011 17:44:58 +0000 (10:44 -0700)
committerBen Pfaff <blp@nicira.com>
Fri, 13 May 2011 21:43:12 +0000 (14:43 -0700)
It's better to check output than to ignore it, because ignoring
output can fail to detect real bugs later if the output changes.

Reviewed-by: Simon Horman <horms@verge.net.au>
tests/daemon-py.at
tests/jsonrpc-py.at
tests/jsonrpc.at
tests/library.at
tests/test-strtok_r.c

index 9a2549c..bc5a051 100644 (file)
@@ -6,7 +6,7 @@ AT_CAPTURE_FILE([pid])
 AT_CAPTURE_FILE([expected])
 # Start the daemon and wait for the pidfile to get created
 # and that its contents are the correct pid.
-AT_CHECK([$PYTHON $srcdir/test-daemon.py --pidfile-name=$PWD/pid& echo $! > expected], [0], [ignore], [ignore])
+AT_CHECK([$PYTHON $srcdir/test-daemon.py --pidfile-name=$PWD/pid& echo $! > expected], [0])
 OVS_WAIT_UNTIL([test -s pid], [kill `cat expected`])
 AT_CHECK(
   [pid=`cat pid` && expected=`cat expected` && test "$pid" = "$expected"],
@@ -25,7 +25,7 @@ AT_CAPTURE_FILE([parent])
 AT_CAPTURE_FILE([parentpid])
 AT_CAPTURE_FILE([newpid])
 # Start the daemon and wait for the pidfile to get created.
-AT_CHECK([$PYTHON $srcdir/test-daemon.py --pidfile-name=$PWD/pid --monitor& echo $! > parent], [0], [ignore], [ignore])
+AT_CHECK([$PYTHON $srcdir/test-daemon.py --pidfile-name=$PWD/pid --monitor& echo $! > parent], [0])
 OVS_WAIT_UNTIL([test -s pid], [kill `cat parent`])
 # Check that the pidfile names a running process,
 # and that the parent process of that process is our child process.
@@ -68,7 +68,7 @@ AT_CAPTURE_FILE([parent])
 AT_CAPTURE_FILE([parentpid])
 AT_CAPTURE_FILE([newpid])
 # Start the daemon and wait for the pidfile to get created.
-AT_CHECK([$PYTHON $srcdir/test-daemon.py --pidfile-name=$PWD/pid --monitor& echo $! > parent], [0], [ignore], [ignore])
+AT_CHECK([$PYTHON $srcdir/test-daemon.py --pidfile-name=$PWD/pid --monitor& echo $! > parent], [0])
 OVS_WAIT_UNTIL([test -s pid], [kill `cat parent`])
 # Check that the pidfile names a running process,
 # and that the parent process of that process is our child process.
@@ -110,7 +110,7 @@ AT_CAPTURE_FILE([pid])
 # Start the daemon and make sure that the pidfile exists immediately.
 # We don't wait for the pidfile to get created because the daemon is
 # supposed to do so before the parent exits.
-AT_CHECK([$PYTHON $srcdir/test-daemon.py --pidfile-name=$PWD/pid --detach], [0], [ignore], [ignore])
+AT_CHECK([$PYTHON $srcdir/test-daemon.py --pidfile-name=$PWD/pid --detach], [0])
 AT_CHECK([test -s pid])
 AT_CHECK([kill -0 `cat pid`])
 # Kill the daemon and make sure that the pidfile gets deleted.
@@ -133,7 +133,7 @@ AT_CAPTURE_FILE([init])
 # Start the daemon and make sure that the pidfile exists immediately.
 # We don't wait for the pidfile to get created because the daemon is
 # supposed to do so before the parent exits.
-AT_CHECK([$PYTHON $srcdir/test-daemon.py --pidfile-name=$PWD/daemon --detach --monitor], [0], [ignore], [ignore])
+AT_CHECK([$PYTHON $srcdir/test-daemon.py --pidfile-name=$PWD/daemon --detach --monitor], [0])
 AT_CHECK([test -s daemon])
 # Check that the pidfile names a running process,
 # and that the parent process of that process is a running process,
index e8a98bb..cda34ab 100644 (file)
@@ -8,7 +8,7 @@ AT_CHECK([kill -0 `cat pid`])
 AT_CHECK(
   [[$PYTHON $srcdir/test-jsonrpc.py request unix:socket echo '[{"a": "b", "x": null}]']], [0],
   [[{"error":null,"id":0,"result":[{"a":"b","x":null}]}
-]], [ignore], [test ! -e pid || kill `cat pid`])
+]], [], [test ! -e pid || kill `cat pid`])
 AT_CHECK([kill `cat pid`])
 AT_CLEANUP
 
@@ -20,7 +20,7 @@ AT_CHECK([kill -0 `cat pid`])
 AT_CHECK(
   [[$PYTHON $srcdir/test-jsonrpc.py request unix:socket bad-request '[]']], [0],
   [[{"error":{"error":"unknown method"},"id":0,"result":null}
-]], [ignore], [test ! -e pid || kill `cat pid`])
+]], [], [test ! -e pid || kill `cat pid`])
 AT_CHECK([kill `cat pid`])
 AT_CLEANUP
 
@@ -32,7 +32,7 @@ AT_CHECK([test -s pid])
 AT_CHECK([cp pid pid2])
 AT_CHECK([kill -0 `cat pid2`])
 AT_CHECK([[$PYTHON $srcdir/test-jsonrpc.py notify unix:socket shutdown '[]']], [0], [], 
-  [ignore], [kill `cat pid2`])
+  [], [kill `cat pid2`])
 AT_CHECK(
   [pid=`cat pid2`
    # First try a quick sleep, so that the test completes very quickly
index 856fa46..b669a39 100644 (file)
@@ -7,7 +7,7 @@ AT_CHECK([kill -0 `cat pid`])
 AT_CHECK(
   [[test-jsonrpc request unix:socket echo '[{"a": "b", "x": null}]']], [0],
   [[{"error":null,"id":0,"result":[{"a":"b","x":null}]}
-]], [ignore], [test ! -e pid || kill `cat pid`])
+]], [], [test ! -e pid || kill `cat pid`])
 AT_CHECK([kill `cat pid`])
 AT_CLEANUP
 
@@ -18,7 +18,7 @@ AT_CHECK([kill -0 `cat pid`])
 AT_CHECK(
   [[test-jsonrpc request unix:socket bad-request '[]']], [0],
   [[{"error":{"error":"unknown method"},"id":0,"result":null}
-]], [ignore], [test ! -e pid || kill `cat pid`])
+]], [], [test ! -e pid || kill `cat pid`])
 AT_CHECK([kill `cat pid`])
 AT_CLEANUP
 
@@ -29,7 +29,7 @@ AT_CHECK([test -s pid])
 AT_CHECK([cp pid pid2])
 AT_CHECK([kill -0 `cat pid2`])
 AT_CHECK([[test-jsonrpc notify unix:socket shutdown '[]']], [0], [], 
-  [ignore], [kill `cat pid2`])
+  [], [kill `cat pid2`])
 AT_CHECK(
   [pid=`cat pid2`
    # First try a quick sleep, so that the test completes very quickly
index d199373..ec50e23 100644 (file)
@@ -7,19 +7,22 @@ AT_CHECK([test-flows <flows 3<pcap], [0], [checked 247 packets, 0 errors
 AT_CLEANUP
 
 AT_SETUP([test TCP/IP checksumming])
-AT_CHECK([test-csum], [0], [ignore])
+AT_CHECK([test-csum], [0], [....#....#....##................................#................................#
+])
 AT_CLEANUP
 
 AT_SETUP([test hash functions])
-AT_CHECK([test-hash], [0], [ignore])
+AT_CHECK([test-hash])
 AT_CLEANUP
 
 AT_SETUP([test hash map])
-AT_CHECK([test-hmap], [0], [ignore])
+AT_CHECK([test-hmap], [0], [.........
+])
 AT_CLEANUP
 
 AT_SETUP([test linked lists])
-AT_CHECK([test-list], [0], [ignore])
+AT_CHECK([test-list], [0], [..
+])
 AT_CLEANUP
 
 AT_SETUP([test packet library])
@@ -27,20 +30,22 @@ AT_CHECK([test-packets])
 AT_CLEANUP
 
 AT_SETUP([test SHA-1])
-AT_CHECK([test-sha1], [0], [ignore])
+AT_CHECK([test-sha1], [0], [.........
+])
 AT_CLEANUP
 
 AT_SETUP([test type properties])
-AT_CHECK([test-type-props], [0], [ignore])
+AT_CHECK([test-type-props])
 AT_CLEANUP
 
 AT_SETUP([test strtok_r bug fix])
-AT_CHECK([test-strtok_r], [0], [ignore])
+AT_CHECK([test-strtok_r], [0], [NULL NULL
+])
 AT_CLEANUP
 
 AT_SETUP([test byte order conversion])
 AT_KEYWORDS([byte order])
-AT_CHECK([test-byte-order], [0], [ignore])
+AT_CHECK([test-byte-order])
 AT_CLEANUP
 
 AT_SETUP([test random number generator])
index 9f8d898..b302630 100644 (file)
@@ -33,6 +33,6 @@ main(void)
     char *token1, *token2;
     token1 = strtok_r(string, ":", &save_ptr);
     token2 = strtok_r(NULL, ":", &save_ptr);
-    printf ("%s %s\n", token1, token2);
+    printf ("%s %s\n", token1 ? token1 : "NULL", token2 ? token2 : "NULL");
     return 0;
 }