From 48c56fcfaec23b51b49cbafb745b1638f8594068 Mon Sep 17 00:00:00 2001 From: Pierre-Marc Fournier Date: Sun, 13 Sep 2009 11:38:19 -0400 Subject: [PATCH] add missing tests/basic and tests/fork --- tests/basic/Makefile.am | 9 +++++++++ tests/basic/basic.c | 22 ++++++++++++++++++++++ tests/basic/run | 8 ++++++++ tests/fork/Makefile.am | 9 +++++++++ tests/fork/fork.c | 31 +++++++++++++++++++++++++++++++ tests/fork/run | 7 +++++++ 6 files changed, 86 insertions(+) create mode 100644 tests/basic/Makefile.am create mode 100644 tests/basic/basic.c create mode 100755 tests/basic/run create mode 100644 tests/fork/Makefile.am create mode 100644 tests/fork/fork.c create mode 100755 tests/fork/run diff --git a/tests/basic/Makefile.am b/tests/basic/Makefile.am new file mode 100644 index 00000000..d949bb46 --- /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 00000000..a5ceff36 --- /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 00000000..16601ef5 --- /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 00000000..100cd367 --- /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 00000000..20a08779 --- /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 00000000..7c36d019 --- /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 -- 2.34.1