unit-test: Link 29 test programs into ovstest
authorAndy Zhou <azhou@nicira.com>
Tue, 1 Apr 2014 07:47:01 +0000 (00:47 -0700)
committerAndy Zhou <azhou@nicira.com>
Thu, 3 Apr 2014 18:17:17 +0000 (11:17 -0700)
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 <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
46 files changed:
tests/aes128.at
tests/automake.mk
tests/bundle.at
tests/classifier.at
tests/file_name.at
tests/json.at
tests/jsonrpc.at
tests/library.at
tests/lockfile.at
tests/multipath.at
tests/odp.at
tests/ofproto-dpif.at
tests/ovsdb-server.at
tests/ovsdb-tool.at
tests/reconnect.at
tests/stp.at
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-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/uuid.at
tests/vconn.at

index 4818f5c..6876dd2 100644 (file)
@@ -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])
 
index 6c59c6e..bf80702 100644 (file)
@@ -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 \
index 8a3c291..bf62b2c 100644 (file)
@@ -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)
index a46c526..45146ba 100644 (file)
@@ -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])
index aee4070..3d48b85 100644 (file)
@@ -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])
@@ -29,7 +29,7 @@ AT_BANNER([test follow_symlinks function])
 
 m4_define([CHECK_FOLLOW],
   [echo "check $1 -> $2"
-   AT_CHECK_UNQUOTED([test-util follow-symlinks "$1"], [0], [$2
+   AT_CHECK_UNQUOTED([ovstest test-util follow-symlinks "$1"], [0], [$2
 ])
    echo])
 
@@ -115,7 +115,7 @@ AT_SKIP_IF([test ! -h b])
 ln -s b a
 AT_SKIP_IF([test ! -h a])
 
-AT_CHECK([test-util follow-symlinks a], [0], [a
+AT_CHECK([ovstest test-util follow-symlinks a], [0], [a
 ], [stderr])
 AT_CHECK([sed 's/^[[^|]]*|//' stderr], [0],
   [00001|util|WARN|a: too many levels of symlinks
index 3962da1..86ae5fa 100644 (file)
@@ -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
 
index 664debe..e06b5b6 100644 (file)
@@ -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`
index b0ccd40..8aeec48 100644 (file)
@@ -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
index 2644d3f..ba10fd4 100644 (file)
@@ -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])
index 361c2c4..b5a3099 100644 (file)
@@ -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
@@ -144,7 +144,7 @@ AT_CHECK([[test-multipath 'eth_src,50,hash_threshold,1,0,NXM_NX_REG0[]']],
 AT_CLEANUP
 
 AT_SETUP([hrw multipath link selection])
-AT_CHECK([[test-multipath 'eth_src,50,hrw,1,0,NXM_NX_REG0[]']],
+AT_CHECK([[ovstest test-multipath 'eth_src,50,hrw,1,0,NXM_NX_REG0[]']],
   [0], [ignore])
 # 1 ->  2: disruption=0.50 (perfect=0.50); stddev/expected=0.0000
 # 2 ->  3: disruption=0.33 (perfect=0.33); stddev/expected=0.0033
@@ -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
index a968dd3..34bc187 100644 (file)
@@ -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
index d2234e9..9bf2b01 100644 (file)
@@ -2800,7 +2800,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
@@ -3107,7 +3107,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`
 
@@ -3153,7 +3153,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`
 
@@ -3740,7 +3740,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 \
index 3393b94..63111d1 100644 (file)
@@ -160,7 +160,7 @@ AT_CHECK(
 ordinals
 ], [ignore], [test ! -e pid || kill `cat pid`])
 AT_CHECK(
-  [[test-jsonrpc request unix:socket get_schema [\"nonexistent\"]]], [0],
+  [[ovstest test-jsonrpc request unix:socket get_schema [\"nonexistent\"]]], [0],
   [[{"error":null,"id":0,"result":{"details":"get_schema request specifies unknown database nonexistent","error":"unknown database","syntax":"[\"nonexistent\"]"}}
 ]], [], [test ! -e pid || kill `cat pid`])
 OVSDB_SERVER_SHUTDOWN
@@ -575,7 +575,7 @@ AT_CHECK(
     done]],
   [0], [stdout], [ignore], [test ! -e pid || kill `cat pid`])
 dnl Check that all the crap is in fact in the database log.
-AT_CHECK([[${PERL} $srcdir/uuidfilt.pl db | grep -v ^OVSDB | sed 's/"_date":[0-9]*/"_date":0/' | test-json --multiple -]], [0],
+AT_CHECK([[${PERL} $srcdir/uuidfilt.pl db | grep -v ^OVSDB | sed 's/"_date":[0-9]*/"_date":0/' | ovstest test-json --multiple -]], [0],
   [[{"cksum":"12345678 9","name":"ordinals","tables":{"ordinals":{"columns":{"name":{"type":"string"},"number":{"type":"integer"}},"indexes":[["number"]]}},"version":"5.1.3"}
 {"_comment":"add row for zero 0","_date":0,"ordinals":{"<0>":{"name":"zero"}}}
 {"_comment":"delete row for 0","_date":0,"ordinals":{"<0>":null}}
index 3282e0e..f1dfc11 100644 (file)
@@ -91,7 +91,7 @@ AT_CHECK(
     done]],
   [0], [stdout], [ignore])
 dnl Check that all the crap is in fact in the database log.
-AT_CHECK([[${PERL} $srcdir/uuidfilt.pl db | grep -v ^OVSDB | sed 's/"_date":[0-9]*/"_date":0/' | test-json --multiple -]], [0],
+AT_CHECK([[${PERL} $srcdir/uuidfilt.pl db | grep -v ^OVSDB | sed 's/"_date":[0-9]*/"_date":0/' | ovstest test-json --multiple -]], [0],
   [[{"cksum":"12345678 9","name":"ordinals","tables":{"ordinals":{"columns":{"name":{"type":"string"},"number":{"type":"integer"}},"indexes":[["number"]]}},"version":"5.1.3"}
 {"_comment":"add row for zero 0","_date":0,"ordinals":{"<0>":{"name":"zero"}}}
 {"_comment":"delete row for 0","_date":0,"ordinals":{"<0>":null}}
index 551e8a3..9ebe183 100644 (file)
@@ -13,7 +13,7 @@ m4_define([RECONNECT_CHECK],
      [$1 - C],
      [],
      [$2],
-     [test-reconnect < input],
+     [ovstest test-reconnect < input],
      [$3])
    __RECONNECT_CHECK(
      [$1 - Python],
index 741957d..20c231f 100644 (file)
@@ -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.
@@ -152,7 +152,7 @@ run 1000
 check 0 = root
 check 1 = D D F:10
 ])
-AT_CHECK([test-stp test-stp-iol-io-1.1], [0], [], [dnl
+AT_CHECK([ovstest test-stp test-stp-iol-io-1.1], [0], [], [dnl
 stp|INFO|stp111: detected topology change.
 stp|INFO|stp111: detected topology change.
 stp|INFO|stp111: detected topology change.
@@ -178,7 +178,7 @@ run 1000
 check 0 = rootid:0x111 F B
 check 1 = rootid:0x111 B F:10
 ])
-AT_CHECK([test-stp test-stp-iol-io-1.2], [0], [], [dnl
+AT_CHECK([ovstest test-stp test-stp-iol-io-1.2], [0], [], [dnl
 stp|INFO|stp111: detected topology change.
 stp|INFO|stp222: detected topology change.
 stp|INFO|stp111: detected topology change.
@@ -202,7 +202,7 @@ check 1 = F:10 F F
 check 2 = F:10 B F
 check 3 = F:10 B B
 ])
-AT_CHECK([test-stp test-stp-iol-io-1.4], [0], [], [dnl
+AT_CHECK([ovstest test-stp test-stp-iol-io-1.4], [0], [], [dnl
 stp|INFO|stp111: detected topology change.
 stp|INFO|stp111: detected topology change.
 stp|INFO|stp111: detected topology change.
@@ -255,7 +255,7 @@ check 1 = F:10 B F F
 check 2 = B F:10 F F
 check 3 = B F:20 B B
 ])
-AT_CHECK([test-stp test-stp-iol-io-1.5], [0], [], [dnl
+AT_CHECK([ovstest test-stp test-stp-iol-io-1.5], [0], [], [dnl
 stp|INFO|stp111: detected topology change.
 stp|INFO|stp111: detected topology change.
 stp|INFO|stp111: detected topology change.
@@ -275,7 +275,7 @@ AT_DATA([test-stp-iol-op-1.1],
 bridge 0 0x123 =
 check 0 = root
 ])
-AT_CHECK([test-stp test-stp-iol-op-1.1])
+AT_CHECK([ovstest test-stp test-stp-iol-op-1.1])
 AT_CLEANUP
 
 AT_SETUP([STP.op.1.4: All Ports Initialized to Designated Ports])
@@ -290,7 +290,7 @@ check 0 = Li Li Li Li Li Li
 run 1000
 check 0 = F F F F F F
 ])
-AT_CHECK([test-stp test-stp-iol-op-1.4], [0], [], [dnl
+AT_CHECK([ovstest test-stp test-stp-iol-op-1.4], [0], [], [dnl
 stp|INFO|stp123: detected topology change.
 stp|INFO|stp123: detected topology change.
 stp|INFO|stp123: detected topology change.
@@ -314,7 +314,7 @@ run 1000
 check 0 = rootid:0x111 root
 check 1 = rootid:0x111 F:10
 ])
-AT_CHECK([test-stp test-stp-iol-op-3.1], [0], [], [dnl
+AT_CHECK([ovstest test-stp test-stp-iol-op-3.1], [0], [], [dnl
 stp|INFO|stp111: detected topology change.
 ])
 AT_CLEANUP
@@ -334,7 +334,7 @@ check 0 = rootid:0x333^0x6000 root
 check 1 = rootid:0x333^0x6000 F:20
 check 2 = rootid:0x333^0x6000 F:10 F
 ])
-AT_CHECK([test-stp test-stp-iol-op-3.3], [0], [], [dnl
+AT_CHECK([ovstest test-stp test-stp-iol-op-3.3], [0], [], [dnl
 stp|INFO|stp333: detected topology change.
 stp|INFO|stp111: detected topology change.
 stp|INFO|stp111: detected topology change.
@@ -357,7 +357,7 @@ check 0 = rootid:0x333^0x6000 root
 check 1 = rootid:0x333^0x6000 F:20
 check 2 = rootid:0x333^0x6000 F:10 F
 ])
-AT_CHECK([test-stp test-stp-iol-op-3.4], [0], [], [dnl
+AT_CHECK([ovstest test-stp test-stp-iol-op-3.4], [0], [], [dnl
 stp|INFO|stp333: detected topology change.
 stp|INFO|stp111: detected topology change.
 stp|INFO|stp111: detected topology change.
index 642c05e..86f5521 100644 (file)
@@ -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);
index 887789b..b1a5d9d 100644 (file)
@@ -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);
index c7331eb..9a65839 100644 (file)
@@ -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);
index ab39627..4af765e 100644 (file)
 #include "byte-order.h"
 #include <assert.h>
 #include <inttypes.h>
+#include "ovstest.h"
 
-int
-main(void)
+static void
+test_byte_order_main(int argc OVS_UNUSED, char *argv[] OVS_UNUSED)
 {
 #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);
index 4282fd4..10b1967 100644 (file)
@@ -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);
index ef126de..c74133a 100644 (file)
@@ -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 OVS_UNUSED, char *argv[] OVS_UNUSED)
 {
     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);
index 3d4eaf1..9d2aca1 100644 (file)
@@ -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.
 #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);
index 1868c54..522fa44 100644 (file)
@@ -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.
 #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 OVS_UNUSED, char *argv[] OVS_UNUSED)
 {
     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);
index 0b7b87a..081e723 100644 (file)
@@ -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 OVS_UNUSED, char *argv[] OVS_UNUSED)
 {
     /* 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);
index eb63d9d..4c4fdf2 100644 (file)
@@ -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 OVS_UNUSED, char *argv[] OVS_UNUSED)
 {
     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);
index dd79dc9..0c103e9 100644 (file)
@@ -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 OVS_UNUSED, char *argv[] OVS_UNUSED)
 {
     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);
index c7c01c8..43cb9fa 100644 (file)
@@ -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.
@@ -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;
@@ -103,8 +103,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;
@@ -154,5 +154,7 @@ main(int argc, char *argv[])
 
     fclose(stream);
 
-    return !ok;
+    exit(!ok);
 }
+
+OVSTEST_REGISTER("test-json", test_json_main);
index 616ff2e..4ace6dc 100644 (file)
@@ -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.
 #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);
index 5074818..5cba959 100644 (file)
@@ -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);
index 99f6879..80cc5a8 100644 (file)
@@ -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;
 
@@ -278,7 +279,6 @@ main(int argc, char *argv[])
     if (argc != 2) {
         ovs_fatal(0, "exactly one argument required; use \"%s help\" for help",
                   program_name);
-        return 1;
     }
 
     for (i = 0; tests[i].name; i++) {
@@ -310,3 +310,4 @@ main(int argc, char *argv[])
               argv[1], program_name);
 }
 
+OVSTEST_REGISTER("test-lockfile", test_lockfile_main);
index 7a89779..50747d9 100644 (file)
@@ -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.
 #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);
index 8cdb26b..a727f53 100644 (file)
@@ -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);
index 442cc29..c68353e 100644 (file)
@@ -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,19 +216,25 @@ parse_filter(char *filter_parse)
     return 0;
 }
 
-int
-main(int argc, char *argv[])
+static void
+test_odp_main(int argc, char *argv[])
 {
+    int exit_code = 0;
+
     set_program_name(argv[0]);
     if (argc == 2 &&!strcmp(argv[1], "parse-keys")) {
-        return parse_keys(false);
+        exit_code =parse_keys(false);
     } else if (argc == 2 &&!strcmp(argv[1], "parse-wc-keys")) {
-        return parse_keys(true);
+        exit_code =parse_keys(true);
     } else if (argc == 2 && !strcmp(argv[1], "parse-actions")) {
-        return parse_actions();
+        exit_code = parse_actions();
     } else if (argc == 3 && !strcmp(argv[1], "parse-filter")) {
-        return parse_filter(argv[2]);
+        exit_code =parse_filter(argv[2]);
     } else {
         ovs_fatal(0, "usage: %s parse-keys | parse-wc-keys | parse-actions", argv[0]);
     }
+
+    exit(exit_code);
 }
+
+OVSTEST_REGISTER("test-odp", test_odp_main);
index e60e463..a9fafd5 100644 (file)
@@ -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 OVS_UNUSED, char *argv[] OVS_UNUSED)
 {
     test_ipv4_cidr();
     test_ipv6_static_masks();
     test_ipv6_cidr();
     test_ipv6_masking();
-
-    return 0;
 }
+
+OVSTEST_REGISTER("test-packets", test_packets_main);
index 7b1c2ac..39bd85a 100644 (file)
@@ -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.
 #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 OVS_UNUSED, char *argv[] OVS_UNUSED)
 {
     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);
index 9d1897f..d3ff6e8 100644 (file)
@@ -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);
index cad4af5..e992bb5 100644 (file)
@@ -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 };
@@ -545,8 +546,6 @@ main(int argc, char *argv[])
         unixctl_server_wait(server);
         poll_block();
     }
-
-    return 0;
 }
 
 static void
@@ -612,3 +611,5 @@ test_sflow_exit(struct unixctl_conn *conn,
     *exiting = true;
     unixctl_command_reply(conn, NULL);
 }
+
+OVSTEST_REGISTER("test-sflow", test_sflow_main);
index 2be7942..1896c0f 100644 (file)
@@ -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 OVS_UNUSED, char *argv[] OVS_UNUSED)
 {
     int i;
 
@@ -149,6 +150,6 @@ main(void)
     test_big_vector();
 
     putchar('\n');
-
-    return 0;
 }
+
+OVSTEST_REGISTER("test-sha1", test_shar1_main);
index 9d17745..349fa5a 100644 (file)
@@ -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;
@@ -665,6 +666,6 @@ main(int argc, char *argv[])
         free(bridge);
     }
     free(tc);
-
-    return 0;
 }
+
+OVSTEST_REGISTER("test-stp", test_stp_main);
index c5c6a2b..037cfae 100644 (file)
@@ -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.
 
 #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);
index 363abb1..ffd4dce 100644 (file)
@@ -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,12 @@ 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);
index a13d779..2c1da90 100644 (file)
@@ -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.
 #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);
index b7b57eb..8b24bd8 100644 (file)
@@ -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);
@@ -442,6 +443,6 @@ main(int argc, char *argv[])
     time_alarm(10);
 
     run_command(argc - 1, argv + 1, commands);
-
-    return 0;
 }
+
+OVSTEST_REGISTER("test-vconn", test_vconn_main);
index 2a82fb1..da64dd4 100644 (file)
@@ -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
index 359f97a..4e91ed8 100644 (file)
@@ -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])