Test UST's autoincrementing enumeration values
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Mon, 4 Jul 2016 22:24:19 +0000 (18:24 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 5 Jul 2016 20:19:59 +0000 (16:19 -0400)
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
tests/regression/ust/type-declarations/test_type_declarations.py
tests/regression/ust/type-declarations/type-declarations.c
tests/regression/ust/type-declarations/ust_tests_td.h

index b2fa282a182b8efc2bbf24603ec7477e777c3075..5f78c90420653fd4718f4300a43663cd69d218d7 100644 (file)
@@ -70,10 +70,10 @@ current_test += 1
 if babeltrace_process.returncode != 0:
     bail("Unreadable trace; can't proceed with analysis.")
 
-print_test_result(len(event_lines) == 4, current_test, "Correct number of events found in resulting trace")
+print_test_result(len(event_lines) == 5, current_test, "Correct number of events found in resulting trace")
 current_test += 1
 
-if len(event_lines) != 4:
+if len(event_lines) != 5:
     bail("Unexpected number of events found in resulting trace (" + session_info.trace_path + ")." )
 
 match = re.search(r".*ust_tests_td:(.*):.*enumfield = \( \"(.*)\" :.*enumfield_bis = \( \"(.*)\" :.*enumfield_third = .*:.*", event_lines[0])
@@ -102,5 +102,9 @@ match = re.search(r".*ust_tests_td:(.*):.*enumfield = \( \"(.*)\" :.*enumfield_b
 
 print_test_result(match is not None and match.group(2) == "one", current_test,\
                       "Third tracepoint's enum value maps to one")
+current_test += 1
+
+print_test_result('{ zero = ( "zero" : container = 0 ), two = ( "two" : container = 2 ), three = ( "three" : container = 3 ), fifteen = ( "ten_to_twenty" : container = 15 ), twenty_one = ( "twenty_one" : container = 21 ) }' in event_lines[4],
+                  current_test, 'Auto-incrementing enum values are correct')
 
 shutil.rmtree(session_info.tmp_directory)
index fae09b713cd448f4d6547bd6f3cb186f7d7bbe23..516ff616e76e2340147128862f166be47adc931b 100644 (file)
@@ -35,5 +35,7 @@ int main(int argc, char *argv[])
                tracepoint(ust_tests_td, tptest_bis,  i % 2);
        }
 
+       tracepoint(ust_tests_td, test_auto);
+
        return 0;
 }
index 45bccbfabb07624653275847b94327802a054ea9..5339b0900d92f4d9b30995e4dad0d48f0404b2fc 100644 (file)
@@ -43,6 +43,16 @@ TRACEPOINT_ENUM(ust_tests_td, testenum2,
        )
 )
 
+TRACEPOINT_ENUM(ust_tests_td, testenum3,
+       TP_ENUM_VALUES(
+               ctf_enum_auto("zero")
+               ctf_enum_value("two", 2)
+               ctf_enum_auto("three")
+               ctf_enum_range("ten_to_twenty", 10, 20)
+               ctf_enum_auto("twenty_one")
+       )
+)
+
 /*
  * Enumeration field is used twice to make sure the global type declaration
  * is entered only once in the metadata file.
@@ -70,6 +80,20 @@ TRACEPOINT_EVENT(ust_tests_td, tptest_bis,
        )
 )
 
+/*
+ * Test autoincrementing enumeration values.
+ */
+TRACEPOINT_EVENT(ust_tests_td, test_auto,
+       TP_ARGS(void),
+       TP_FIELDS(
+               ctf_enum(ust_tests_td, testenum3, int, zero, 0)
+               ctf_enum(ust_tests_td, testenum3, int, two, 2)
+               ctf_enum(ust_tests_td, testenum3, int, three, 3)
+               ctf_enum(ust_tests_td, testenum3, int, fifteen, 15)
+               ctf_enum(ust_tests_td, testenum3, int, twenty_one, 21)
+       )
+)
+
 #endif /* _TRACEPOINT_UST_TESTS_TD_H */
 
 #undef TRACEPOINT_INCLUDE
This page took 0.029524 seconds and 4 git commands to generate.