X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=tests%2Futils%2Ftestapp%2Fgen-ust-events%2Fgen-ust-events.c;h=3cfadbe9976a70aa6bdc16240707d49160ca01b0;hb=343af227102f6b274bfd7f6c7220eb3b776ba5e3;hp=11327d5f4b6866d7c324b50223181897ccf8e862;hpb=5fcaccbce7683a6af772d6f37d03fb01cf248a84;p=lttng-tools.git 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 11327d5f4..3cfadbe99 100644 --- a/tests/utils/testapp/gen-ust-events/gen-ust-events.c +++ b/tests/utils/testapp/gen-ust-events/gen-ust-events.c @@ -15,7 +15,6 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#define _GNU_SOURCE #define _LGPL_SOURCE #include #include @@ -32,6 +31,7 @@ #include #include #include +#include "utils.h" #define TRACEPOINT_DEFINE #include "tp.h" @@ -85,7 +85,7 @@ int main(int argc, char **argv) char text[10] = "test"; double dbl = 2.0; float flt = 2222.0; - int nr_iter = 100; + int nr_iter = 100, ret = 0; useconds_t nr_usec = 0; char *after_first_event_file_path = NULL; char *before_last_event_file_path = NULL; @@ -127,8 +127,14 @@ int main(int argc, char **argv) * that at least one tracepoint has been hit. */ create_file(after_first_event_file_path); - usleep(nr_usec); + if (nr_usec) { + if (usleep_safe(nr_usec)) { + ret = -1; + goto end; + } + } } - return 0; +end: + exit(!ret ? EXIT_SUCCESS : EXIT_FAILURE); }