X-Git-Url: http://git.efficios.com/?p=lttng-tools.git;a=blobdiff_plain;f=tests%2Fregression%2Fust%2Fbefore-after%2Ftest_before_after;h=0b2812415568a01adffb34793d324a068d1eddcc;hp=6d45bb5e7f2bfee9c933e93a27e22dd16122915f;hb=bf6ae429bc7bf2fefdce61e48806768dab7567d5;hpb=6cb45b178e9b294bbbdc43a1078abdbee8137711 diff --git a/tests/regression/ust/before-after/test_before_after b/tests/regression/ust/before-after/test_before_after index 6d45bb5e7..0b2812415 100755 --- a/tests/regression/ust/before-after/test_before_after +++ b/tests/regression/ust/before-after/test_before_after @@ -35,50 +35,51 @@ fi # MUST set TESTDIR before calling those functions -test_before_apps() { +function test_before_apps() +{ # BEFORE application is spawned - create_lttng_session $SESSION_NAME $TRACE_PATH + create_lttng_session_ok $SESSION_NAME $TRACE_PATH enable_ust_lttng_event $SESSION_NAME $EVENT_NAME start_lttng_tracing $SESSION_NAME - $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT - ok $? "Start application to trace" + $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT & + wait + ok $? "Traced application stopped." stop_lttng_tracing $SESSION_NAME destroy_lttng_session $SESSION_NAME - trace_matches $EVENT_NAME $NR_ITER $TRACE_PATH + trace_match_only $EVENT_NAME $NR_ITER $TRACE_PATH return $? } -test_after_apps() { +function test_after_apps() +{ local out + local file_sync_after_first=$(mktemp -u) + local file_sync_before_last=$(mktemp -u) - $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT & - ok $? "Start application to trace" - - # BEFORE application is spawned - create_lttng_session $SESSION_NAME $TRACE_PATH + create_lttng_session_ok $SESSION_NAME $TRACE_PATH enable_ust_lttng_event $SESSION_NAME $EVENT_NAME + + $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT ${file_sync_after_first} ${file_sync_before_last} & + ok $? "Application started in background." + start_lttng_tracing $SESSION_NAME - # At least hit one event - sleep 2 + touch ${file_sync_before_last} + + wait stop_lttng_tracing $SESSION_NAME destroy_lttng_session $SESSION_NAME - out=$(babeltrace $TRACE_PATH | grep $EVENT_NAME | wc -l) - if [ $out -eq 0 ]; then - fail "Trace validation" - diag "No event(s) found. We are supposed to have at least one." - out=1 - else - pass "Trace validation" - diag "Found $out event(s). Coherent." - out=0 - fi + rm -f ${file_sync_after_first} + rm -f ${file_sync_before_last} + + validate_trace $EVENT_NAME $TRACE_PATH + out=$? return $out } @@ -90,7 +91,7 @@ print_test_banner "$TEST_DESC" start_lttng_sessiond -diag "Start application BEFORE tracing was started" +diag "Start tracing BEFORE application is started" TRACE_PATH=$(mktemp -d) @@ -103,7 +104,7 @@ fi rm -rf $TRACE_PATH -diag "Start application AFTER tracing was started" +diag "Start tracing AFTER application is started" TRACE_PATH=$(mktemp -d)