Skip to contentSkip to conversation

Tests: Replace usage of gen-ust-events testapp in streaming tests

PATCH New Christian Babeux 2 participants 6 messages May 13, 2013 – May 14, 2013 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 2/6 Tests: Replace usage of gen-ust-events testapp in streaming tests

Use the gen-ust-events binary found under tests/utils/testapp/gen-ust-events/.

---
 tests/regression/tools/streaming/Makefile.am       | 16 ------
 tests/regression/tools/streaming/gen-ust-events.c  | 59 ----------------------
 .../tools/streaming/test_high_throughput_limits    | 12 +++--
 tests/regression/tools/streaming/test_ust          | 16 +++---
 tests/regression/tools/streaming/tp.c              | 15 ------
 tests/regression/tools/streaming/tp.h              | 56 --------------------
 6 files changed, 17 insertions(+), 157 deletions(-)
 delete mode 100644 tests/regression/tools/streaming/gen-ust-events.c
 delete mode 100644 tests/regression/tools/streaming/tp.c
 delete mode 100644 tests/regression/tools/streaming/tp.h
tests/regression/tools/streaming/Makefile.am +0 -16
index e424350..050cdea 100644
@@ -1,18 +1,2 @@
-AM_CFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/src -I$(top_srcdir)/tests/utils -I$(srcdir) -O2 -g
-AM_LDFLAGS =
-
-if LTTNG_TOOLS_BUILD_WITH_LIBDL
-AM_LDFLAGS += -ldl
-endif
-if LTTNG_TOOLS_BUILD_WITH_LIBC_DL
-AM_LDFLAGS += -lc
-endif
-
-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
-endif
-
 noinst_SCRIPTS = test_ust test_kernel test_high_throughput_limits
 EXTRA_DIST = test_ust test_kernel test_high_throughput_limits
tests/regression/tools/streaming/gen-ust-events.c deleted +0 -59

59 lines not on this page · raw message

tests/regression/tools/streaming/test_high_throughput_limits +7 -5
index f3885a8..b2c8864 100755
@@ -22,7 +22,9 @@ CURDIR=$(dirname $0)/
 TESTDIR=$CURDIR/../../..
 NR_APP_ITER=10
 NR_ITER=1000000
-BIN_NAME="gen-ust-events"
+TESTAPP_PATH="$TESTDIR/utils/testapp"
+TESTAPP_NAME="gen-ust-events"
+TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME"
 SESSION_NAME="high-throughput"
 EVENT_NAME="tp:tptest"
 SESSIOND_CTRL_PORT=5342
@@ -35,8 +37,8 @@ NUM_TESTS=112
 
 source $TESTDIR/utils/utils.sh
 
-if [ ! -x "$CURDIR/$BIN_NAME" ]; then
-	BAIL_OUT "No UST nevents binary detected."
+if [ ! -x "$TESTAPP_BIN" ]; then
+	BAIL_OUT "No UST events binary detected."
 fi
 
 function set_bw_limit
@@ -89,13 +91,13 @@ function run_apps
 		# due to very slow communication between the consumer and relayd making
 		# the status reply from the consumer quite slow thus delaying the
 		# registration done message.
-		LTTNG_UST_REGISTER_TIMEOUT=-1 ./$CURDIR/$BIN_NAME $NR_ITER & >/dev/null 2>&1
+		LTTNG_UST_REGISTER_TIMEOUT=-1 $TESTAPP_BIN $NR_ITER & >/dev/null 2>&1
 	done
 }
 
 function wait_apps
 {
-	while [ -n "$(pidof $BIN_NAME)" ]; do
+	while [ -n "$(pidof $TESTAPP_NAME)" ]; do
 		sleep 1
 	done
 	pass "Wait for applications to end"
tests/regression/tools/streaming/test_ust +10 -6
index 333b2e9..785a9a8 100755
@@ -18,7 +18,11 @@ TEST_DESC="Streaming - User space tracing"
 
 CURDIR=$(dirname $0)/
 TESTDIR=$CURDIR/../../..
-BIN_NAME="gen-ust-events"
+NR_ITER=5
+NR_USEC_WAIT=1000000
+TESTAPP_PATH="$TESTDIR/utils/testapp"
+TESTAPP_NAME="gen-ust-events"
+TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME"
 SESSION_NAME="stream"
 EVENT_NAME="tp:tptest"
 PID_RELAYD=0
@@ -29,8 +33,8 @@ NUM_TESTS=18
 
 source $TESTDIR/utils/utils.sh
 
-if [ ! -x "$CURDIR/$BIN_NAME" ]; then
-	BAIL_OUT "No UST nevents binary detected."
+if [ ! -x "$TESTAPP_BIN" ]; then
+	BAIL_OUT "No UST events binary detected."
 fi
 
 function lttng_create_session_uri
@@ -42,7 +46,7 @@ function lttng_create_session_uri
 
 function wait_apps
 {
-	while [ -n "$(pidof $BIN_NAME)" ]; do
+	while [ -n "$(pidof $TESTAPP_NAME)" ]; do
 		sleep 0.5
 	done
 	pass "Wait for applications to end"
@@ -57,7 +61,7 @@ function test_ust_before_start ()
 	enable_ust_lttng_event $SESSION_NAME $EVENT_NAME
 
 	# Run 5 times with a 1 second delay
-	./$CURDIR/$BIN_NAME 5 1000000 >/dev/null 2>&1 &
+	$TESTAPP_BIN $NR_ITER $NR_USEC_WAIT >/dev/null 2>&1 &
 
 	start_lttng_tracing $SESSION_NAME
 
@@ -75,7 +79,7 @@ function test_ust_after_start ()
 	start_lttng_tracing $SESSION_NAME
 
 	# Run 5 times with a 1 second delay
-	./$CURDIR/$BIN_NAME 5 1000000 >/dev/null 2>&1 &
+	$TESTAPP_BIN $NR_ITER $NR_USEC_WAIT >/dev/null 2>&1 &
 
 	wait_apps
 
tests/regression/tools/streaming/tp.c deleted +0 -15
deleted file mode 100644
index a09561d..0000000
@@ -1,15 +0,0 @@
-/*
- * Copyright (c) - 2012 David Goulet <[email protected]>
- *
- * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED OR
- * IMPLIED. ANY USE IS AT YOUR OWN RISK.
- *
- * Permission is hereby granted to use or copy this program for any purpose,
- * provided the above notices are retained on all copies.  Permission to modify
- * the code and to distribute modified code is granted, provided the above
- * notices are retained, and a notice that the code was modified is included
- * with the above copyright notice.
- */
-
-#define TRACEPOINT_CREATE_PROBES
-#include "tp.h"
tests/regression/tools/streaming/tp.h deleted +0 -56

56 lines not on this page · raw message

Signature · 1 line
1.8.2.2
#2 lore raw

PATCH 3/6 Tests: Replace usage of gen-ust-events testapp in ust before-after test

In reply to a message not in the archive

Use the gen-ust-events binary found under tests/utils/testapp/gen-ust-events/.

---
 tests/regression/ust/before-after/Makefile.am      | 14 ------
 tests/regression/ust/before-after/gen-nevents.c    | 56 ----------------------
 .../regression/ust/before-after/test_before_after  | 14 +++---
 tests/regression/ust/before-after/tp.c             | 16 -------
 .../regression/ust/before-after/ust_gen_nevents.h  | 56 ----------------------
 5 files changed, 8 insertions(+), 148 deletions(-)
 delete mode 100644 tests/regression/ust/before-after/gen-nevents.c
 delete mode 100644 tests/regression/ust/before-after/tp.c
 delete mode 100644 tests/regression/ust/before-after/ust_gen_nevents.h
tests/regression/ust/before-after/Makefile.am +0 -14
index f883a32..e37fe96 100644
@@ -1,16 +1,2 @@
-AM_CFLAGS = -I$(srcdir) -O2
-AM_LDFLAGS = -llttng-ust
-
-if LTTNG_TOOLS_BUILD_WITH_LIBDL
-AM_LDFLAGS += -ldl
-endif
-if LTTNG_TOOLS_BUILD_WITH_LIBC_DL
-AM_LDFLAGS += -lc
-endif
-
-noinst_PROGRAMS = gen-nevents
-gen_nevents_SOURCES = gen-nevents.c tp.c ust_gen_nevents.h
-gen_nevents_LDADD = -llttng-ust
-
 noinst_SCRIPTS = test_before_after
 EXTRA_DIST = test_before_after
tests/regression/ust/before-after/gen-nevents.c deleted +0 -56

56 lines not on this page · raw message

tests/regression/ust/before-after/test_before_after +8 -6
index c3e24f7..6d45bb5 100755
@@ -19,27 +19,29 @@ TEST_DESC="UST tracer - Start tracing before and after execution"
 CURDIR=$(dirname $0)/
 TESTDIR=$CURDIR/../../..
 NR_ITER=100
+NR_USEC_WAIT=100000
+TESTAPP_PATH="$TESTDIR/utils/testapp"
+TESTAPP_NAME="gen-ust-events"
+TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME"
 SESSION_NAME="per-session"
-EVENT_NAME="ust_gen_nevents:tptest"
+EVENT_NAME="tp:tptest"
 NUM_TESTS=16
 
 source $TESTDIR/utils/utils.sh
 
-if [ ! -x "$CURDIR/gen-nevents" ]; then
+if [ ! -x "$TESTAPP_BIN" ]; then
 	BAIL_OUT "No UST nevents binary detected."
 fi
 
 # MUST set TESTDIR before calling those functions
 
 test_before_apps() {
-	local out
-
 	# BEFORE application is spawned
 	create_lttng_session $SESSION_NAME $TRACE_PATH
 	enable_ust_lttng_event $SESSION_NAME $EVENT_NAME
 	start_lttng_tracing $SESSION_NAME
 
-	./$CURDIR/gen-nevents $NR_ITER
+	$TESTAPP_BIN $NR_ITER $NR_USEC_WAIT
 	ok $? "Start application to trace"
 
 	stop_lttng_tracing $SESSION_NAME
@@ -53,7 +55,7 @@ test_before_apps() {
 test_after_apps() {
 	local out
 
-	./$CURDIR/gen-nevents 100 &
+	$TESTAPP_BIN $NR_ITER $NR_USEC_WAIT &
 	ok $? "Start application to trace"
 
 	# BEFORE application is spawned
tests/regression/ust/before-after/tp.c deleted +0 -16
deleted file mode 100644
index e291924..0000000
@@ -1,16 +0,0 @@
-/*
- * Copyright (c) - 2011 Mathieu Desnoyers <[email protected]>
- * Copyright (c) - 2012 David Goulet <[email protected]>
- *
- * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED OR
- * IMPLIED. ANY USE IS AT YOUR OWN RISK.
- *
- * Permission is hereby granted to use or copy this program for any purpose,
- * provided the above notices are retained on all copies.  Permission to modify
- * the code and to distribute modified code is granted, provided the above
- * notices are retained, and a notice that the code was modified is included
- * with the above copyright notice.
- */
-
-#define TRACEPOINT_CREATE_PROBES
-#include "ust_gen_nevents.h"
tests/regression/ust/before-after/ust_gen_nevents.h deleted +0 -56

56 lines not on this page · raw message

Signature · 1 line
1.8.2.2
#3 lore raw

PATCH 4/6 Tests: Replace usage of gen-ust-events testapp in ust buffers-uid test

In reply to a message not in the archive

Use the gen-ust-events binary found under tests/utils/testapp/gen-ust-events/.

---
 tests/regression/ust/buffers-uid/Makefile.am       | 14 ------
 tests/regression/ust/buffers-uid/gen-nevents.c     | 56 ----------------------
 tests/regression/ust/buffers-uid/test_buffers_uid  | 24 ++++++----
 tests/regression/ust/buffers-uid/tp.c              | 16 -------
 tests/regression/ust/buffers-uid/ust_gen_nevents.h | 56 ----------------------
 5 files changed, 14 insertions(+), 152 deletions(-)
 delete mode 100644 tests/regression/ust/buffers-uid/gen-nevents.c
 delete mode 100644 tests/regression/ust/buffers-uid/tp.c
 delete mode 100644 tests/regression/ust/buffers-uid/ust_gen_nevents.h
tests/regression/ust/buffers-uid/Makefile.am +0 -14
index 31fb019..4fefd80 100644
@@ -1,16 +1,2 @@
-AM_CFLAGS = -I$(srcdir) -O2
-AM_LDFLAGS = -llttng-ust
-
-if LTTNG_TOOLS_BUILD_WITH_LIBDL
-AM_LDFLAGS += -ldl
-endif
-if LTTNG_TOOLS_BUILD_WITH_LIBC_DL
-AM_LDFLAGS += -lc
-endif
-
-noinst_PROGRAMS = gen-nevents
-gen_nevents_SOURCES = gen-nevents.c tp.c ust_gen_nevents.h
-gen_nevents_LDADD = -llttng-ust
-
 noinst_SCRIPTS = test_buffers_uid
 EXTRA_DIST = test_buffers_uid
tests/regression/ust/buffers-uid/gen-nevents.c deleted +0 -56

56 lines not on this page · raw message

tests/regression/ust/buffers-uid/test_buffers_uid +14 -10
index 3b5c7a6..6af675c 100755
@@ -19,15 +19,19 @@ TEST_DESC="UST tracer - Tracing with per UID buffers"
 CURDIR=$(dirname $0)/
 TESTDIR=$CURDIR/../../..
 NR_ITER=100
+NR_USEC_WAIT=100000
 SESSION_NAME="buffers-uid"
-EVENT_NAME="ust_gen_nevents:tptest"
-BIN_NAME="gen-nevents"
+
+TESTAPP_PATH="$TESTDIR/utils/testapp"
+TESTAPP_NAME="gen-ust-events"
+TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME"
+EVENT_NAME="tp:tptest"
 NUM_TESTS=58
 
 source $TESTDIR/utils/utils.sh
 
-if [ ! -x "$CURDIR/gen-nevents" ]; then
-	BAIL_OUT "No UST nevents binary detected."
+if [ ! -x "$TESTAPP_BIN" ]; then
+	BAIL_OUT "No UST events binary detected."
 fi
 
 # MUST set TESTDIR before calling those functions
@@ -44,7 +48,7 @@ function enable_channel_per_uid()
 function wait_apps
 {
 	diag "Waiting for applications to end..."
-	while [ -n "$(pidof $BIN_NAME)" ]; do
+	while [ -n "$(pidof $TESTAPP_NAME)" ]; do
 		sleep 1
 	done
 }
@@ -62,7 +66,7 @@ test_after_multiple_apps() {
 	start_lttng_tracing $SESSION_NAME
 
 	for i in `seq 1 5`; do
-		./$CURDIR/$BIN_NAME $NR_ITER & >/dev/null 2>&1
+		$TESTAPP_BIN $NR_ITER $NR_USEC_WAIT & >/dev/null 2>&1
 		ok $? "Start application $i for tracing"
 	done
 	wait_apps
@@ -82,7 +86,7 @@ test_before_multiple_apps() {
 	diag "Start multiple applications BEFORE tracing is started"
 
 	for i in `seq 1 5`; do
-		./$CURDIR/$BIN_NAME $NR_ITER & >/dev/null 2>&1
+		$TESTAPP_BIN $NR_ITER $NR_USEC_WAIT & >/dev/null 2>&1
 		ok $? "Start application $i for tracing"
 	done
 
@@ -125,7 +129,7 @@ test_after_app() {
 	enable_ust_lttng_event $SESSION_NAME $EVENT_NAME
 	start_lttng_tracing $SESSION_NAME
 
-	./$CURDIR/$BIN_NAME $NR_ITER
+	$TESTAPP_BIN $NR_ITER $NR_USEC_WAIT
 	ok $? "Start application to trace"
 
 	stop_lttng_tracing $SESSION_NAME
@@ -141,7 +145,7 @@ test_before_app() {
 
 	diag "Start application BEFORE tracing is started"
 
-	./$CURDIR/$BIN_NAME $NR_ITER &
+	$TESTAPP_BIN $NR_ITER $NR_USEC_WAIT &
 	ok $? "Start application to trace"
 
 	# BEFORE application is spawned
@@ -197,7 +201,7 @@ test_multiple_channels() {
 	ok $? "Enable event $EVENT_NAME for session $SESSION_NAME in channel4"
 	start_lttng_tracing $SESSION_NAME
 
-	./$CURDIR/$BIN_NAME $NR_ITER
+	$TESTAPP_BIN $NR_ITER $NR_USEC_WAIT
 	ok $? "Start application to trace"
 
 	stop_lttng_tracing $SESSION_NAME
tests/regression/ust/buffers-uid/tp.c deleted +0 -16
deleted file mode 100644
index e291924..0000000
@@ -1,16 +0,0 @@
-/*
- * Copyright (c) - 2011 Mathieu Desnoyers <[email protected]>
- * Copyright (c) - 2012 David Goulet <[email protected]>
- *
- * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED OR
- * IMPLIED. ANY USE IS AT YOUR OWN RISK.
- *
- * Permission is hereby granted to use or copy this program for any purpose,
- * provided the above notices are retained on all copies.  Permission to modify
- * the code and to distribute modified code is granted, provided the above
- * notices are retained, and a notice that the code was modified is included
- * with the above copyright notice.
- */
-
-#define TRACEPOINT_CREATE_PROBES
-#include "ust_gen_nevents.h"
tests/regression/ust/buffers-uid/ust_gen_nevents.h deleted +0 -56

56 lines not on this page · raw message

Signature · 1 line
1.8.2.2
#4 lore raw

PATCH 5/6 Tests: Replace usage of gen-ust-events testapp in ust nprocesses test

In reply to a message not in the archive

Use the gen-ust-events binary found under tests/utils/testapp/gen-ust-events/.

---
 tests/regression/ust/nprocesses/Makefile.am       | 14 ------
 tests/regression/ust/nprocesses/gen-events-time.c | 61 -----------------------
 tests/regression/ust/nprocesses/test_nprocesses   | 28 ++++++-----
 tests/regression/ust/nprocesses/tp.c              | 16 ------
 tests/regression/ust/nprocesses/ust_gen_event.h   | 56 ---------------------
 5 files changed, 16 insertions(+), 159 deletions(-)
 delete mode 100644 tests/regression/ust/nprocesses/gen-events-time.c
 delete mode 100644 tests/regression/ust/nprocesses/tp.c
 delete mode 100644 tests/regression/ust/nprocesses/ust_gen_event.h
tests/regression/ust/nprocesses/Makefile.am +0 -14
index 3113a34..70a4eea 100644
@@ -1,16 +1,2 @@
-AM_CFLAGS = -I$(srcdir) -O2
-AM_LDFLAGS = -llttng-ust
-
-if LTTNG_TOOLS_BUILD_WITH_LIBDL
-AM_LDFLAGS += -ldl
-endif
-if LTTNG_TOOLS_BUILD_WITH_LIBC_DL
-AM_LDFLAGS += -lc
-endif
-
-noinst_PROGRAMS = gen-events-time
-gen_events_time_SOURCES = gen-events-time.c tp.c ust_gen_event.h
-gen_events_time_LDADD = -llttng-ust
-
 noinst_SCRIPTS = test_nprocesses
 EXTRA_DIST = test_nprocesses
tests/regression/ust/nprocesses/gen-events-time.c deleted +0 -61

61 lines not on this page · raw message

tests/regression/ust/nprocesses/test_nprocesses +16 -12
index f9ed0b1..1660c21 100755
@@ -14,21 +14,25 @@
 # You should have received a copy of the GNU Lesser General Public License
 # along with this library; if not, write to the Free Software Foundation, Inc.,
 # 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
-NR_ITER=30
-TEST_DESC="UST tracer - Generate $NR_ITER process"
+NUM_PROCESS=30
+TEST_DESC="UST tracer - Generate $NUM_PROCESS process"
 
 CURDIR=$(dirname $0)/
 TESTDIR=$CURDIR/../../..
-TEST_BIN_NAME="gen-events-time"
+NR_ITER=1000
+NR_USEC_WAIT=1000000
+TESTAPP_PATH="$TESTDIR/utils/testapp"
+TESTAPP_NAME="gen-ust-events"
+TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME"
 SESSION_NAME="ust-nprocesses"
-EVENT_NAME="ust_gen_event:tptest"
+EVENT_NAME="tp:tptest"
 TEST_WAIT_SEC=5
 NUM_TESTS=9
 
 source $TESTDIR/utils/utils.sh
 
-if [ ! -x "$CURDIR/$TEST_BIN_NAME" ]; then
-	BAIL_OUT "No UST $TEST_BIN_NAME binary detected."
+if [ ! -x "$TESTAPP_BIN" ]; then
+	BAIL_OUT "No UST $TESTAPP_BIN binary detected."
 fi
 
 # MUST set TESTDIR before calling those functions
@@ -41,15 +45,15 @@ start_lttng_sessiond
 
 # Start test for 1000 seconds
 
-for i in `seq 1 $NR_ITER`
+for i in `seq 1 $NUM_PROCESS`
 do
-	./$CURDIR/$TEST_BIN_NAME 1000 >/dev/null 2>&1 &
+	$TESTAPP_BIN $NR_ITER $NR_USEC_WAIT >/dev/null 2>&1 &
 done
 
 reg_app_count=0
-while [ $reg_app_count -ne $NR_ITER ]; do
+while [ $reg_app_count -ne $NUM_PROCESS ]; do
 	listing=$($TESTDIR/../src/bin/lttng/$LTTNG_BIN list -u)
-	reg_app_count=$(echo -n $listing | sed "s/$TEST_BIN_NAME/$TEST_BIN_NAME\n/g" | grep "$TEST_BIN_NAME" | wc -l)
+	reg_app_count=$(echo -n $listing | sed "s#$TESTAPP_BIN#$TESTAPP_BIN\n#g" | grep "$TESTAPP_BIN" | wc -l)
 done
 
 pass "Trace validation"
@@ -71,8 +75,8 @@ destroy_lttng_session $SESSION_NAME
 
 rm -rf $TRACE_PATH
 
-while [ -n "$(pidof $TEST_BIN_NAME)" ]; do
-	killall -q $TEST_BIN_NAME >/dev/null 2>&1
+while [ -n "$(pidof $TESTAPP_NAME)" ]; do
+	killall -q $TESTAPP_NAME >/dev/null 2>&1
 	sleep 0.5
 done
 
tests/regression/ust/nprocesses/tp.c deleted +0 -16
deleted file mode 100644
index 438139e..0000000
@@ -1,16 +0,0 @@
-/*
- * Copyright (c) - 2011 Mathieu Desnoyers <[email protected]>
- * Copyright (c) - 2012 David Goulet <[email protected]>
- *
- * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED OR
- * IMPLIED. ANY USE IS AT YOUR OWN RISK.
- *
- * Permission is hereby granted to use or copy this program for any purpose,
- * provided the above notices are retained on all copies.  Permission to modify
- * the code and to distribute modified code is granted, provided the above
- * notices are retained, and a notice that the code was modified is included
- * with the above copyright notice.
- */
-
-#define TRACEPOINT_CREATE_PROBES
-#include "ust_gen_event.h"
tests/regression/ust/nprocesses/ust_gen_event.h deleted +0 -56

56 lines not on this page · raw message

Signature · 1 line
1.8.2.2
#5 lore raw

PATCH 6/6 Tests: Replace usage of gen-ust-events testapp in ust metadata-flush test

In reply to a message not in the archive

Use the gen-ust-events binary found under tests/utils/testapp/gen-ust-events/.

---
 .../ust/periodical-metadata-flush/Makefile.am      | 14 ------
 .../ust/periodical-metadata-flush/gen-nevents.c    | 56 ----------------------
 .../test_periodical_metadata_flush                 | 20 ++++----
 .../regression/ust/periodical-metadata-flush/tp.c  | 16 -------
 .../periodical-metadata-flush/ust_gen_nevents.h    | 56 ----------------------
 5 files changed, 12 insertions(+), 150 deletions(-)
 delete mode 100644 tests/regression/ust/periodical-metadata-flush/gen-nevents.c
 delete mode 100644 tests/regression/ust/periodical-metadata-flush/tp.c
 delete mode 100644 tests/regression/ust/periodical-metadata-flush/ust_gen_nevents.h
tests/regression/ust/periodical-metadata-flush/Makefile.am +0 -14
index 72013e8..c020920 100644
@@ -1,16 +1,2 @@
-AM_CFLAGS = -I$(srcdir) -O2
-AM_LDFLAGS = -llttng-ust
-
-if LTTNG_TOOLS_BUILD_WITH_LIBDL
-AM_LDFLAGS += -ldl
-endif
-if LTTNG_TOOLS_BUILD_WITH_LIBC_DL
-AM_LDFLAGS += -lc
-endif
-
-noinst_PROGRAMS = gen-nevents
-gen_nevents_SOURCES = gen-nevents.c tp.c ust_gen_nevents.h
-gen_nevents_LDADD = -llttng-ust
-
 noinst_SCRIPTS = test_periodical_metadata_flush
 EXTRA_DIST = test_periodical_metadata_flush
tests/regression/ust/periodical-metadata-flush/gen-nevents.c deleted +0 -56

56 lines not on this page · raw message

tests/regression/ust/periodical-metadata-flush/test_periodical_metadata_flush +12 -8
index 2d984d5..18d8a46 100755
@@ -19,15 +19,19 @@ TEST_DESC="UST tracer - Tracing with per UID buffers and periodical flush"
 CURDIR=$(dirname $0)/
 TESTDIR=$CURDIR/../../..
 NR_ITER=100
+NR_USEC_WAIT=100000
+TESTAPP_PATH="$TESTDIR/utils/testapp"
+TESTAPP_NAME="gen-ust-events"
+TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME"
 SESSION_NAME="periodical-flush"
-EVENT_NAME="ust_gen_nevents:tptest"
+EVENT_NAME="tp:tptest"
 BIN_NAME="gen-nevents"
 NUM_TESTS=38
 
 source $TESTDIR/utils/utils.sh
 
-if [ ! -x "$CURDIR/gen-nevents" ]; then
-	BAIL_OUT "No UST nevents binary detected."
+if [ ! -x "$TESTAPP_BIN" ]; then
+	BAIL_OUT "No UST events binary detected."
 fi
 
 # MUST set TESTDIR before calling those functions
@@ -62,7 +66,7 @@ function enable_metadata_per_pid()
 function wait_apps
 {
 	diag "Waiting for applications to end..."
-	while [ -n "$(pidof $BIN_NAME)" ]; do
+	while [ -n "$(pidof $TESTAPP_NAME)" ]; do
 		sleep 1
 	done
 }
@@ -79,7 +83,7 @@ test_after_app_pid() {
 	enable_ust_lttng_event $SESSION_NAME $EVENT_NAME
 	start_lttng_tracing $SESSION_NAME
 
-	./$CURDIR/$BIN_NAME $NR_ITER
+	$TESTAPP_BIN $NR_ITER $NR_USEC_WAIT
 	ok $? "Start application to trace"
 
 	stop_lttng_tracing $SESSION_NAME
@@ -95,7 +99,7 @@ test_before_app_pid() {
 
 	diag "Start application BEFORE tracing is started"
 
-	./$CURDIR/$BIN_NAME $NR_ITER &
+	$TESTAPP_BIN $NR_ITER $NR_USEC_WAIT &
 	ok $? "Start application to trace"
 
 	# BEFORE application is spawned
@@ -139,7 +143,7 @@ test_after_app_uid() {
 	enable_ust_lttng_event $SESSION_NAME $EVENT_NAME
 	start_lttng_tracing $SESSION_NAME
 
-	./$CURDIR/$BIN_NAME $NR_ITER
+	$TESTAPP_BIN $NR_ITER $NR_USEC_WAIT
 	ok $? "Start application to trace"
 
 	stop_lttng_tracing $SESSION_NAME
@@ -155,7 +159,7 @@ test_before_app_uid() {
 
 	diag "Start application BEFORE tracing is started"
 
-	./$CURDIR/$BIN_NAME $NR_ITER &
+	$TESTAPP_BIN $NR_ITER $NR_USEC_WAIT &
 	ok $? "Start application to trace"
 
 	# BEFORE application is spawned
tests/regression/ust/periodical-metadata-flush/tp.c deleted +0 -16
deleted file mode 100644
index e291924..0000000
@@ -1,16 +0,0 @@
-/*
- * Copyright (c) - 2011 Mathieu Desnoyers <[email protected]>
- * Copyright (c) - 2012 David Goulet <[email protected]>
- *
- * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED OR
- * IMPLIED. ANY USE IS AT YOUR OWN RISK.
- *
- * Permission is hereby granted to use or copy this program for any purpose,
- * provided the above notices are retained on all copies.  Permission to modify
- * the code and to distribute modified code is granted, provided the above
- * notices are retained, and a notice that the code was modified is included
- * with the above copyright notice.
- */
-
-#define TRACEPOINT_CREATE_PROBES
-#include "ust_gen_nevents.h"
tests/regression/ust/periodical-metadata-flush/ust_gen_nevents.h deleted +0 -56

56 lines not on this page · raw message

Signature · 1 line
1.8.2.2
#6 lore raw

Re: [PATCH lttng-tools 1/6] Tests: Cleanup and move gen-ust-events testapp under utils

In reply to a message not in the archive

All 6 patches merged.

David

Christian Babeux:

Quoted 220 lines

This will improve the maintainability and stop the copying madness going on in each test needing a UST sample application.

Application under test should go in tests/utils/testapp/<testapp_name>/.

---
 configure.ac                                       |  2 +
 tests/utils/Makefile.am                            |  2 +-
 tests/utils/testapp/Makefile.am                    |  2 +
 tests/utils/testapp/gen-ust-events/Makefile.am     | 15 ++++++
 .../utils/testapp/gen-ust-events/gen-ust-events.c  | 58 ++++++++++++++++++++++
 tests/utils/testapp/gen-ust-events/tp.c            | 15 ++++++
 tests/utils/testapp/gen-ust-events/tp.h            | 56 +++++++++++++++++++++
 7 files changed, 149 insertions(+), 1 deletion(-)
 create mode 100644 tests/utils/testapp/Makefile.am
 create mode 100644 tests/utils/testapp/gen-ust-events/Makefile.am
 create mode 100644 tests/utils/testapp/gen-ust-events/gen-ust-events.c
 create mode 100644 tests/utils/testapp/gen-ust-events/tp.c
 create mode 100644 tests/utils/testapp/gen-ust-events/tp.h
configure.ac +2 -0
index 650ae7f..9f14c12 100644
@@ -341,6 +341,8 @@ AC_CONFIG_FILES([
 	tests/unit/Makefile
 	tests/utils/Makefile
 	tests/utils/tap/Makefile
+	tests/utils/testapp/Makefile
+	tests/utils/testapp/gen-ust-events/Makefile
 ])
 
 AC_OUTPUT
tests/utils/Makefile.am +1 -1
index 25c6e04..e0de483 100644
@@ -1,4 +1,4 @@
-SUBDIRS = tap
+SUBDIRS = tap testapp
 
 EXTRA_DIST = utils.sh test_utils.py
 dist_noinst_SCRIPTS = utils.sh test_utils.py
tests/utils/testapp/Makefile.am new file +2 -0
new file mode 100644
index 0000000..8b631ee
@@ -0,0 +1,2 @@
+SUBDIRS = gen-ust-events
+
tests/utils/testapp/gen-ust-events/Makefile.am new file +15 -0
new file mode 100644
index 0000000..1be5835
@@ -0,0 +1,15 @@
+AM_CFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/src -I$(srcdir) -O2 -g
+AM_LDFLAGS =
+
+if LTTNG_TOOLS_BUILD_WITH_LIBDL
+AM_LDFLAGS += -ldl
+endif
+if LTTNG_TOOLS_BUILD_WITH_LIBC_DL
+AM_LDFLAGS += -lc
+endif
+
+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
+endif
tests/utils/testapp/gen-ust-events/gen-ust-events.c new file +58 -0
new file mode 100644
index 0000000..edf40ee
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) - 2012 David Goulet <[email protected]>
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; version 2.1 of the License.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
+ */
+
+#include <arpa/inet.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#define TRACEPOINT_DEFINE
+#include "tp.h"
+
+int main(int argc, char **argv)
+{
+	int i, netint;
+	long values[] = { 1, 2, 3 };
+	char text[10] = "test";
+	double dbl = 2.0;
+	float flt = 2222.0;
+	unsigned int nr_iter = 100;
+	useconds_t nr_usec = 0;
+
+	if (argc >= 2) {
+		nr_iter = atoi(argv[1]);
+	}
+
+	if (argc == 3) {
+		/* By default, don't wait unless user specifies. */
+		nr_usec = atoi(argv[2]);
+	}
+
+	for (i = 0; i < nr_iter; i++) {
+		netint = htonl(i);
+		tracepoint(tp, tptest, i, netint, values, text, strlen(text),
+			   dbl, flt);
+		usleep(nr_usec);
+	}
+
+	return 0;
+}
tests/utils/testapp/gen-ust-events/tp.c new file +15 -0
new file mode 100644
index 0000000..a09561d
@@ -0,0 +1,15 @@
+/*
+ * Copyright (c) - 2012 David Goulet <[email protected]>
+ *
+ * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED OR
+ * IMPLIED. ANY USE IS AT YOUR OWN RISK.
+ *
+ * Permission is hereby granted to use or copy this program for any purpose,
+ * provided the above notices are retained on all copies.  Permission to modify
+ * the code and to distribute modified code is granted, provided the above
+ * notices are retained, and a notice that the code was modified is included
+ * with the above copyright notice.
+ */
+
+#define TRACEPOINT_CREATE_PROBES
+#include "tp.h"
tests/utils/testapp/gen-ust-events/tp.h new file +56 -0
new file mode 100644
index 0000000..6ffbc32
@@ -0,0 +1,56 @@
+#undef TRACEPOINT_PROVIDER
+#define TRACEPOINT_PROVIDER tp
+
+#if !defined(_TRACEPOINT_TP_H) || defined(TRACEPOINT_HEADER_MULTI_READ)
+#define _TRACEPOINT_TP_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Copyright (C) 2011  Mathieu Desnoyers <[email protected]>
+ *
+ * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
+ * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
+ *
+ * Permission is hereby granted to use or copy this program
+ * for any purpose,  provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ */
+
+#include <lttng/tracepoint.h>
+
+TRACEPOINT_EVENT(tp, tptest,
+	TP_ARGS(int, anint, int, netint, long *, values,
+		char *, text, size_t, textlen,
+		double, doublearg, float, floatarg),
+	TP_FIELDS(
+		ctf_integer(int, intfield, anint)
+		ctf_integer_hex(int, intfield2, anint)
+		ctf_integer(long, longfield, anint)
+		ctf_integer_network(int, netintfield, netint)
+		ctf_integer_network_hex(int, netintfieldhex, netint)
+		ctf_array(long, arrfield1, values, 3)
+		ctf_array_text(char, arrfield2, text, 10)
+		ctf_sequence(char, seqfield1, text, size_t, textlen)
+		ctf_sequence_text(char, seqfield2, text, size_t, textlen)
+		ctf_string(stringfield, text)
+		ctf_float(float, floatfield, floatarg)
+		ctf_float(double, doublefield, doublearg)
+	)
+)
+
+#endif /* _TRACEPOINT_TP_H */
+
+#undef TRACEPOINT_INCLUDE_FILE
+#define TRACEPOINT_INCLUDE_FILE ./tp.h
+
+/* This part must be outside ifdef protection */
+#include <lttng/tracepoint-event.h>
+
+#ifdef __cplusplus
+}
+#endif