Gen-ust-events: add sync point before last event
authorJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Thu, 14 Feb 2019 02:40:54 +0000 (21:40 -0500)
committerJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Mon, 18 Feb 2019 19:25:02 +0000 (14:25 -0500)
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
tests/utils/testapp/gen-ust-events/gen-ust-events.c

index 7ed7cba61460c9cf576edbedc9f151c11c82f89a..e2f6126782c6684daf01e02de45cce92f6c83445 100644 (file)
@@ -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);
 }
This page took 0.027353 seconds and 5 git commands to generate.