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])
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)
)
)
+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.
)
)
+/*
+ * 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