From: Pierre-Marc Fournier Date: Mon, 15 Jun 2009 17:03:25 +0000 (-0400) Subject: reorganize test programs into tests/ directory X-Git-Tag: v0.1~197 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=6dd969b5dd702909b8eb827e850c851053774055;p=ust.git reorganize test programs into tests/ directory --- diff --git a/Makefile.am b/Makefile.am index 99326af..1f9ba75 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,4 +1,4 @@ ACLOCAL_AMFLAGS = -I m4 -SUBDIRS = libust hello libmallocwrap ustd ust +SUBDIRS = libust tests libmallocwrap ustd ust EXTRA_DIST = share/kernelcompat.h doc diff --git a/configure.ac b/configure.ac index dce1239..21e00b5 100644 --- a/configure.ac +++ b/configure.ac @@ -78,7 +78,9 @@ AC_SUBST(KCOMPAT_LIBS) AC_CONFIG_FILES([ Makefile libust/Makefile - hello/Makefile + tests/Makefile + tests/hello/Makefile + tests/hello2/Makefile libmallocwrap/Makefile ustd/Makefile ust/Makefile diff --git a/hello/Makefile.am b/hello/Makefile.am deleted file mode 100644 index 845773e..0000000 --- a/hello/Makefile.am +++ /dev/null @@ -1,9 +0,0 @@ -INCLUDES = -I$(top_builddir)/share -I$(top_builddir)/libust \ - $(KCOMPAT_CFLAGS) $(URCU_CFLAGS) - -noinst_PROGRAMS = hello -hello_SOURCES = hello.c tp.c tp.h -hello_LDADD = $(top_builddir)/libust/libust.la $(URCU_LIBS) - -noinst_SCRIPTS = run -EXTRA_DIST = run diff --git a/hello/README b/hello/README deleted file mode 100644 index 68b11e6..0000000 --- a/hello/README +++ /dev/null @@ -1 +0,0 @@ -This is a hello world application used to test the LTTng userspace tracer. diff --git a/hello/hello.c b/hello/hello.c deleted file mode 100644 index 102b7db..0000000 --- a/hello/hello.c +++ /dev/null @@ -1,79 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include - -#include "marker.h" -#include "usterr.h" -#include "tracer.h" -#include "marker-control.h" -#include "relay.h" -#include "tp.h" - - -void inthandler(int sig) -{ - printf("in handler\n"); - exit(0); -} - -int init_int_handler(void) -{ - int result; - struct sigaction act; - - result = sigemptyset(&act.sa_mask); - if(result == -1) { - PERROR("sigemptyset"); - return -1; - } - - act.sa_handler = inthandler; - act.sa_flags = SA_RESTART; - - /* Only defer ourselves. Also, try to restart interrupted - * syscalls to disturb the traced program as little as possible. - */ - result = sigaction(SIGINT, &act, NULL); - if(result == -1) { - PERROR("sigaction"); - return -1; - } - - return 0; -} - -int main() -{ - int result; - int i; - - init_int_handler(); - - printf("Hello, World!\n"); - - sleep(1); - for(i=0; i<50; i++) { - trace_mark(ust, bar, "str %s", "FOOBAZ"); - trace_mark(ust, bar2, "number1 %d number2 %d", 53, 9800); - trace_hello_tptest(i); - usleep(100000); - } - - scanf("%*s"); - - ltt_trace_stop("auto"); - ltt_trace_destroy("auto"); - - DBG("TRACE STOPPED"); - scanf("%*s"); - - return 0; -} - -MARKER_LIB; -TRACEPOINT_LIB; diff --git a/hello/run b/hello/run deleted file mode 100755 index da8df17..0000000 --- a/hello/run +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -UST_AUTOPROBE=1 UST_TRACE=1 LD_LIBRARY_PATH=../libust/.libs:../../liburcu $1 .libs/hello diff --git a/hello/tp.c b/hello/tp.c deleted file mode 100644 index 2ee7392..0000000 --- a/hello/tp.c +++ /dev/null @@ -1,17 +0,0 @@ -#include "tp.h" -#include "marker.h" -#include "usterr.h" - -DEFINE_TRACE(hello_tptest); - -void tptest_probe(int anint) -{ - DBG("in tracepoint probe..."); - trace_mark(ust, tptest, "anint %d", anint); -} - -static void __attribute__((constructor)) init() -{ - DBG("connecting tracepoint..."); - register_trace_hello_tptest(tptest_probe); -} diff --git a/hello/tp.h b/hello/tp.h deleted file mode 100644 index 6064283..0000000 --- a/hello/tp.h +++ /dev/null @@ -1,5 +0,0 @@ -#include "tracepoint.h" - -DECLARE_TRACE(hello_tptest, - TPPROTO(int anint), - TPARGS(anint)); diff --git a/tests/hello/Makefile.am b/tests/hello/Makefile.am new file mode 100644 index 0000000..845773e --- /dev/null +++ b/tests/hello/Makefile.am @@ -0,0 +1,9 @@ +INCLUDES = -I$(top_builddir)/share -I$(top_builddir)/libust \ + $(KCOMPAT_CFLAGS) $(URCU_CFLAGS) + +noinst_PROGRAMS = hello +hello_SOURCES = hello.c tp.c tp.h +hello_LDADD = $(top_builddir)/libust/libust.la $(URCU_LIBS) + +noinst_SCRIPTS = run +EXTRA_DIST = run diff --git a/tests/hello/README b/tests/hello/README new file mode 100644 index 0000000..68b11e6 --- /dev/null +++ b/tests/hello/README @@ -0,0 +1 @@ +This is a hello world application used to test the LTTng userspace tracer. diff --git a/tests/hello/hello.c b/tests/hello/hello.c new file mode 100644 index 0000000..102b7db --- /dev/null +++ b/tests/hello/hello.c @@ -0,0 +1,79 @@ +#include +#include +#include +#include +#include +#include +#include +#include + +#include "marker.h" +#include "usterr.h" +#include "tracer.h" +#include "marker-control.h" +#include "relay.h" +#include "tp.h" + + +void inthandler(int sig) +{ + printf("in handler\n"); + exit(0); +} + +int init_int_handler(void) +{ + int result; + struct sigaction act; + + result = sigemptyset(&act.sa_mask); + if(result == -1) { + PERROR("sigemptyset"); + return -1; + } + + act.sa_handler = inthandler; + act.sa_flags = SA_RESTART; + + /* Only defer ourselves. Also, try to restart interrupted + * syscalls to disturb the traced program as little as possible. + */ + result = sigaction(SIGINT, &act, NULL); + if(result == -1) { + PERROR("sigaction"); + return -1; + } + + return 0; +} + +int main() +{ + int result; + int i; + + init_int_handler(); + + printf("Hello, World!\n"); + + sleep(1); + for(i=0; i<50; i++) { + trace_mark(ust, bar, "str %s", "FOOBAZ"); + trace_mark(ust, bar2, "number1 %d number2 %d", 53, 9800); + trace_hello_tptest(i); + usleep(100000); + } + + scanf("%*s"); + + ltt_trace_stop("auto"); + ltt_trace_destroy("auto"); + + DBG("TRACE STOPPED"); + scanf("%*s"); + + return 0; +} + +MARKER_LIB; +TRACEPOINT_LIB; diff --git a/tests/hello/run b/tests/hello/run new file mode 100755 index 0000000..da8df17 --- /dev/null +++ b/tests/hello/run @@ -0,0 +1,3 @@ +#!/bin/sh + +UST_AUTOPROBE=1 UST_TRACE=1 LD_LIBRARY_PATH=../libust/.libs:../../liburcu $1 .libs/hello diff --git a/tests/hello/tp.c b/tests/hello/tp.c new file mode 100644 index 0000000..2ee7392 --- /dev/null +++ b/tests/hello/tp.c @@ -0,0 +1,17 @@ +#include "tp.h" +#include "marker.h" +#include "usterr.h" + +DEFINE_TRACE(hello_tptest); + +void tptest_probe(int anint) +{ + DBG("in tracepoint probe..."); + trace_mark(ust, tptest, "anint %d", anint); +} + +static void __attribute__((constructor)) init() +{ + DBG("connecting tracepoint..."); + register_trace_hello_tptest(tptest_probe); +} diff --git a/tests/hello/tp.h b/tests/hello/tp.h new file mode 100644 index 0000000..6064283 --- /dev/null +++ b/tests/hello/tp.h @@ -0,0 +1,5 @@ +#include "tracepoint.h" + +DECLARE_TRACE(hello_tptest, + TPPROTO(int anint), + TPARGS(anint)); diff --git a/tests/hello2/Makefile.am b/tests/hello2/Makefile.am new file mode 100644 index 0000000..1abdae0 --- /dev/null +++ b/tests/hello2/Makefile.am @@ -0,0 +1,9 @@ +INCLUDES = -I$(top_builddir)/share -I$(top_builddir)/libust \ + $(KCOMPAT_CFLAGS) $(URCU_CFLAGS) + +noinst_PROGRAMS = hello2 +hello2_SOURCES = hello2.c +hello2_LDADD = $(top_builddir)/libust/libust.la $(URCU_LIBS) + +noinst_SCRIPTS = run +EXTRA_DIST = run diff --git a/tests/hello2/README b/tests/hello2/README new file mode 100644 index 0000000..68b11e6 --- /dev/null +++ b/tests/hello2/README @@ -0,0 +1 @@ +This is a hello world application used to test the LTTng userspace tracer. diff --git a/tests/hello2/hello2.c b/tests/hello2/hello2.c new file mode 100644 index 0000000..f9bebce --- /dev/null +++ b/tests/hello2/hello2.c @@ -0,0 +1,21 @@ +#include +#include +#include "marker.h" +int main() +{ + int result; + int i; + +// sleep(1); + + printf("Hello, World!\n"); + + for(i=0; i<500; i++) { + trace_mark(ust, bar, "str %d", i); + trace_mark(ust, bar2, "number1 %d number2 %d", (int)53, (int)9800); + usleep(20); + } + + return 0; +} +MARKER_LIB; diff --git a/tests/hello2/run b/tests/hello2/run new file mode 100755 index 0000000..6f5f5ba --- /dev/null +++ b/tests/hello2/run @@ -0,0 +1,3 @@ +#!/bin/sh + +UST_AUTOPROBE=1 UST_TRACE=1 LD_LIBRARY_PATH=../libust/.libs:../../liburcu $1 .libs/hello2