tests: Fix Y2011 bug in testsuite.
[sliver-openvswitch.git] / tests / ovsdb.at
1 # OVSDB_CHECK_POSITIVE(TITLE, TEST-OVSDB-ARGS, OUTPUT, [KEYWORDS], [PREREQ])
2 #
3 # Runs "test-ovsdb TEST-OVSDB-ARGS" and checks that it exits with
4 # status 0 and prints OUTPUT on stdout.
5 #
6 # TITLE is provided to AT_SETUP and KEYWORDS to AT_KEYWORDS.
7 m4_define([OVSDB_CHECK_POSITIVE], 
8   [AT_SETUP([$1])
9    AT_KEYWORDS([ovsdb positive $4])
10    AT_CHECK([test-ovsdb $2], [0], [$3
11 ], [])
12    AT_CLEANUP])
13
14 # OVSDB_CHECK_POSITIVE_PY(TITLE, TEST-OVSDB-ARGS, OUTPUT, [KEYWORDS], [PREREQ],
15 #                         [XFAIL])
16 #
17 # Runs "test-ovsdb.py TEST-OVSDB-ARGS" and checks that it exits with
18 # status 0 and prints OUTPUT on stdout.
19 #
20 # If XFAIL is nonempty then the test is expected to fail (presumably because
21 # this test works in the C implementation but does not work in Python yet)
22 #
23 # TITLE is provided to AT_SETUP and KEYWORDS to AT_KEYWORDS.
24 m4_define([OVSDB_CHECK_POSITIVE_PY], 
25   [AT_SETUP([$1])
26    AT_SKIP_IF([test $HAVE_PYTHON = no])
27    m4_if([$6], [], [], [AT_XFAIL_IF([:])])
28    AT_KEYWORDS([ovsdb positive Python $4])
29    AT_CHECK([$PYTHON $srcdir/test-ovsdb.py $2], [0], [$3
30 ], [])
31    AT_CLEANUP])
32
33 # OVSDB_CHECK_POSITIVE_CPY(TITLE, TEST-OVSDB-ARGS, OUTPUT, [KEYWORDS],
34 #                          [PREREQ], [PY-XFAIL])
35 #
36 # Runs identical C and Python tests, as specified.
37 m4_define([OVSDB_CHECK_POSITIVE_CPY],
38   [OVSDB_CHECK_POSITIVE([$1 - C], [$2], [$3], [$4], [$5])
39    OVSDB_CHECK_POSITIVE_PY([$1 - Python], [$2], [$3], [$4], [$5], [$6])])
40
41 # OVSDB_CHECK_NEGATIVE(TITLE, TEST-OVSDB-ARGS, OUTPUT, [KEYWORDS], [PREREQ])
42 #
43 # Runs "test-ovsdb TEST-OVSDB-ARGS" and checks that it exits with
44 # status 1 and that its output on stdout contains substring OUTPUT.
45 # TITLE is provided to AT_SETUP and KEYWORDS to AT_KEYWORDS.  
46 m4_define([OVSDB_CHECK_NEGATIVE], 
47   [AT_SETUP([$1])
48    AT_KEYWORDS([ovsdb negative $4])
49    AT_CHECK([test-ovsdb $2], [1], [], [stderr])
50    m4_assert(m4_len([$3]))
51    AT_CHECK(
52      [if grep -F -e "AS_ESCAPE([$3])" stderr
53       then
54         :
55       else
56         exit 99
57       fi], 
58             [0], [ignore], [ignore])
59    AT_CLEANUP])
60
61 # OVSDB_CHECK_NEGATIVE_PY(TITLE, TEST-OVSDB-ARGS, OUTPUT, [KEYWORDS], [PREREQ])
62 #
63 # Runs "test-ovsdb TEST-OVSDB-ARGS" and checks that it exits with
64 # status 1 and that its output on stdout contains substring OUTPUT.
65 # TITLE is provided to AT_SETUP and KEYWORDS to AT_KEYWORDS.  
66 m4_define([OVSDB_CHECK_NEGATIVE_PY], 
67   [AT_SETUP([$1])
68    AT_SKIP_IF([test $HAVE_PYTHON = no])
69    AT_KEYWORDS([ovsdb negative $4])
70    AT_CHECK([$PYTHON $srcdir/test-ovsdb.py $2], [1], [], [stderr])
71    m4_assert(m4_len([$3]))
72    AT_CHECK(
73      [if grep -F -e "AS_ESCAPE([$3])" stderr
74       then
75         :
76       else
77         exit 99
78       fi], 
79             [0], [ignore], [ignore])
80    AT_CLEANUP])
81
82 # OVSDB_CHECK_NEGATIVE_CPY(TITLE, TEST-OVSDB-ARGS, OUTPUT, [KEYWORDS],
83 #                          [PREREQ])
84 #
85 # Runs identical C and Python tests, as specified.
86 m4_define([OVSDB_CHECK_NEGATIVE_CPY],
87   [OVSDB_CHECK_NEGATIVE([$1 - C], [$2], [$3], [$4], [$5])
88    OVSDB_CHECK_NEGATIVE_PY([$1 - Python], [$2], [$3], [$4], [$5])])
89
90 m4_include([tests/ovsdb-log.at])
91 m4_include([tests/ovsdb-types.at])
92 m4_include([tests/ovsdb-data.at])
93 m4_include([tests/ovsdb-column.at])
94 m4_include([tests/ovsdb-table.at])
95 m4_include([tests/ovsdb-row.at])
96 m4_include([tests/ovsdb-schema.at])
97 m4_include([tests/ovsdb-condition.at])
98 m4_include([tests/ovsdb-mutation.at])
99 m4_include([tests/ovsdb-query.at])
100 m4_include([tests/ovsdb-transaction.at])
101 m4_include([tests/ovsdb-execution.at])
102 m4_include([tests/ovsdb-trigger.at])
103 m4_include([tests/ovsdb-tool.at])
104 m4_include([tests/ovsdb-server.at])
105 m4_include([tests/ovsdb-monitor.at])
106 m4_include([tests/ovsdb-idl.at])
107 m4_include([tests/ovsdb-idl-py.at])