From 6330cf0f53df0718698575815186b247e0296cfd Mon Sep 17 00:00:00 2001 From: Sveta Smirnova Date: Fri, 26 Jan 2024 18:14:29 +0300 Subject: [PATCH] PR-160 - added support for operf if present, and if CMD_OPCONTROL is not set - Added test case --- t/pt-stalk/pt-stalk.t | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/t/pt-stalk/pt-stalk.t b/t/pt-stalk/pt-stalk.t index 19c4dace..d378d351 100644 --- a/t/pt-stalk/pt-stalk.t +++ b/t/pt-stalk/pt-stalk.t @@ -956,6 +956,39 @@ like( "numastat collection has data" ); +# ########################################################################### +# Test if option operf collection works +# ########################################################################### + +# ./bin/pt-stalk --no-stalk --iterations=1 --sleep=1 --dest=tmp/pt-stalk --collect-oprofile -- --user=msandbox --password=msandbox --port=12345 --host=127.0.0.1 ^C +SKIP: { + my $operf = `which operf`; + chomp $operf; + skip "--collect-oprofile tests require operf" unless -x "$operf"; + + cleanup(); + + $retval = system("$trunk/bin/pt-stalk --no-stalk --run-time 10 --sleep 2 --dest $dest --pid $pid_file --iterations 1 --collect-oprofile -- --defaults-file=$cnf >$log_file 2>&1"); + + PerconaTest::wait_until(sub { !-f $pid_file }); + + $output = `ls $dest`; + + like( + $output, + qr/opreport/, + "operf data collected" + ) or diag($output); + + $output = `cat $dest/*-opreport`; + + like( + $output, + qr/(mysqld)/, + "operf collection has data" + ); +} + # ############################################################################# # Done. # #############################################################################