Improve link speed by linking 29 test programs into ovstest. On my machine, running the following command against a fully built tree:
$ touch lib/random.c; time make Improve the overall build time from 7 seconds to 3.5 seconds. Signed-off-by: Andy Zhou <az...@nicira.com> --- tests/aes128.at | 2 +- tests/automake.mk | 149 ++++++++++------------------------------------ tests/bundle.at | 8 +-- tests/classifier.at | 4 +- tests/file_name.at | 2 +- tests/json.at | 8 +-- tests/jsonrpc.at | 12 ++-- tests/library.at | 32 +++++----- tests/lockfile.at | 2 +- tests/multipath.at | 6 +- tests/odp.at | 26 ++++---- tests/ofproto-dpif.at | 8 +-- tests/reconnect.at | 2 +- tests/stp.at | 8 +-- tests/test-aes128.c | 11 ++-- tests/test-atomic.c | 10 ++-- tests/test-bundle.c | 11 ++-- tests/test-byte-order.c | 9 +-- tests/test-classifier.c | 15 ++--- tests/test-csum.c | 12 ++-- tests/test-file_name.c | 11 ++-- tests/test-flows.c | 10 ++-- tests/test-hash.c | 11 ++-- tests/test-hindex.c | 9 +-- tests/test-hmap.c | 9 +-- tests/test-json.c | 12 ++-- tests/test-jsonrpc.c | 10 ++-- tests/test-list.c | 9 +-- tests/test-lockfile.c | 8 ++- tests/test-multipath.c | 11 ++-- tests/test-netflow.c | 11 ++-- tests/test-odp.c | 9 ++- tests/test-packets.c | 11 ++-- tests/test-random.c | 12 ++-- tests/test-reconnect.c | 11 ++-- tests/test-sflow.c | 7 ++- tests/test-sha1.c | 9 +-- tests/test-stp.c | 9 ++- tests/test-unix-socket.c | 11 ++-- tests/test-util.c | 9 ++- tests/test-uuid.c | 11 ++-- tests/test-vconn.c | 9 ++- tests/uuid.at | 4 +- tests/vconn.at | 2 +- 44 files changed, 263 insertions(+), 299 deletions(-) diff --git a/tests/aes128.at b/tests/aes128.at index 4818f5c..6876dd2 100644 --- a/tests/aes128.at +++ b/tests/aes128.at @@ -3,7 +3,7 @@ AT_BANNER([AES-128 unit tests]) m4_define([AES128_CHECK], [AT_SETUP([$1]) AT_KEYWORDS([aes128]) - AT_CHECK([test-aes128 $2 $3], [0], [$4 + AT_CHECK([ovstest test-aes128 $2 $3], [0], [$4 ], []) AT_CLEANUP]) diff --git a/tests/automake.mk b/tests/automake.mk index 6c59c6e..bf80702 100644 --- a/tests/automake.mk +++ b/tests/automake.mk @@ -179,22 +179,6 @@ $(srcdir)/package.m4: $(top_srcdir)/configure.ac echo 'm4_define([AT_PACKAGE_BUGREPORT], [$(PACKAGE_BUGREPORT)])'; \ } >'$(srcdir)/package.m4' -noinst_PROGRAMS += tests/test-aes128 -tests_test_aes128_SOURCES = tests/test-aes128.c -tests_test_aes128_LDADD = lib/libopenvswitch.la - -noinst_PROGRAMS += tests/test-atomic -tests_test_atomic_SOURCES = tests/test-atomic.c -tests_test_atomic_LDADD = lib/libopenvswitch.la - -noinst_PROGRAMS += tests/test-bundle -tests_test_bundle_SOURCES = tests/test-bundle.c -tests_test_bundle_LDADD = lib/libopenvswitch.la - -noinst_PROGRAMS += tests/test-classifier -tests_test_classifier_SOURCES = tests/test-classifier.c -tests_test_classifier_LDADD = lib/libopenvswitch.la - noinst_PROGRAMS += tests/test-controller MAN_ROOTS += tests/test-controller.8.in DISTCLEANFILES += tests/test-controller.8 @@ -202,79 +186,6 @@ noinst_man_MANS += tests/test-controller.8 tests_test_controller_SOURCES = tests/test-controller.c tests_test_controller_LDADD = lib/libopenvswitch.la -noinst_PROGRAMS += tests/test-csum -tests_test_csum_SOURCES = tests/test-csum.c -tests_test_csum_LDADD = lib/libopenvswitch.la - -noinst_PROGRAMS += tests/test-file_name -tests_test_file_name_SOURCES = tests/test-file_name.c -tests_test_file_name_LDADD = lib/libopenvswitch.la - -noinst_PROGRAMS += tests/test-flows -tests_test_flows_SOURCES = tests/test-flows.c -tests_test_flows_LDADD = lib/libopenvswitch.la -dist_check_SCRIPTS = tests/flowgen.pl - -noinst_PROGRAMS += tests/test-hash -tests_test_hash_SOURCES = tests/test-hash.c -tests_test_hash_LDADD = lib/libopenvswitch.la - -noinst_PROGRAMS += tests/test-hindex -tests_test_hindex_SOURCES = tests/test-hindex.c -tests_test_hindex_LDADD = lib/libopenvswitch.la - -noinst_PROGRAMS += tests/test-hmap -tests_test_hmap_SOURCES = tests/test-hmap.c -tests_test_hmap_LDADD = lib/libopenvswitch.la - -noinst_PROGRAMS += tests/test-json -tests_test_json_SOURCES = tests/test-json.c -tests_test_json_LDADD = lib/libopenvswitch.la - -noinst_PROGRAMS += tests/test-jsonrpc -tests_test_jsonrpc_SOURCES = tests/test-jsonrpc.c -tests_test_jsonrpc_LDADD = lib/libopenvswitch.la - -noinst_PROGRAMS += tests/test-list -tests_test_list_SOURCES = tests/test-list.c -tests_test_list_LDADD = lib/libopenvswitch.la - -noinst_PROGRAMS += tests/test-lockfile -tests_test_lockfile_SOURCES = tests/test-lockfile.c -tests_test_lockfile_LDADD = lib/libopenvswitch.la - -noinst_PROGRAMS += tests/test-multipath -tests_test_multipath_SOURCES = tests/test-multipath.c -tests_test_multipath_LDADD = lib/libopenvswitch.la - -noinst_PROGRAMS += tests/test-packets -tests_test_packets_SOURCES = tests/test-packets.c -tests_test_packets_LDADD = lib/libopenvswitch.la - -noinst_PROGRAMS += tests/test-random -tests_test_random_SOURCES = tests/test-random.c -tests_test_random_LDADD = lib/libopenvswitch.la - -noinst_PROGRAMS += tests/test-stp -tests_test_stp_SOURCES = tests/test-stp.c -tests_test_stp_LDADD = lib/libopenvswitch.la - -noinst_PROGRAMS += tests/test-sflow -tests_test_sflow_SOURCES = tests/test-sflow.c -tests_test_sflow_LDADD = lib/libopenvswitch.la - -noinst_PROGRAMS += tests/test-netflow -tests_test_netflow_SOURCES = tests/test-netflow.c -tests_test_netflow_LDADD = lib/libopenvswitch.la - -noinst_PROGRAMS += tests/test-unix-socket -tests_test_unix_socket_SOURCES = tests/test-unix-socket.c -tests_test_unix_socket_LDADD = lib/libopenvswitch.la - -noinst_PROGRAMS += tests/test-odp -tests_test_odp_SOURCES = tests/test-odp.c -tests_test_odp_LDADD = lib/libopenvswitch.la - noinst_PROGRAMS += tests/test-ovsdb tests_test_ovsdb_SOURCES = \ tests/test-ovsdb.c \ @@ -294,18 +205,40 @@ tests/idltest.ovsidl: $(IDLTEST_IDL_FILES) tests/idltest.c: tests/idltest.h noinst_PROGRAMS += tests/ovstest -tests_ovstest_SOURCES = tests/ovstest.c \ - tests/ovstest.h \ - tests/test-heap.c +tests_ovstest_SOURCES = \ + tests/ovstest.c \ + tests/ovstest.h \ + tests/test-aes128.c \ + tests/test-atomic.c \ + tests/test-bundle.c \ + tests/test-byte-order.c \ + tests/test-classifier.c \ + tests/test-csum.c \ + tests/test-file_name.c \ + tests/test-flows.c \ + tests/test-hash.c \ + tests/test-heap.c \ + tests/test-hindex.c \ + tests/test-hmap.c \ + tests/test-json.c \ + tests/test-jsonrpc.c \ + tests/test-list.c \ + tests/test-lockfile.c \ + tests/test-multipath.c \ + tests/test-netflow.c \ + tests/test-odp.c \ + tests/test-packets.c \ + tests/test-random.c \ + tests/test-reconnect.c \ + tests/test-sflow.c \ + tests/test-sha1.c \ + tests/test-stp.c \ + tests/test-unix-socket.c \ + tests/test-util.c \ + tests/test-uuid.c \ + tests/test-vconn.c tests_ovstest_LDADD = lib/libopenvswitch.la - -noinst_PROGRAMS += tests/test-reconnect -tests_test_reconnect_SOURCES = tests/test-reconnect.c -tests_test_reconnect_LDADD = lib/libopenvswitch.la - -noinst_PROGRAMS += tests/test-sha1 -tests_test_sha1_SOURCES = tests/test-sha1.c -tests_test_sha1_LDADD = lib/libopenvswitch.la +dist_check_SCRIPTS = tests/flowgen.pl noinst_PROGRAMS += tests/test-strtok_r tests_test_strtok_r_SOURCES = tests/test-strtok_r.c @@ -313,22 +246,6 @@ tests_test_strtok_r_SOURCES = tests/test-strtok_r.c noinst_PROGRAMS += tests/test-type-props tests_test_type_props_SOURCES = tests/test-type-props.c -noinst_PROGRAMS += tests/test-util -tests_test_util_SOURCES = tests/test-util.c -tests_test_util_LDADD = lib/libopenvswitch.la - -noinst_PROGRAMS += tests/test-uuid -tests_test_uuid_SOURCES = tests/test-uuid.c -tests_test_uuid_LDADD = lib/libopenvswitch.la - -noinst_PROGRAMS += tests/test-vconn -tests_test_vconn_SOURCES = tests/test-vconn.c -tests_test_vconn_LDADD = lib/libopenvswitch.la - -noinst_PROGRAMS += tests/test-byte-order -tests_test_byte_order_SOURCES = tests/test-byte-order.c -tests_test_byte_order_LDADD = lib/libopenvswitch.la - # Python tests. CHECK_PYFILES = \ tests/appctl.py \ diff --git a/tests/bundle.at b/tests/bundle.at index 8a3c291..bf62b2c 100644 --- a/tests/bundle.at +++ b/tests/bundle.at @@ -8,7 +8,7 @@ AT_BANNER([bundle link selection]) # if the test does fail. AT_SETUP([hrw bundle link selection]) -AT_CHECK([[test-bundle 'symmetric_l4,60,hrw,ofport,NXM_NX_REG0[],slaves:1,2,3,4,5']], +AT_CHECK([[ovstest test-bundle 'symmetric_l4,60,hrw,ofport,NXM_NX_REG0[],slaves:1,2,3,4,5']], [0], [ignore]) # 100000: disruption=1.00 (perfect=1.00) 1.00 0.00 0.00 0.00 0.00 0.00 # 110000: disruption=0.50 (perfect=0.50) 0.50 0.50 0.00 0.00 0.00 0.00 @@ -78,7 +78,7 @@ AT_CHECK([[test-bundle 'symmetric_l4,60,hrw,ofport,NXM_NX_REG0[],slaves:1,2,3,4, AT_CLEANUP AT_SETUP([active_backup bundle link selection]) -AT_CHECK([[test-bundle 'symmetric_l4,60,active_backup,ofport,NXM_NX_REG0[],slaves:1,2,3,4,5,6']], +AT_CHECK([[ovstest test-bundle 'symmetric_l4,60,active_backup,ofport,NXM_NX_REG0[],slaves:1,2,3,4,5,6']], [0], [100000: disruption=1.00 (perfect=1.00) 1.00 0.00 0.00 0.00 0.00 0.00 110000: disruption=0.00 (perfect=0.00) 1.00 0.00 0.00 0.00 0.00 0.00 @@ -149,7 +149,7 @@ AT_CHECK([[test-bundle 'symmetric_l4,60,active_backup,ofport,NXM_NX_REG0[],slave AT_CLEANUP AT_SETUP([hrw bundle single link selection]) -AT_CHECK([[test-bundle 'symmetric_l4,60,hrw,ofport,NXM_NX_REG0[],slaves:1']], +AT_CHECK([[ovstest test-bundle 'symmetric_l4,60,hrw,ofport,NXM_NX_REG0[],slaves:1']], [0], [ignore]) # 1: disruption=1.00 (perfect=1.00) 1.00 # 0: disruption=1.00 (perfect=1.00) 0.00 @@ -157,7 +157,7 @@ AT_CHECK([[test-bundle 'symmetric_l4,60,hrw,ofport,NXM_NX_REG0[],slaves:1']], AT_CLEANUP AT_SETUP([hrw bundle no link selection]) -AT_CHECK([[test-bundle 'symmetric_l4,60,hrw,ofport,NXM_NX_REG0[],slaves:']], +AT_CHECK([[ovstest test-bundle 'symmetric_l4,60,hrw,ofport,NXM_NX_REG0[],slaves:']], [0], [ignore]) AT_CLEANUP #: disruption=0.00 (perfect=0.00) diff --git a/tests/classifier.at b/tests/classifier.at index a46c526..45146ba 100644 --- a/tests/classifier.at +++ b/tests/classifier.at @@ -10,7 +10,7 @@ m4_foreach( [many-rules-in-two-tables], [many-rules-in-five-tables]], [AT_SETUP([flow classifier - m4_bpatsubst(testname, [-], [ ])]) - AT_CHECK([test-classifier testname], [0], [], []) + AT_CHECK([ovstest test-classifier testname], [0], [], []) AT_CLEANUP])]) AT_BANNER([miniflow unit tests]) @@ -20,7 +20,7 @@ m4_foreach( [minimask_has_extra], [minimask_combine]], [AT_SETUP([miniflow - m4_bpatsubst(testname, [-], [ ])]) - AT_CHECK([test-classifier testname], [0], [], []) + AT_CHECK([ovstest test-classifier testname], [0], [], []) AT_CLEANUP])]) AT_BANNER([flow classifier lookup segmentation]) diff --git a/tests/file_name.at b/tests/file_name.at index aee4070..9d82b55 100644 --- a/tests/file_name.at +++ b/tests/file_name.at @@ -3,7 +3,7 @@ AT_BANNER([test dir_name and base_name functions]) m4_define([CHECK_FILE_NAME], [AT_SETUP([components of "$1" are "$2", "$3"]) AT_KEYWORDS([dir_name base_name]) - AT_CHECK([test-file_name "AS_ESCAPE($1)"], [0], [$2 + AT_CHECK([ovstest test-file_name "AS_ESCAPE($1)"], [0], [$2 $3 ]) AT_CLEANUP]) diff --git a/tests/json.at b/tests/json.at index 3962da1..86ae5fa 100644 --- a/tests/json.at +++ b/tests/json.at @@ -3,7 +3,7 @@ m4_define([JSON_CHECK_POSITIVE_C], AT_KEYWORDS([json positive]) AT_CHECK([printf %s "AS_ESCAPE([$2])" > input]) AT_CAPTURE_FILE([input]) - AT_CHECK([test-json $4 input], [0], [stdout], []) + AT_CHECK([ovstest test-json $4 input], [0], [stdout], []) AT_CHECK([cat stdout], [0], [$3 ]) AT_CLEANUP]) @@ -40,7 +40,7 @@ m4_define([JSON_CHECK_NEGATIVE_C], AT_KEYWORDS([json negative]) AT_CHECK([printf %s "AS_ESCAPE([$2])" > input]) AT_CAPTURE_FILE([input]) - AT_CHECK([test-json $4 input], [1], [stdout], []) + AT_CHECK([ovstest test-json $4 input], [1], [stdout], []) AT_CHECK([[sed 's/^error: [^:]*:/error:/' < stdout]], [0], [$3 ]) AT_CLEANUP]) @@ -123,7 +123,7 @@ JSON_CHECK_NEGATIVE([null bytes not allowed], AT_SETUP([end of input in quoted string - C]) AT_KEYWORDS([json negative]) -AT_CHECK([printf '"xxx' | test-json -], [1], +AT_CHECK([printf '"xxx' | ovstest test-json -], [1], [error: line 0, column 4, byte 4: unexpected end of input in quoted string ]) AT_CLEANUP @@ -328,7 +328,7 @@ JSON_CHECK_NEGATIVE([objects nesting too deep], AT_SETUP([input may not be empty]) AT_KEYWORDS([json negative]) -AT_CHECK([test-json /dev/null], [1], [error: line 0, column 0, byte 0: empty input stream +AT_CHECK([ovstest test-json /dev/null], [1], [error: line 0, column 0, byte 0: empty input stream ]) AT_CLEANUP diff --git a/tests/jsonrpc.at b/tests/jsonrpc.at index 664debe..e06b5b6 100644 --- a/tests/jsonrpc.at +++ b/tests/jsonrpc.at @@ -2,11 +2,11 @@ AT_BANNER([JSON-RPC - C]) AT_SETUP([JSON-RPC request and successful reply]) OVS_RUNDIR=`pwd`; export OVS_RUNDIR -AT_CHECK([test-jsonrpc --detach --no-chdir --pidfile="`pwd`"/pid listen punix:socket]) +AT_CHECK([ovstest test-jsonrpc --detach --no-chdir --pidfile="`pwd`"/pid listen punix:socket]) AT_CHECK([test -s pid]) AT_CHECK([kill -0 `cat pid`]) AT_CHECK( - [[test-jsonrpc request unix:socket echo '[{"a": "b", "x": null}]']], [0], + [[ovstest test-jsonrpc request unix:socket echo '[{"a": "b", "x": null}]']], [0], [[{"error":null,"id":0,"result":[{"a":"b","x":null}]} ]], [], [test ! -e pid || kill `cat pid`]) AT_CHECK([kill `cat pid`]) @@ -14,11 +14,11 @@ AT_CLEANUP AT_SETUP([JSON-RPC request and error reply]) OVS_RUNDIR=`pwd`; export OVS_RUNDIR -AT_CHECK([test-jsonrpc --detach --no-chdir --pidfile="`pwd`"/pid listen punix:socket]) +AT_CHECK([ovstest test-jsonrpc --detach --no-chdir --pidfile="`pwd`"/pid listen punix:socket]) AT_CHECK([test -s pid]) AT_CHECK([kill -0 `cat pid`]) AT_CHECK( - [[test-jsonrpc request unix:socket bad-request '[]']], [0], + [[ovstest test-jsonrpc request unix:socket bad-request '[]']], [0], [[{"error":{"error":"unknown method"},"id":0,"result":null} ]], [], [test ! -e pid || kill `cat pid`]) AT_CHECK([kill `cat pid`]) @@ -26,12 +26,12 @@ AT_CLEANUP AT_SETUP([JSON-RPC notification]) OVS_RUNDIR=`pwd`; export OVS_RUNDIR -AT_CHECK([test-jsonrpc --detach --no-chdir --pidfile="`pwd`"/pid listen punix:socket]) +AT_CHECK([ovstest test-jsonrpc --detach --no-chdir --pidfile="`pwd`"/pid listen punix:socket]) AT_CHECK([test -s pid]) # When a daemon dies it deletes its pidfile, so make a copy. AT_CHECK([cp pid pid2]) AT_CHECK([kill -0 `cat pid2`]) -AT_CHECK([[test-jsonrpc notify unix:socket shutdown '[]']], [0], [], +AT_CHECK([[ovstest test-jsonrpc notify unix:socket shutdown '[]']], [0], [], [], [kill `cat pid2`]) AT_CHECK( [pid=`cat pid2` diff --git a/tests/library.at b/tests/library.at index b0ccd40..8aeec48 100644 --- a/tests/library.at +++ b/tests/library.at @@ -2,44 +2,44 @@ AT_BANNER([library unit tests]) AT_SETUP([test flow extractor]) AT_CHECK([$PERL `which flowgen.pl` >/dev/null 3>flows 4>pcap]) -AT_CHECK([test-flows <flows 3<pcap], [0], [checked 247 packets, 0 errors +AT_CHECK([ovstest test-flows <flows 3<pcap], [0], [checked 247 packets, 0 errors ]) AT_CLEANUP AT_SETUP([test TCP/IP checksumming]) -AT_CHECK([test-csum], [0], [....#....#....###................................#................................# +AT_CHECK([ovstest test-csum], [0], [....#....#....###................................#................................# ]) AT_CLEANUP AT_SETUP([test hash functions]) -AT_CHECK([test-hash]) +AT_CHECK([ovstest test-hash]) AT_CLEANUP AT_SETUP([test hash map]) -AT_CHECK([test-hmap], [0], [......... +AT_CHECK([ovstest test-hmap], [0], [......... ]) AT_CLEANUP AT_SETUP([test hash index]) -AT_CHECK([test-hindex], [0], [..................... +AT_CHECK([ovstest test-hindex], [0], [..................... ]) AT_CLEANUP AT_SETUP([test atomic operations]) -AT_CHECK([test-atomic]) +AT_CHECK([ovstest test-atomic]) AT_CLEANUP AT_SETUP([test linked lists]) -AT_CHECK([test-list], [0], [.. +AT_CHECK([ovstest test-list], [0], [.. ]) AT_CLEANUP AT_SETUP([test packet library]) -AT_CHECK([test-packets]) +AT_CHECK([ovstest test-packets]) AT_CLEANUP AT_SETUP([test SHA-1]) -AT_CHECK([test-sha1], [0], [......... +AT_CHECK([ovstest test-sha1], [0], [......... ]) AT_CLEANUP @@ -54,11 +54,11 @@ AT_CLEANUP AT_SETUP([test byte order conversion]) AT_KEYWORDS([byte order]) -AT_CHECK([test-byte-order]) +AT_CHECK([ovstest test-byte-order]) AT_CLEANUP AT_SETUP([test random number generator]) -AT_CHECK([test-random], [0], [dnl +AT_CHECK([ovstest test-random], [0], [dnl average=7fa2014f bit 0 1 @@ -124,11 +124,11 @@ m4_foreach( [ovs_scan]], [AT_SETUP([testname[()] function]) AT_KEYWORDS([testname]) - AT_CHECK([test-util testname], [0], [], []) + AT_CHECK([ovstest test-util testname], [0], [], []) AT_CLEANUP]) AT_SETUP([test unix socket, short pathname - C]) -AT_CHECK([test-unix-socket x]) +AT_CHECK([ovstest test-unix-socket x]) AT_CLEANUP dnl Unix sockets with long names are problematic because the name has to @@ -141,7 +141,7 @@ dnl Linux has a 108 byte limit; this is 150 bytes long. longname=012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 mkdir $longname cd $longname -AT_CHECK([test-unix-socket ../$longname/socket socket]) +AT_CHECK([ovstest test-unix-socket ../$longname/socket socket]) AT_CLEANUP AT_SETUP([test unix socket, short pathname - Python]) @@ -165,7 +165,7 @@ AT_CLEANUP AT_SETUP([ovs_assert]) OVS_LOGDIR=`pwd`; export OVS_LOGDIR -AT_CHECK([test-util -voff -vfile:info '-vPATTERN:file:%c|%p|%m' --log-file assert || kill -l $?], +AT_CHECK([ovstest test-util -voff -vfile:info '-vPATTERN:file:%c|%p|%m' --log-file assert || kill -l $?], [0], [ABRT ], [stderr]) @@ -183,5 +183,5 @@ AT_CHECK([sed 's/.*: // AT_CLEANUP AT_SETUP([snprintf]) -AT_CHECK([test-util snprintf]) +AT_CHECK([ovstest test-util snprintf]) AT_CLEANUP diff --git a/tests/lockfile.at b/tests/lockfile.at index 2644d3f..ba10fd4 100644 --- a/tests/lockfile.at +++ b/tests/lockfile.at @@ -3,7 +3,7 @@ AT_BANNER([lockfile unit tests]) m4_define([CHECK_LOCKFILE], [AT_SETUP([m4_translit([$1], [_], [ ])]) AT_KEYWORDS([lockfile]) - AT_CHECK([test-lockfile $1], [0], [$1: success (m4_if( + AT_CHECK([ovstest test-lockfile $1], [0], [$1: success (m4_if( [$2], [1], [$2 child], [$2 children])) ], [stderr]) AT_CHECK([sed 's/pid [[0-9]]*/pid <pid>/' stderr], [0], [$3]) diff --git a/tests/multipath.at b/tests/multipath.at index 361c2c4..d89c129 100644 --- a/tests/multipath.at +++ b/tests/multipath.at @@ -8,7 +8,7 @@ AT_BANNER([multipath link selection]) # if the test does fail. AT_SETUP([modulo_n multipath link selection]) -AT_CHECK([[test-multipath 'eth_src,50,modulo_n,1,0,NXM_NX_REG0[]']], +AT_CHECK([[ovstest test-multipath 'eth_src,50,modulo_n,1,0,NXM_NX_REG0[]']], [0], [ignore]) # 1 -> 2: disruption=0.50 (perfect=0.50); stddev/expected=0.0000 # 2 -> 3: disruption=0.66 (perfect=0.33); stddev/expected=0.0023 @@ -76,7 +76,7 @@ AT_CHECK([[test-multipath 'eth_src,50,modulo_n,1,0,NXM_NX_REG0[]']], AT_CLEANUP AT_SETUP([hash_threshold multipath link selection]) -AT_CHECK([[test-multipath 'eth_src,50,hash_threshold,1,0,NXM_NX_REG0[]']], +AT_CHECK([[ovstest test-multipath 'eth_src,50,hash_threshold,1,0,NXM_NX_REG0[]']], [0], [ignore]) # 1 -> 2: disruption=0.50 (perfect=0.50); stddev/expected=0.0000 # 2 -> 3: disruption=0.50 (perfect=0.33); stddev/expected=0.0056 @@ -212,7 +212,7 @@ AT_CHECK([[test-multipath 'eth_src,50,hrw,1,0,NXM_NX_REG0[]']], AT_CLEANUP AT_SETUP([iter_hash multipath link selection]) -AT_CHECK([[test-multipath 'eth_src,50,iter_hash,1,0,NXM_NX_REG0[]']], +AT_CHECK([[ovstest test-multipath 'eth_src,50,iter_hash,1,0,NXM_NX_REG0[]']], [0], [ignore]) # 1 -> 2: disruption=0.50 (perfect=0.50); stddev/expected=0.0000 # 2 -> 3: disruption=0.42 (perfect=0.33); stddev/expected=0.0034 diff --git a/tests/odp.at b/tests/odp.at index a968dd3..34bc187 100644 --- a/tests/odp.at +++ b/tests/odp.at @@ -91,7 +91,7 @@ s/mpls(label=100,tc=7,ttl=100,bos=0)/mpls(lse0=0x64e64,lse1=0,lse2=0)/ s/mpls(label=1000,tc=4,ttl=200,bos=0)/mpls(lse0=0x3e88c8,lse1=0,lse2=0)/ }' < odp-in.txt > odp-out.txt -AT_CHECK_UNQUOTED([test-odp parse-keys < odp-in.txt], [0], [`cat odp-out.txt` +AT_CHECK_UNQUOTED([ovstest test-odp parse-keys < odp-in.txt], [0], [`cat odp-out.txt` ]) AT_CLEANUP @@ -157,7 +157,7 @@ sed -n 's/,frag=no),/,frag=first),/p' odp-base.txt echo '# Valid forms with IP later fragment.' sed -n 's/,frag=no),.*/,frag=later)/p' odp-base.txt) > odp.txt AT_CAPTURE_FILE([odp.txt]) -AT_CHECK_UNQUOTED([test-odp parse-wc-keys < odp.txt], [0], [`cat odp.txt` +AT_CHECK_UNQUOTED([ovstest test-odp parse-wc-keys < odp.txt], [0], [`cat odp.txt` ]) AT_CLEANUP @@ -204,25 +204,25 @@ AT_DATA([odp-tcp6.txt], [dnl in_port(1),eth(src=00:01:02:03:04:05,dst=10:11:12:13:14:15),eth_type(0x86dd),ipv6(src=::1/::255,dst=::2/::255,label=0/0xf0,proto=10/0xf0,tclass=0x70/0xf0,hlimit=128/0xf0,frag=no/0xf0) in_port(1),eth(src=00:01:02:03:04:05,dst=10:11:12:13:14:15),eth_type(0x86dd),ipv6(src=::1,dst=::2,label=0,proto=6,tclass=0,hlimit=128,frag=no),tcp(src=80/0xff00,dst=8080/0xff) ]) -AT_CHECK_UNQUOTED([test-odp parse-filter filter='dl_type=0x1235' < odp-base.txt], [0], [`cat odp-eth-type.txt` +AT_CHECK_UNQUOTED([ovstest test-odp parse-filter filter='dl_type=0x1235' < odp-base.txt], [0], [`cat odp-eth-type.txt` ]) -AT_CHECK_UNQUOTED([test-odp parse-filter filter='dl_vlan=99' < odp-vlan-base.txt], [0], [`cat odp-vlan.txt` +AT_CHECK_UNQUOTED([ovstest test-odp parse-filter filter='dl_vlan=99' < odp-vlan-base.txt], [0], [`cat odp-vlan.txt` ]) -AT_CHECK_UNQUOTED([test-odp parse-filter filter='dl_vlan=99,ip' < odp-vlan-base.txt], [0], [`cat odp-vlan.txt` +AT_CHECK_UNQUOTED([ovstest test-odp parse-filter filter='dl_vlan=99,ip' < odp-vlan-base.txt], [0], [`cat odp-vlan.txt` ]) -AT_CHECK_UNQUOTED([test-odp parse-filter filter='ip,nw_src=35.8.2.199' < odp-base.txt], [0], [`cat odp-ipv4.txt` +AT_CHECK_UNQUOTED([ovstest test-odp parse-filter filter='ip,nw_src=35.8.2.199' < odp-base.txt], [0], [`cat odp-ipv4.txt` ]) -AT_CHECK_UNQUOTED([test-odp parse-filter filter='ip,nw_dst=172.16.0.199' < odp-base.txt], [0], [`cat odp-ipv4.txt` +AT_CHECK_UNQUOTED([ovstest test-odp parse-filter filter='ip,nw_dst=172.16.0.199' < odp-base.txt], [0], [`cat odp-ipv4.txt` ]) -AT_CHECK_UNQUOTED([test-odp parse-filter filter='dl_type=0x0800,nw_src=35.8.2.199,nw_dst=172.16.0.199' < odp-base.txt], [0], [`cat odp-ipv4.txt` +AT_CHECK_UNQUOTED([ovstest test-odp parse-filter filter='dl_type=0x0800,nw_src=35.8.2.199,nw_dst=172.16.0.199' < odp-base.txt], [0], [`cat odp-ipv4.txt` ]) -AT_CHECK_UNQUOTED([test-odp parse-filter filter='icmp,nw_src=35.8.2.199' < odp-base.txt], [0], [`cat odp-icmp.txt` +AT_CHECK_UNQUOTED([ovstest test-odp parse-filter filter='icmp,nw_src=35.8.2.199' < odp-base.txt], [0], [`cat odp-icmp.txt` ]) -AT_CHECK_UNQUOTED([test-odp parse-filter filter='arp,arp_spa=1.2.3.5' < odp-base.txt], [0], [`cat odp-arp.txt` +AT_CHECK_UNQUOTED([ovstest test-odp parse-filter filter='arp,arp_spa=1.2.3.5' < odp-base.txt], [0], [`cat odp-arp.txt` ]) -AT_CHECK_UNQUOTED([test-odp parse-filter filter='tcp,tp_src=90' < odp-base.txt], [0], [`cat odp-tcp.txt` +AT_CHECK_UNQUOTED([ovstest test-odp parse-filter filter='tcp,tp_src=90' < odp-base.txt], [0], [`cat odp-tcp.txt` ]) -AT_CHECK_UNQUOTED([test-odp parse-filter filter='tcp6,tp_src=90' < odp-base.txt], [0], [`cat odp-tcp6.txt` +AT_CHECK_UNQUOTED([ovstest test-odp parse-filter filter='tcp6,tp_src=90' < odp-base.txt], [0], [`cat odp-tcp6.txt` ]) AT_CLEANUP @@ -254,7 +254,7 @@ sample(sample=9.7%,actions(1,2,3,push_vlan(vid=1,pcp=2))) set(tunnel(tun_id=0xabcdef1234567890,src=1.1.1.1,dst=2.2.2.2,tos=0x0,ttl=64,flags(df,csum,key))) set(tunnel(tun_id=0xabcdef1234567890,src=1.1.1.1,dst=2.2.2.2,tos=0x0,ttl=64,flags(key))) ]) -AT_CHECK_UNQUOTED([test-odp parse-actions < actions.txt], [0], +AT_CHECK_UNQUOTED([ovstest test-odp parse-actions < actions.txt], [0], [`cat actions.txt` ]) AT_CLEANUP diff --git a/tests/ofproto-dpif.at b/tests/ofproto-dpif.at index af5fd8f..d91f981 100644 --- a/tests/ofproto-dpif.at +++ b/tests/ofproto-dpif.at @@ -2795,7 +2795,7 @@ m4_define([CHECK_SFLOW_SAMPLING_PACKET], OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone]) ON_EXIT([kill `cat test-sflow.pid`]) - AT_CHECK([test-sflow --log-file --detach --no-chdir --pidfile 0:$1 > sflow.log], [0], [], [ignore]) + AT_CHECK([ovstest test-sflow --log-file --detach --no-chdir --pidfile 0:$1 > sflow.log], [0], [], [ignore]) AT_CAPTURE_FILE([sflow.log]) SFLOW_PORT=`parse_listening_port < test-sflow.log` ovs-appctl time/stop @@ -3102,7 +3102,7 @@ m4_define([CHECK_NETFLOW_EXPIRATION], ovs-appctl time/stop ON_EXIT([kill `cat test-netflow.pid`]) - AT_CHECK([test-netflow --log-file --detach --no-chdir --pidfile 0:$1 > netflow.log], [0], [], [ignore]) + AT_CHECK([ovstest test-netflow --log-file --detach --no-chdir --pidfile 0:$1 > netflow.log], [0], [], [ignore]) AT_CAPTURE_FILE([netflow.log]) NETFLOW_PORT=`parse_listening_port < test-netflow.log` @@ -3148,7 +3148,7 @@ m4_define([CHECK_NETFLOW_ACTIVE_EXPIRATION], ADD_OF_PORTS([br0], 1, 2) ON_EXIT([kill `cat test-netflow.pid`]) - AT_CHECK([test-netflow --log-file --detach --no-chdir --pidfile 0:$1 > netflow.log], [0], [], [ignore]) + AT_CHECK([ovstest test-netflow --log-file --detach --no-chdir --pidfile 0:$1 > netflow.log], [0], [], [ignore]) AT_CAPTURE_FILE([netflow.log]) NETFLOW_PORT=`parse_listening_port < test-netflow.log` @@ -3735,7 +3735,7 @@ m4_define([CHECK_MEGAFLOW_NETFLOW], dnl NetFlow configuration disables wildcarding relevant fields ON_EXIT([kill `cat test-netflow.pid`]) - AT_CHECK([test-netflow --log-file --detach --no-chdir --pidfile 0:$1 > netflow.log], [0], [], [ignore]) + AT_CHECK([ovstest test-netflow --log-file --detach --no-chdir --pidfile 0:$1 > netflow.log], [0], [], [ignore]) AT_CAPTURE_FILE([netflow.log]) NETFLOW_PORT=`parse_listening_port < test-netflow.log` ovs-vsctl \ diff --git a/tests/reconnect.at b/tests/reconnect.at index 551e8a3..9ebe183 100644 --- a/tests/reconnect.at +++ b/tests/reconnect.at @@ -13,7 +13,7 @@ m4_define([RECONNECT_CHECK], [$1 - C], [], [$2], - [test-reconnect < input], + [ovstest test-reconnect < input], [$3]) __RECONNECT_CHECK( [$1 - Python], diff --git a/tests/stp.at b/tests/stp.at index 741957d..d697a38 100644 --- a/tests/stp.at +++ b/tests/stp.at @@ -15,7 +15,7 @@ check 2 = F:10 B check 3 = F:5 F check 4 = F:5 B ]) -AT_CHECK([test-stp test-stp-ieee802.1d-1998], [0], [], [dnl +AT_CHECK([ovstest test-stp test-stp-ieee802.1d-1998], [0], [], [dnl stp|INFO|stp42: detected topology change. stp|INFO|stp42: detected topology change. stp|INFO|stp97: detected topology change. @@ -58,7 +58,7 @@ check 5 = F:20 B F F check 6 = F:20 B F F check 7 = F:20 B F B ]) -AT_CHECK([test-stp test-stp-ieee802.1d-2004-fig17.4], [0], [], [dnl +AT_CHECK([ovstest test-stp test-stp-ieee802.1d-2004-fig17.4], [0], [], [dnl stp|INFO|stp111: detected topology change. stp|INFO|stp111: detected topology change. stp|INFO|stp111: detected topology change. @@ -84,7 +84,7 @@ check 3 = F:30 F B check 4 = F:20 F F check 5 = F:10 F F ]) -AT_CHECK([test-stp test-stp-ieee802.1d-2004-fig17.6], [0], [], [dnl +AT_CHECK([ovstest test-stp test-stp-ieee802.1d-2004-fig17.6], [0], [], [dnl stp|INFO|stp111: detected topology change. stp|INFO|stp111: detected topology change. stp|INFO|stp111: detected topology change. @@ -113,7 +113,7 @@ check 0 = root check 1 = F F:10 F F F F F F check 2 = F:20 D F F F F F F ]) -AT_CHECK([test-stp test-stp-ieee802.1d-2004-fig17.7], [0], [], [dnl +AT_CHECK([ovstest test-stp test-stp-ieee802.1d-2004-fig17.7], [0], [], [dnl stp|INFO|stpaa: detected topology change. stp|INFO|stp111: detected topology change. stp|INFO|stp111: detected topology change. diff --git a/tests/test-aes128.c b/tests/test-aes128.c index 642c05e..86f5521 100644 --- a/tests/test-aes128.c +++ b/tests/test-aes128.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2010, 2013 Nicira, Inc. + * Copyright (c) 2009, 2010, 2013, 2014 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +18,7 @@ #include <ctype.h> #include "aes128.h" #include "util.h" +#include "ovstest.h" static void hex_to_uint8(const char *input, uint8_t *output, size_t n) @@ -41,8 +42,8 @@ error: ovs_fatal(0, "\"%s\" is not exactly %"PRIuSIZE" hex digits", input, n * 2); } -int -main(int argc, char *argv[]) +static void +test_aes128_main(int argc, char *argv[]) { struct aes128 aes; uint8_t plaintext[16]; @@ -64,6 +65,6 @@ main(int argc, char *argv[]) printf("%02x", ciphertext[i]); } putchar('\n'); - - return 0; } + +OVSTEST_REGISTER("test-aes128", test_aes128_main); diff --git a/tests/test-atomic.c b/tests/test-atomic.c index 887789b..b1a5d9d 100644 --- a/tests/test-atomic.c +++ b/tests/test-atomic.c @@ -18,6 +18,7 @@ #include "ovs-atomic.h" #include "util.h" +#include "ovstest.h" #define TEST_ATOMIC_TYPE(ATOMIC_TYPE, BASE_TYPE) \ { \ @@ -71,8 +72,9 @@ test_atomic_flag(void) ovs_assert(atomic_flag_test_and_set(&flag) == false); } -int -main(void) + +static void +test_atomic_main(int argc OVS_UNUSED, char *argv[] OVS_UNUSED) { TEST_ATOMIC_TYPE(atomic_char, char); TEST_ATOMIC_TYPE(atomic_uchar, unsigned char); @@ -101,6 +103,6 @@ main(void) TEST_ATOMIC_TYPE(atomic_int64_t, int64_t); test_atomic_flag(); - - return 0; } + +OVSTEST_REGISTER("test-atomic", test_atomic_main); diff --git a/tests/test-bundle.c b/tests/test-bundle.c index 5e5ef52..008d909 100644 --- a/tests/test-bundle.c +++ b/tests/test-bundle.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2011, 2012, 2013 Nicira, Inc. +/* Copyright (c) 2011, 2012, 2013, 2014 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,6 +25,7 @@ #include "ofpbuf.h" #include "util.h" +#include "ovstest.h" #define N_FLOWS 50000 #define MAX_SLAVES 8 /* Maximum supported by this test framework. */ @@ -104,8 +105,8 @@ mask_str(uint8_t mask, size_t n_bits) return str; } -int -main(int argc, char *argv[]) +static void +test_bundle_main(int argc, char *argv[]) { bool ok = true; struct ofpact_bundle *bundle; @@ -264,5 +265,7 @@ main(int argc, char *argv[]) free(bundle); free(flows); - return ok ? 0 : 1; + exit(ok ? 0 : 1); } + +OVSTEST_REGISTER("test-bundle", test_bundle_main); diff --git a/tests/test-byte-order.c b/tests/test-byte-order.c index ab39627..4dab334 100644 --- a/tests/test-byte-order.c +++ b/tests/test-byte-order.c @@ -18,9 +18,10 @@ #include "byte-order.h" #include <assert.h> #include <inttypes.h> +#include "ovstest.h" -int -main(void) +static void +test_byte_order_main(int argc, char *argv[]) { #ifndef __CHECKER__ /* I picked some random numbers. */ @@ -48,6 +49,6 @@ main(void) #else /* __CHECKER__ */ /* Making sparse happy with this code makes it unreadable, so don't bother. */ #endif - - return 0; } + +OVSTEST_REGISTER("test-byte-order", test_byte_order_main); diff --git a/tests/test-classifier.c b/tests/test-classifier.c index 4282fd4..10b1967 100644 --- a/tests/test-classifier.c +++ b/tests/test-classifier.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2010, 2011, 2012, 2013 Nicira, Inc. + * Copyright (c) 2009, 2010, 2011, 2012, 2013, 2014 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,7 +36,7 @@ #include "packets.h" #include "random.h" #include "unaligned.h" - +#include "ovstest.h" #undef NDEBUG #include <assert.h> @@ -1340,17 +1340,18 @@ static const struct command commands[] = { /* Miniflow and minimask tests. */ {"miniflow", 0, 0, test_miniflow}, - {"minimask_has_extra", 0, 0, test_minimask_has_extra}, - {"minimask_combine", 0, 0, test_minimask_combine}, + {"minimask_has_extra", 0, 0, test_minimask_has_extra}, + {"minimask_combine", 0, 0, test_minimask_combine}, {NULL, 0, 0, NULL}, }; -int -main(int argc, char *argv[]) +static void +test_classifier_main(int argc, char *argv[]) { set_program_name(argv[0]); init_values(); run_command(argc - 1, argv + 1, commands); - return 0; } + +OVSTEST_REGISTER("test-classifier", test_classifier_main); diff --git a/tests/test-csum.c b/tests/test-csum.c index ef126de..1487e6a 100644 --- a/tests/test-csum.c +++ b/tests/test-csum.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2010, 2011 Nicira, Inc. + * Copyright (c) 2009, 2010, 2011, 2014 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,6 +25,7 @@ #include "random.h" #include "unaligned.h" #include "util.h" +#include "ovstest.h" #undef NDEBUG #include <assert.h> @@ -175,8 +176,9 @@ test_crc32c(void) mark('#'); } -int -main(void) + +static void +test_csum_main(int argc, char *argv[]) { const struct test_case *tc; int i; @@ -280,6 +282,6 @@ main(void) mark('#'); putchar('\n'); - - return 0; } + +OVSTEST_REGISTER("test-csum", test_csum_main); diff --git a/tests/test-file_name.c b/tests/test-file_name.c index 3d4eaf1..9d2aca1 100644 --- a/tests/test-file_name.c +++ b/tests/test-file_name.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2010 Nicira, Inc. + * Copyright (c) 2009, 2010, 2014 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,9 +17,10 @@ #include <config.h> #include "util.h" #include <stdlib.h> +#include "ovstest.h" -int -main(int argc, char *argv[]) +static void +test_filename_main(int argc, char *argv[]) { int i; @@ -34,6 +35,6 @@ main(int argc, char *argv[]) puts(base); free(base); } - - return 0; } + +OVSTEST_REGISTER("test-file_name", test_filename_main); diff --git a/tests/test-flows.c b/tests/test-flows.c index a498142..0a50c14 100644 --- a/tests/test-flows.c +++ b/tests/test-flows.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2010, 2011, 2012, 2013 Nicira, Inc. + * Copyright (c) 2009, 2010, 2011, 2012, 2013, 2014 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,12 +28,13 @@ #include "pcap-file.h" #include "util.h" #include "vlog.h" +#include "ovstest.h" #undef NDEBUG #include <assert.h> -int -main(int argc OVS_UNUSED, char *argv[]) +static void +test_flows_main(int argc, char *argv[]) { struct ofp10_match expected_match; FILE *flows, *pcap; @@ -94,6 +95,7 @@ main(int argc OVS_UNUSED, char *argv[]) ofpbuf_delete(packet); } printf("checked %d packets, %d errors\n", n, errors); - return errors != 0; + exit(errors != 0); } +OVSTEST_REGISTER("test-flows", test_flows_main); diff --git a/tests/test-hash.c b/tests/test-hash.c index 0b7b87a..ae505e6 100644 --- a/tests/test-hash.c +++ b/tests/test-hash.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2012 Nicira, Inc. + * Copyright (c) 2009, 2012, 2014 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,6 +21,7 @@ #include <string.h> #include "hash.h" #include "jhash.h" +#include "ovstest.h" #undef NDEBUG #include <assert.h> @@ -111,8 +112,8 @@ check_3word_hash(uint32_t (*hash)(const uint32_t[], size_t, uint32_t), } } -int -main(void) +static void +test_hash_main(int argc, char *argv[]) { /* Check that all hashes computed with hash_words with one 1-bit (or no * 1-bits) set within a single 32-bit word have different values in all @@ -167,6 +168,6 @@ main(void) * function. */ check_word_hash(hash_int_cb, "hash_int", 12); - - return 0; } + +OVSTEST_REGISTER("test-hash", test_hash_main); diff --git a/tests/test-hindex.c b/tests/test-hindex.c index eb63d9d..73c284f 100644 --- a/tests/test-hindex.c +++ b/tests/test-hindex.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2009, 2010, 2013 Nicira, Inc. + * Copyright (c) 2008, 2009, 2010, 2013, 2014 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,6 +23,7 @@ #include "hash.h" #include "random.h" #include "util.h" +#include "ovstest.h" #undef NDEBUG #include <assert.h> @@ -315,13 +316,13 @@ run_test(void (*function)(hash_func *)) } } -int -main(void) +static void +test_hindex_main(int argc, char *argv[]) { run_test(test_hindex_insert_delete); run_test(test_hindex_for_each_safe); run_test(test_hindex_reserve_shrink); printf("\n"); - return 0; } +OVSTEST_REGISTER("test-hindex", test_hindex_main); diff --git a/tests/test-hmap.c b/tests/test-hmap.c index dd79dc9..f4b780a 100644 --- a/tests/test-hmap.c +++ b/tests/test-hmap.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2009, 2010, 2013 Nicira, Inc. + * Copyright (c) 2008, 2009, 2010, 2013, 2014 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,6 +23,7 @@ #include "hash.h" #include "random.h" #include "util.h" +#include "ovstest.h" #undef NDEBUG #include <assert.h> @@ -285,13 +286,13 @@ run_test(void (*function)(hash_func *)) } } -int -main(void) +static void +test_hmap_main(int argc, char *argv[]) { run_test(test_hmap_insert_delete); run_test(test_hmap_for_each_safe); run_test(test_hmap_reserve_shrink); printf("\n"); - return 0; } +OVSTEST_REGISTER("test-hmap", test_hmap_main); diff --git a/tests/test-json.c b/tests/test-json.c index 24bc745..6a2e0d9 100644 --- a/tests/test-json.c +++ b/tests/test-json.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2010, 2013 Nicira, Inc. + * Copyright (c) 2009, 2010, 2013, 2014 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,7 +24,7 @@ #include <stdio.h> #include "util.h" - +#include "ovstest.h" /* --pretty: If set, the JSON output is pretty-printed, instead of printed as * compactly as possible. */ static int pretty = 0; @@ -104,8 +104,8 @@ parse_multiple(FILE *stream) return ok; } -int -main(int argc, char *argv[]) +static void +test_json_main(int argc, char *argv[]) { const char *input_file; FILE *stream; @@ -155,5 +155,7 @@ main(int argc, char *argv[]) fclose(stream); - return !ok; + exit(!ok); } + +OVSTEST_REGISTER("test-json", test_json_main); diff --git a/tests/test-jsonrpc.c b/tests/test-jsonrpc.c index 616ff2e..4ace6dc 100644 --- a/tests/test-jsonrpc.c +++ b/tests/test-jsonrpc.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2010, 2011, 2012, 2013 Nicira, Inc. + * Copyright (c) 2009, 2010, 2011, 2012, 2013, 2014 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,20 +33,20 @@ #include "timeval.h" #include "util.h" #include "vlog.h" +#include "ovstest.h" static struct command all_commands[]; static void usage(void) NO_RETURN; static void parse_options(int argc, char *argv[]); -int -main(int argc, char *argv[]) +static void +test_jsonrpc_main(int argc, char *argv[]) { proctitle_init(argc, argv); set_program_name(argv[0]); parse_options(argc, argv); run_command(argc - optind, argv + optind, all_commands); - return 0; } static void @@ -336,3 +336,5 @@ static struct command all_commands[] = { { "help", 0, INT_MAX, do_help }, { NULL, 0, 0, NULL }, }; + +OVSTEST_REGISTER("test-jsonrpc", test_jsonrpc_main); diff --git a/tests/test-list.c b/tests/test-list.c index 5074818..5cba959 100644 --- a/tests/test-list.c +++ b/tests/test-list.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2009, 2010, 2011 Nicira, Inc. + * Copyright (c) 2008, 2009, 2010, 2011, 2014 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,6 +20,7 @@ #include <config.h> #include "list.h" #include <string.h> +#include "ovstest.h" #undef NDEBUG #include <assert.h> @@ -166,12 +167,12 @@ run_test(void (*function)(void)) printf("."); } -int -main(void) +static void +test_list_main(int argc OVS_UNUSED, char *argv[] OVS_UNUSED) { run_test(test_list_construction); run_test(test_list_for_each_safe); printf("\n"); - return 0; } +OVSTEST_REGISTER("test-list", test_list_main); diff --git a/tests/test-lockfile.c b/tests/test-lockfile.c index 99f6879..ae8177e 100644 --- a/tests/test-lockfile.c +++ b/tests/test-lockfile.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2010, 2011, 2012 Nicira, Inc. + * Copyright (c) 2009, 2010, 2011, 2012, 2014 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,6 +28,7 @@ #include "timeval.h" #include "util.h" #include "vlog.h" +#include "ovstest.h" struct test { const char *name; @@ -266,8 +267,8 @@ static const struct test tests[] = { #undef TEST }; -int -main(int argc, char *argv[]) +static void +test_lockfile_main(int argc, char *argv[]) { size_t i; @@ -310,3 +311,4 @@ main(int argc, char *argv[]) argv[1], program_name); } +OVSTEST_REGISTER("test-lockfile", test_lockfile_main); diff --git a/tests/test-multipath.c b/tests/test-multipath.c index 7a89779..50747d9 100644 --- a/tests/test-multipath.c +++ b/tests/test-multipath.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2012, 2013 Nicira, Inc. + * Copyright (c) 2010, 2012, 2013, 2014 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,9 +27,10 @@ #include "flow.h" #include "ofp-actions.h" #include "util.h" +#include "ovstest.h" -int -main(int argc, char *argv[]) +static void +test_multipath_main(int argc, char *argv[]) { enum { MP_MAX_LINKS = 63 }; struct ofpact_multipath mp; @@ -132,5 +133,7 @@ main(int argc, char *argv[]) } } - return ok ? 0 : 1; + exit(ok ? 0 : 1); } + +OVSTEST_REGISTER("test-multipath", test_multipath_main); diff --git a/tests/test-netflow.c b/tests/test-netflow.c index 392c6ec..6cdb917 100644 --- a/tests/test-netflow.c +++ b/tests/test-netflow.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, 2013 Nicira, Inc. + * Copyright (c) 2011, 2012, 2013, 2014 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,6 +33,7 @@ #include "unixctl.h" #include "util.h" #include "vlog.h" +#include "ovstest.h" static void usage(void) NO_RETURN; static void parse_options(int argc, char *argv[]); @@ -166,8 +167,8 @@ print_netflow(struct ofpbuf *buf) } } -int -main(int argc, char *argv[]) +static void +test_netflow_main(int argc, char *argv[]) { struct unixctl_server *server; enum { MAX_RECV = 1500 }; @@ -232,8 +233,6 @@ main(int argc, char *argv[]) unixctl_server_wait(server); poll_block(); } - - return 0; } static void @@ -298,3 +297,5 @@ test_netflow_exit(struct unixctl_conn *conn, *exiting = true; unixctl_command_reply(conn, NULL); } + +OVSTEST_REGISTER("test-netflow", test_netflow_main); diff --git a/tests/test-odp.c b/tests/test-odp.c index d41db84..3d2ee24 100644 --- a/tests/test-odp.c +++ b/tests/test-odp.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, 2013 Nicira, Inc. + * Copyright (c) 2011, 2012, 2013, 2014 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,6 +26,7 @@ #include "ofpbuf.h" #include "util.h" #include "vlog.h" +#include "ovstest.h" static int parse_keys(bool wc_keys) @@ -215,8 +216,8 @@ parse_filter(char *filter_parse) return 0; } -int -main(int argc, char *argv[]) +static void +test_odp_main(int argc, char *argv[]) { set_program_name(argv[0]); if (argc == 2 &&!strcmp(argv[1], "parse-keys")) { @@ -231,3 +232,5 @@ main(int argc, char *argv[]) ovs_fatal(0, "usage: %s parse-keys | parse-wc-keys | parse-actions", argv[0]); } } + +OVSTEST_REGISTER("test-odp", test_odp_main); diff --git a/tests/test-packets.c b/tests/test-packets.c index e60e463..fe3697d 100644 --- a/tests/test-packets.c +++ b/tests/test-packets.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011 Nicira, Inc. + * Copyright (c) 2011, 2014 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,6 +19,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include "ovstest.h" #undef NDEBUG #include <assert.h> @@ -152,13 +153,13 @@ test_ipv6_masking(void) assert(ipv6_count_cidr_bits(&dest) == 128); } -int -main(void) +static void +test_packets_main(int argc, char *argv[]) { test_ipv4_cidr(); test_ipv6_static_masks(); test_ipv6_cidr(); test_ipv6_masking(); - - return 0; } + +OVSTEST_REGISTER("test-packets", test_packets_main); diff --git a/tests/test-random.c b/tests/test-random.c index 7b1c2ac..07e7aae 100644 --- a/tests/test-random.c +++ b/tests/test-random.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2009, 2010 Nicira, Inc. + * Copyright (c) 2008, 2009, 2010, 2014 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,12 +17,12 @@ #include <config.h> #include "random.h" - +#include "ovstest.h" #include <stdio.h> #include <string.h> -int -main(void) +static void +test_random_main(int argc, char *argv[]) { enum { N_ROUNDS = 10000 }; unsigned long long int total; @@ -74,6 +74,6 @@ main(void) printf("\n"); } printf("(expected values are %d)\n", N_ROUNDS / 16); - - return 0; } + +OVSTEST_REGISTER("test-random", test_random_main); diff --git a/tests/test-reconnect.c b/tests/test-reconnect.c index 9d1897f..d3ff6e8 100644 --- a/tests/test-reconnect.c +++ b/tests/test-reconnect.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2010, 2011, 2012 Nicira, Inc. + * Copyright (c) 2009, 2010, 2011, 2012, 2014 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,6 +28,7 @@ #include "svec.h" #include "util.h" #include "vlog.h" +#include "ovstest.h" static struct reconnect *reconnect; static int now; @@ -38,8 +39,8 @@ static void diff_stats(const struct reconnect_stats *old, const struct reconnect_stats *new, int delta); -int -main(void) +static void +test_reconnect_main(int argc OVS_UNUSED, char *argv[] OVS_UNUSED) { extern struct vlog_module VLM_reconnect; struct reconnect_stats prev; @@ -87,8 +88,6 @@ main(void) old_time = now; } - - return 0; } static void @@ -290,3 +289,5 @@ static const struct command commands[] = { { "listen-error", 1, 1, do_listen_error }, { NULL, 0, 0, NULL }, }; + +OVSTEST_REGISTER("test-reconnect", test_reconnect_main); diff --git a/tests/test-sflow.c b/tests/test-sflow.c index deebd82..c8206a1 100644 --- a/tests/test-sflow.c +++ b/tests/test-sflow.c @@ -35,6 +35,7 @@ #include "unixctl.h" #include "util.h" #include "vlog.h" +#include "ovstest.h" static void usage(void) NO_RETURN; static void parse_options(int argc, char *argv[]); @@ -484,8 +485,8 @@ print_sflow(struct ofpbuf *buf) } } -int -main(int argc, char *argv[]) +static void +test_sflow_main(int argc, char *argv[]) { struct unixctl_server *server; enum { MAX_RECV = 1500 }; @@ -612,3 +613,5 @@ test_sflow_exit(struct unixctl_conn *conn, *exiting = true; unixctl_command_reply(conn, NULL); } + +OVSTEST_REGISTER("test-sflow", test_sflow_main); diff --git a/tests/test-sha1.c b/tests/test-sha1.c index 2be7942..d69eecb 100644 --- a/tests/test-sha1.c +++ b/tests/test-sha1.c @@ -22,6 +22,7 @@ #include <string.h> #include "random.h" #include "util.h" +#include "ovstest.h" #undef NDEBUG #include <assert.h> @@ -137,8 +138,8 @@ test_big_vector(void) free(vec.data); } -int -main(void) +static void +test_shar1_main(int argc, char *argv[]) { int i; @@ -149,6 +150,6 @@ main(void) test_big_vector(); putchar('\n'); - - return 0; } + +OVSTEST_REGISTER("test-sha1", test_shar1_main); diff --git a/tests/test-stp.c b/tests/test-stp.c index 9d17745..7428e5d 100644 --- a/tests/test-stp.c +++ b/tests/test-stp.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2009, 2010, 2012, 2013 Nicira, Inc. + * Copyright (c) 2008, 2009, 2010, 2012, 2013, 2014 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,6 +26,7 @@ #include "ofpbuf.h" #include "packets.h" #include "vlog.h" +#include "ovstest.h" struct bpdu { int port_no; @@ -434,8 +435,8 @@ must_match(const char *want) } } -int -main(int argc, char *argv[]) +static void +test_stp_main(int argc, char *argv[]) { struct test_case *tc; FILE *input_file; @@ -668,3 +669,5 @@ main(int argc, char *argv[]) return 0; } + +OVSTEST_REGISTER("test-stp", test_stp_main); diff --git a/tests/test-unix-socket.c b/tests/test-unix-socket.c index c5c6a2b..037cfae 100644 --- a/tests/test-unix-socket.c +++ b/tests/test-unix-socket.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2012 Nicira, Inc. + * Copyright (c) 2010, 2012, 2014 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,9 +22,10 @@ #include "util.h" #include "socket-util.h" +#include "ovstest.h" -int -main(int argc, char *argv[]) +static void +test_unix_socket_main(int argc, char *argv[]) { const char *sockname1; const char *sockname2; @@ -59,6 +60,6 @@ main(int argc, char *argv[]) close(sock1); close(sock2); - - return 0; } + +OVSTEST_REGISTER("test-unix-socket", test_unix_socket_main); diff --git a/tests/test-util.c b/tests/test-util.c index 363abb1..ce9ce89 100644 --- a/tests/test-util.c +++ b/tests/test-util.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, 2013 Nicira, Inc. + * Copyright (c) 2011, 2012, 2013, 2014 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,6 +27,7 @@ #include "random.h" #include "util.h" #include "vlog.h" +#include "ovstest.h" #undef NDEBUG #include <assert.h> @@ -1080,11 +1081,13 @@ parse_options(int argc, char *argv[]) free(short_options); } -int -main(int argc, char *argv[]) +static void +test_util_main(int argc, char *argv[]) { set_program_name(argv[0]); parse_options(argc, argv); run_command(argc - optind, argv + optind, commands); return 0; } + +OVSTEST_REGISTER("test-util", test_util_main); diff --git a/tests/test-uuid.c b/tests/test-uuid.c index a13d779..2c1da90 100644 --- a/tests/test-uuid.c +++ b/tests/test-uuid.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009 Nicira, Inc. + * Copyright (c) 2009, 2014 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,9 +17,10 @@ #include <config.h> #include "uuid.h" #include <stdio.h> +#include "ovstest.h" -int -main(int argc, char *argv[]) +static void +test_uuid_main(int argc, char *argv[]) { struct uuid uuid; @@ -34,6 +35,6 @@ main(int argc, char *argv[]) } printf(UUID_FMT"\n", UUID_ARGS(&uuid)); - - return 0; } + +OVSTEST_REGISTER("test-uuid", test_uuid_main); diff --git a/tests/test-vconn.c b/tests/test-vconn.c index 76757f4..b6bbcd9 100644 --- a/tests/test-vconn.c +++ b/tests/test-vconn.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2010, 2011, 2012, 2013 Nicira, Inc. + * Copyright (c) 2009, 2010, 2011, 2012, 2013, 2014 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,6 +34,7 @@ #include "timeval.h" #include "util.h" #include "vlog.h" +#include "ovstest.h" #undef NDEBUG #include <assert.h> @@ -431,8 +432,8 @@ static const struct command commands[] = { {NULL, 0, 0, NULL}, }; -int -main(int argc, char *argv[]) +static void +test_vconn_main(int argc, char *argv[]) { set_program_name(argv[0]); vlog_set_levels(NULL, VLF_ANY_FACILITY, VLL_EMER); @@ -445,3 +446,5 @@ main(int argc, char *argv[]) return 0; } + +OVSTEST_REGISTER("test-vconn", test_vconn_main); diff --git a/tests/uuid.at b/tests/uuid.at index 2a82fb1..da64dd4 100644 --- a/tests/uuid.at +++ b/tests/uuid.at @@ -18,7 +18,7 @@ AT_CHECK([ uuids= for i in m4_for([count], [1], [100], [1], [count ]); do # Generate random UUID and check that it is in the expected format. - uuid=`test-uuid` + uuid=`ovstest test-uuid` CHECK_UUID # Verify that $uuid does not duplicate any UUID generated so far. @@ -30,7 +30,7 @@ AT_CHECK([ uuids="$uuids $uuid" # Verify that test-uuid parses and re-serializes this UUID correctly. - serialized=`test-uuid $uuid` + serialized=`ovstest test-uuid $uuid` if test "$uuid" != "$serialized"; then echo "$uuid: test-uuid serialized this as $serialized" exit 1 diff --git a/tests/vconn.at b/tests/vconn.at index 359f97a..4e91ed8 100644 --- a/tests/vconn.at +++ b/tests/vconn.at @@ -15,7 +15,7 @@ m4_define([TEST_VCONN_CLASS], m4_if([$1], [ssl], [ AT_SKIP_IF([test "$HAVE_OPENSSL" = no]) AT_CHECK([cp $abs_top_builddir/tests/testpki*.pem .])]) - AT_CHECK([test-vconn testname $1], [0], [], [ignore]) + AT_CHECK([ovstest test-vconn testname $1], [0], [], [ignore]) AT_CLEANUP])]) TEST_VCONN_CLASS([unix]) -- 1.7.9.5 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev