From 7fcfe998c5e3356fe04fb183f9f33d3c9fbbb387 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Fri, 29 Apr 2011 10:44:58 -0700 Subject: [PATCH] tests: Check test output more carefully. 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 --- tests/daemon-py.at | 10 +++++----- tests/jsonrpc-py.at | 6 +++--- tests/jsonrpc.at | 6 +++--- tests/library.at | 21 +++++++++++++-------- tests/test-strtok_r.c | 2 +- 5 files changed, 25 insertions(+), 20 deletions(-) diff --git a/tests/daemon-py.at b/tests/daemon-py.at index 9a2549c11..bc5a05114 100644 --- a/tests/daemon-py.at +++ b/tests/daemon-py.at @@ -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, diff --git a/tests/jsonrpc-py.at b/tests/jsonrpc-py.at index e8a98bbce..cda34ab52 100644 --- a/tests/jsonrpc-py.at +++ b/tests/jsonrpc-py.at @@ -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 diff --git a/tests/jsonrpc.at b/tests/jsonrpc.at index 856fa46ee..b669a3922 100644 --- a/tests/jsonrpc.at +++ b/tests/jsonrpc.at @@ -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 diff --git a/tests/library.at b/tests/library.at index d199373c2..ec50e23ab 100644 --- a/tests/library.at +++ b/tests/library.at @@ -7,19 +7,22 @@ AT_CHECK([test-flows