-AM_CFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/src -I$(srcdir) -O2 -g
-AM_LDFLAGS =
+AM_CFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/src \
+ -I$(top_srcdir)/tests/utils -I$(srcdir) -O2 -g
if LTTNG_TOOLS_BUILD_WITH_LIBDL
LIBS += -ldl
if HAVE_LIBLTTNG_UST_CTL
noinst_PROGRAMS = gen-ust-events
gen_ust_events_SOURCES = gen-ust-events.c tp.c tp.h
-gen_ust_events_LDADD = -llttng-ust -lurcu-bp
+gen_ust_events_LDADD = -llttng-ust -lurcu-bp \
+ $(top_builddir)/tests/utils/libtestutils.la
endif
#include <signal.h>
#include <poll.h>
#include <errno.h>
+#include "utils.h"
#define TRACEPOINT_DEFINE
#include "tp.h"
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;
*/
create_file(after_first_event_file_path);
if (nr_usec) {
- usleep(nr_usec);
+ if (usleep_safe(nr_usec)) {
+ ret = -1;
+ goto end;
+ }
}
}
- return 0;
+end:
+ exit(!ret ? EXIT_SUCCESS : EXIT_FAILURE);
}
-AM_CFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/src -I$(srcdir) -O2 -g
-AM_LDFLAGS =
+AM_CFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/src -I$(srcdir) \
+ -I$(top_srcdir)/tests/utils -O2 -g
if LTTNG_TOOLS_BUILD_WITH_LIBDL
LIBS += -ldl
if HAVE_LIBLTTNG_UST_CTL
noinst_PROGRAMS = gen-ust-nevents
gen_ust_nevents_SOURCES = gen-ust-nevents.c tp.c tp.h
-gen_ust_nevents_LDADD = -llttng-ust -lurcu-bp
+gen_ust_nevents_LDADD = -llttng-ust -lurcu-bp \
+ $(top_builddir)/tests/utils/libtestutils.la
endif
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
+#include "utils.h"
#define TRACEPOINT_DEFINE
#include "tp.h"
int main(int argc, char **argv)
{
- int i, netint;
+ int i, netint, ret = 0;
long values[] = { 1, 2, 3 };
char text[10] = "test";
double dbl = 2.0;
dbl, flt);
tracepoint(tp, tptest5, i, netint, values, text, strlen(text),
dbl, flt);
- usleep(nr_usec);
+ if (nr_usec) {
+ if (usleep_safe(nr_usec)) {
+ ret = -1;
+ goto end;
+ }
+ }
}
- return 0;
+end:
+ exit(!ret ? EXIT_SUCCESS : EXIT_FAILURE);
}