From 503315ec95686c3b17251d70c632383167320ccc Mon Sep 17 00:00:00 2001 From: Jonathan Rajotte Date: Wed, 13 Feb 2019 21:40:54 -0500 Subject: [PATCH] Gen-ust-events: add sync point before last event Signed-off-by: Jonathan Rajotte --- .../testapp/gen-ust-events/gen-ust-events.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/utils/testapp/gen-ust-events/gen-ust-events.c b/tests/utils/testapp/gen-ust-events/gen-ust-events.c index 7ed7cba61..e2f612678 100644 --- a/tests/utils/testapp/gen-ust-events/gen-ust-events.c +++ b/tests/utils/testapp/gen-ust-events/gen-ust-events.c @@ -45,6 +45,7 @@ static struct option long_options[] = {"wait", required_argument, 0, 'w'}, {"sync-after-first-event", required_argument, 0, 'a'}, {"sync-before-last-event", required_argument, 0, 'b'}, + {"sync-before-last-event-touch", required_argument, 0, 'c'}, {0, 0, 0, 0} }; @@ -61,6 +62,11 @@ int main(int argc, char **argv) useconds_t nr_usec = 0; char *after_first_event_file_path = NULL; char *before_last_event_file_path = NULL; + /* + * Touch a file to indicate that all events except one were + * generated. + */ + char *before_last_event_file_path_touch = NULL; while((option_char = getopt_long(argc, argv, "i:w:a:b:c:d:", long_options, &option_index)) != -1) { switch (option_char) { @@ -70,6 +76,9 @@ int main(int argc, char **argv) case 'b': before_last_event_file_path = strdup(optarg); break; + case 'c': + before_last_event_file_path_touch = strdup(optarg); + break; case 'i': nr_iter = atoi(optarg); break; @@ -103,6 +112,12 @@ int main(int argc, char **argv) * Wait on synchronization before writing last * event. */ + if (before_last_event_file_path_touch) { + ret = create_file(before_last_event_file_path_touch); + if (ret != 0) { + goto end; + } + } if (before_last_event_file_path) { ret = wait_on_file(before_last_event_file_path); if (ret != 0) { @@ -142,5 +157,6 @@ int main(int argc, char **argv) end: free(after_first_event_file_path); free(before_last_event_file_path); + free(before_last_event_file_path_touch); exit(!ret ? EXIT_SUCCESS : EXIT_FAILURE); } -- 2.34.1