Bump URCU dependency to 0.14
[lttng-tools.git] / tests / regression / ust / nprocesses / test_nprocesses
1 #!/bin/bash
2 #
3 # Copyright (C) 2012 David Goulet <dgoulet@efficios.com>
4 #
5 # SPDX-License-Identifier: LGPL-2.1-only
6
7 NUM_PROCESS=30
8 TEST_DESC="UST tracer - Generate $NUM_PROCESS process"
9
10 CURDIR=$(dirname $0)/
11 TESTDIR=$CURDIR/../../..
12 NR_ITER=-1 # infinite loop
13 NR_USEC_WAIT=1000000
14 TESTAPP_PATH="$TESTDIR/utils/testapp"
15 TESTAPP_NAME="gen-ust-events"
16 TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME"
17 SESSION_NAME="ust-nprocesses"
18 EVENT_NAME="tp:tptest"
19 TEST_WAIT_SEC=5
20 NUM_TESTS=9
21 APPS_PID=
22
23 source $TESTDIR/utils/utils.sh
24
25 if [ ! -x "$TESTAPP_BIN" ]; then
26 BAIL_OUT "No UST $TESTAPP_BIN binary detected."
27 fi
28
29 # MUST set TESTDIR before calling those functions
30
31 plan_tests $NUM_TESTS
32
33 print_test_banner "$TEST_DESC"
34
35 start_lttng_sessiond
36
37 # Start tests. Each is an infinite tracing loop.
38
39 file_sync_after_first=$(mktemp --tmpdir -u tmp.test_nprocesses_sync_after_first.XXXXXX)
40 file_sync_before_last=$(mktemp --tmpdir -u tmp.test_nprocesses_sync_before_last.XXXXXX)
41
42 diag "Starting $NUM_PROCESS test applications"
43 for i in `seq 1 $NUM_PROCESS`
44 do
45 $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT \
46 --sync-after-first-event ${file_sync_after_first} \
47 --sync-before-last-event ${file_sync_before_last} >/dev/null 2>&1 &
48 APPS_PID="${APPS_PID} ${!}"
49 done
50
51 diag "Waiting for applications to be registered to sessiond"
52
53 reg_app_count=0
54 while [ $reg_app_count -ne $NUM_PROCESS ]; do
55 listing=$($TESTDIR/../src/bin/lttng/$LTTNG_BIN list -u)
56 reg_app_count=$(echo -n $listing | sed "s#$TESTAPP_BIN#$TESTAPP_BIN\n#g" | grep "$TESTAPP_BIN" | wc -l)
57 done
58
59 pass "All applications are registered to sessiond"
60
61 TRACE_PATH=$(mktemp --tmpdir -d tmp.test_nprocesses_trace_path.XXXXXX)
62
63 create_lttng_session_ok $SESSION_NAME $TRACE_PATH
64
65 enable_ust_lttng_event_ok $SESSION_NAME $EVENT_NAME
66 start_lttng_tracing_ok $SESSION_NAME
67
68 touch ${file_sync_before_last}
69
70 # We don't validate whether the applications have traced here, rather
71 # just that they registered to sessiond (above).
72
73 stop_lttng_tracing_ok $SESSION_NAME
74 destroy_lttng_session_ok $SESSION_NAME
75
76 #TODO: add trace validation.
77
78 rm -rf $TRACE_PATH
79
80 diag "Stopping all spawned applications"
81 for p in ${APPS_PID}; do
82 kill ${p}
83 wait ${p} 2>/dev/null
84 done
85 APPS_PID=
86 pass "Stopped all spawned applications"
87
88 rm -f ${file_sync_after_first}
89 rm -f ${file_sync_before_last}
90
91 stop_lttng_sessiond
This page took 0.04485 seconds and 4 git commands to generate.