From: Pierre-Marc Fournier Date: Sun, 13 Sep 2009 15:38:19 +0000 (-0400) Subject: add missing tests/basic and tests/fork X-Git-Tag: v0.1~139 X-Git-Url: http://git.lttng.org/?p=ust.git;a=commitdiff_plain;h=48c56fcfaec23b51b49cbafb745b1638f8594068 add missing tests/basic and tests/fork --- diff --git a/tests/basic/Makefile.am b/tests/basic/Makefile.am new file mode 100644 index 0000000..d949bb4 --- /dev/null +++ b/tests/basic/Makefile.am @@ -0,0 +1,9 @@ +INCLUDES = -I$(top_builddir)/share -I$(top_builddir)/libust \ + $(KCOMPAT_CFLAGS) $(URCU_CFLAGS) + +noinst_PROGRAMS = basic +basic_SOURCES = basic.c +basic_LDADD = $(top_builddir)/libust/libust.la $(URCU_LIBS) + +noinst_SCRIPTS = run +EXTRA_DIST = run diff --git a/tests/basic/basic.c b/tests/basic/basic.c new file mode 100644 index 0000000..a5ceff3 --- /dev/null +++ b/tests/basic/basic.c @@ -0,0 +1,22 @@ +#include +#include + +#include "marker.h" + + +int main() +{ + int i; + + printf("Basic test program\n"); + + for(i=0; i<50; i++) { + trace_mark(ust, bar, "str %s", "FOOBAZ"); + trace_mark(ust, bar2, "number1 %d number2 %d", 53, 9800); + usleep(100000); + } + + return 0; +} + +MARKER_LIB; diff --git a/tests/basic/run b/tests/basic/run new file mode 100755 index 0000000..16601ef --- /dev/null +++ b/tests/basic/run @@ -0,0 +1,8 @@ +#!/bin/sh + +# Run with nothing + + +#LD_LIBRARY_PATH=../../libust/.libs:../../../liburcu $1 .libs/basic +#UST_AUTOPROBE="/foo" LD_LIBRARY_PATH=../../libust/.libs:../../../liburcu $1 .libs/basic +UST_AUTOPROBE=1 UST_TRACE=1 LD_LIBRARY_PATH=../../libust/.libs:../../../liburcu $1 .libs/basic diff --git a/tests/fork/Makefile.am b/tests/fork/Makefile.am new file mode 100644 index 0000000..100cd36 --- /dev/null +++ b/tests/fork/Makefile.am @@ -0,0 +1,9 @@ +INCLUDES = -I$(top_builddir)/share -I$(top_builddir)/libust \ + $(KCOMPAT_CFLAGS) $(URCU_CFLAGS) + +noinst_PROGRAMS = fork +fork_SOURCES = fork.c +fork_LDADD = $(top_builddir)/libust/libust.la $(URCU_LIBS) + +noinst_SCRIPTS = run +EXTRA_DIST = run diff --git a/tests/fork/fork.c b/tests/fork/fork.c new file mode 100644 index 0000000..20a0877 --- /dev/null +++ b/tests/fork/fork.c @@ -0,0 +1,31 @@ +#include +#include + +#include "marker.h" + + +int main() +{ + int result; + + printf("Fork test program\n"); + trace_mark(ust, before_fork, MARK_NOARGS); + + sleep(5); + + result = fork(); + if(result == -1) { + perror("fork"); + return 1; + } + if(result == 0) { + trace_mark(ust, after_fork_child, MARK_NOARGS); + } + else { + trace_mark(ust, after_fork_parent, MARK_NOARGS); + } + + return 0; +} + +MARKER_LIB; diff --git a/tests/fork/run b/tests/fork/run new file mode 100755 index 0000000..7c36d01 --- /dev/null +++ b/tests/fork/run @@ -0,0 +1,7 @@ +#!/bin/sh + +# Run with nothing + +#UST_AUTOPROBE=1 UST_TRACE=1 LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../../libust/.libs:../../../liburcu $1 .libs/fork +#UST_AUTOPROBE=1 UST_TRACE=1 LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../../libust/.libs:../../../liburcu LD_PRELOAD=../../libinterfork/.libs/libinterfork.so $1 .libs/fork +#LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../../libust/.libs:../../../liburcu .libs/fork