All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 9/9] perf test: new testsuite: perf trace tests
@ 2015-12-07 18:53 Michael Petlan
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Petlan @ 2015-12-07 18:53 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, Jiri Olsa; +Cc: linux-perf-users

This commit adds tests for perf trace tools.

Signed-off-by: Michael Petlan <mpetlan@redhat.com>
---
 tools/perf/testsuite/base_trace/cleanup.sh         |  19 +++
 tools/perf/testsuite/base_trace/settings.sh        |  10 ++
 tools/perf/testsuite/base_trace/setup.sh           |  16 +++
 .../perf/testsuite/base_trace/stderr-whitelist.txt |   1 +
 tools/perf/testsuite/base_trace/test_basic.sh      | 129 +++++++++++++++++++++
 tools/perf/testsuite/base_trace/test_record.sh     |  45 +++++++
 6 files changed, 220 insertions(+)
 create mode 100755 tools/perf/testsuite/base_trace/cleanup.sh
 create mode 100644 tools/perf/testsuite/base_trace/settings.sh
 create mode 100755 tools/perf/testsuite/base_trace/setup.sh
 create mode 100644 tools/perf/testsuite/base_trace/stderr-whitelist.txt
 create mode 100755 tools/perf/testsuite/base_trace/test_basic.sh
 create mode 100755 tools/perf/testsuite/base_trace/test_record.sh

diff --git a/tools/perf/testsuite/base_trace/cleanup.sh b/tools/perf/testsuite/base_trace/cleanup.sh
new file mode 100755
index 0000000..8a16968
--- /dev/null
+++ b/tools/perf/testsuite/base_trace/cleanup.sh
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+#
+#	cleanup.sh of perf_trace test
+#	Author: Michael Petlan <mpetlan@redhat.com>
+#
+#	Description:
+#		FIXME
+#
+#
+
+. ../common/init.sh
+. ./settings.sh
+
+find . -name \*.log | xargs -r rm
+find . -name \*.err | xargs -r rm
+rm -f perf.data*
+print_overall_results 0
+exit 0
diff --git a/tools/perf/testsuite/base_trace/settings.sh b/tools/perf/testsuite/base_trace/settings.sh
new file mode 100644
index 0000000..730ac74
--- /dev/null
+++ b/tools/perf/testsuite/base_trace/settings.sh
@@ -0,0 +1,10 @@
+#
+#	settings.sh of perf_trace test
+#	Author: Michael Petlan <mpetlan@redhat.com>
+#
+#	Description:
+#		FIXME
+#
+#
+
+export TEST_NAME="perf_trace"
diff --git a/tools/perf/testsuite/base_trace/setup.sh b/tools/perf/testsuite/base_trace/setup.sh
new file mode 100755
index 0000000..8d5ccaa
--- /dev/null
+++ b/tools/perf/testsuite/base_trace/setup.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+#
+#	setup.sh of SKELETON test
+#	Author: Michael Petlan <mpetlan@redhat.com>
+#
+#	Description:
+#		FIXME
+#
+#
+
+. ../common/init.sh
+. ./settings.sh
+
+print_overall_results 0
+exit 0
diff --git a/tools/perf/testsuite/base_trace/stderr-whitelist.txt b/tools/perf/testsuite/base_trace/stderr-whitelist.txt
new file mode 100644
index 0000000..d59b483
--- /dev/null
+++ b/tools/perf/testsuite/base_trace/stderr-whitelist.txt
@@ -0,0 +1 @@
+no symbols found in .*, maybe install a debug package
diff --git a/tools/perf/testsuite/base_trace/test_basic.sh b/tools/perf/testsuite/base_trace/test_basic.sh
new file mode 100755
index 0000000..e80f124
--- /dev/null
+++ b/tools/perf/testsuite/base_trace/test_basic.sh
@@ -0,0 +1,129 @@
+#!/bin/bash
+
+#
+#	test_basic of perf_trace test
+#	Author: Michael Petlan <mpetlan@redhat.com>
+#
+#	Description:
+#
+#		This test tests basic functionality of perf trace command.
+#
+#
+
+# include working environment
+. ../common/init.sh
+. ./settings.sh
+
+THIS_TEST_NAME=`basename $0 .sh`
+TEST_RESULT=0
+
+#### help message
+
+if [ "$PARAM_GENERAL_HELP_TEXT_CHECK" = "y" ]; then
+	# test that a help message is shown and looks reasonable
+	$CMD_PERF trace --help > basic_helpmsg.log
+	PERF_EXIT_CODE=$?
+
+	../common/check_all_patterns_found.pl "PERF-TRACE" "NAME" "SYNOPSIS" "DESCRIPTION" "OPTIONS" "PAGEFAULTS" "EXAMPLES" "SEE ALSO" "NOTES" < basic_helpmsg.log
+	CHECK_EXIT_CODE=$?
+	../common/check_all_patterns_found.pl "all-cpus" "expr" "output" "pid" "tid" "uid" "verbose" "cpu" "duration" "summary" "sched" "event" < basic_helpmsg.log
+	(( CHECK_EXIT_CODE += $? ))
+	../common/check_all_patterns_found.pl "perf trace record" < basic_helpmsg.log
+	(( CHECK_EXIT_CODE += $? ))
+
+	print_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "help message"
+	(( TEST_RESULT += $? ))
+else
+	print_testcase_skipped "help message"
+fi
+
+#### basic execution
+
+# test that perf trace is working
+$CMD_PERF trace $CMD_QUICK_SLEEP 2> basic_basic.log
+PERF_EXIT_CODE=$?
+
+../common/check_all_lines_matched.pl "$RE_LINE_TRACE" < basic_basic.log
+CHECK_EXIT_CODE=$?
+
+print_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "basic execution"
+(( TEST_RESULT += $? ))
+
+
+### duration threshold
+
+# '--duration X' should show only syscalls that take longer than X ms
+$CMD_PERF trace --duration 80 $CMD_BASIC_SLEEP 2> basic_duration.log
+PERF_EXIT_CODE=$?
+
+REGEX_SLEEP_SYSCALL_ONLY="^\s*$RE_NUMBER\s*\(\s*$RE_NUMBER\s*ms\s*\):\s*$RE_PROCESS_PID\s+\w*sleep\(.*\)\s+=\s+\-?$RE_NUMBER|$RE_NUMBER_HEX.*$"
+../common/check_all_lines_matched.pl "$REGEX_SLEEP_SYSCALL_ONLY" < basic_duration.log
+CHECK_EXIT_CODE=$?
+
+print_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "duration threshold"
+(( TEST_RESULT += $? ))
+
+
+### systemwide
+
+# '-a' should trace system-wide from all CPUs
+$CMD_PERF trace -o basic_systemwide.log -a &
+PERF_PID=$!
+$CMD_LONGER_SLEEP
+kill -SIGINT $PERF_PID
+wait $PERF_PID
+PERF_EXIT_CODE=$?
+
+../common/check_all_lines_matched.pl "$RE_LINE_TRACE" < basic_systemwide.log
+CHECK_EXIT_CODE=$?
+
+print_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "systemwide"
+(( TEST_RESULT += $? ))
+
+
+### full timestamp
+
+# '-T' should print the full timestamp instead of the relative one
+$CMD_PERF trace -T -- $CMD_QUICK_SLEEP 2> basic_full_timestamp.log
+PERF_EXIT_CODE=$?
+
+../common/check_all_lines_matched.pl "$RE_LINE_TRACE" "\d{8,}\." < basic_full_timestamp.log
+CHECK_EXIT_CODE=$?
+
+print_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "full timestamp"
+(( TEST_RESULT += $? ))
+
+
+### summary
+
+# '-s' should print out a summary table
+$CMD_PERF trace -s -- $CMD_QUICK_SLEEP 2> basic_summary.log
+PERF_EXIT_CODE=$?
+
+../common/check_all_patterns_found.pl "$RE_LINE_EMPTY" "$RE_LINE_TRACE_SUMMARY_HEADER" "$RE_LINE_TRACE_SUMMARY_CONTENT" < basic_summary.log
+CHECK_EXIT_CODE=$?
+
+print_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "summary"
+(( TEST_RESULT += $? ))
+
+
+### attach process
+
+# perf-trace should be able to attach an existing process by '-p PID'
+$CMD_BASIC_SLEEP &
+$CMD_PERF trace -p $! -o basic_attach.log
+PERF_EXIT_CODE=$?
+
+../common/check_all_lines_matched.pl "$RE_LINE_TRACE" < basic_attach.log
+CHECK_EXIT_CODE=$?
+# perf should know the syscall even if perf attached during it (sleep)
+../common/check_all_patterns_found.pl "sleep" "close" "exit" < basic_attach.log
+(( CHECK_EXIT_CODE += $? ))
+
+print_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "attach process"
+(( TEST_RESULT += $? ))
+
+
+# print overall resutls
+print_overall_results "$TEST_RESULT"
+exit $?
diff --git a/tools/perf/testsuite/base_trace/test_record.sh b/tools/perf/testsuite/base_trace/test_record.sh
new file mode 100755
index 0000000..dab3471
--- /dev/null
+++ b/tools/perf/testsuite/base_trace/test_record.sh
@@ -0,0 +1,45 @@
+#!/bin/bash
+
+#
+#	test_record of perf_trace test
+#	Author: Michael Petlan <mpetlan@redhat.com>
+#
+#	Description:
+#
+#		This test tests the sampling mode of perf-trace.
+#
+#
+
+# include working environment
+. ../common/init.sh
+. ./settings.sh
+
+THIS_TEST_NAME=`basename $0 .sh`
+TEST_RESULT=0
+
+
+#### basic execution
+
+# test that perf trace record is working
+$CMD_PERF trace record $CMD_QUICK_SLEEP 2> record_basic_record.log
+PERF_EXIT_CODE=$?
+$CMD_PERF report --stdio > record_basic_report.log 2> record_basic_report.err
+(( PERF_EXIT_CODE += $? ))
+
+# check the perf record output
+../common/check_all_lines_matched.pl "$RE_LINE_RECORD1" "$RE_LINE_RECORD2" < record_basic_record.log
+CHECK_EXIT_CODE=$?
+# check the perf report output
+../common/check_all_lines_matched.pl "$RE_LINE_REPORT_CONTENT" "$RE_LINE_EMPTY" "$RE_LINE_COMMENT" < record_basic_report.log
+(( CHECK_EXIT_CODE += $? ))
+# check that the perf report stderr is empty
+../common/check_errors_whitelisted.pl "stderr-whitelist.txt" < record_basic_report.err
+(( CHECK_EXIT_CODE += $? ))
+
+print_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "basic execution - record"
+(( TEST_RESULT += $? ))
+
+
+# print overall resutls
+print_overall_results "$TEST_RESULT"
+exit $?

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH 9/9] perf test: new testsuite: perf trace tests
       [not found] <cover.1458134357.git.mpetlan@redhat.com>
@ 2016-03-16 13:57 ` Michael Petlan
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Petlan @ 2016-03-16 13:57 UTC (permalink / raw)
  To: linux-perf-users; +Cc: acme, jolsa

This commit adds tests for perf trace tool.

Signed-off-by: Michael Petlan <mpetlan@redhat.com>
---
  tools/perf/testsuite/base_trace/cleanup.sh         |  24 ++++
  tools/perf/testsuite/base_trace/settings.sh        |  25 ++++
  tools/perf/testsuite/base_trace/setup.sh           |  16 +++
  .../perf/testsuite/base_trace/stderr-whitelist.txt |   1 +
  tools/perf/testsuite/base_trace/test_basic.sh      | 131 +++++++++++++++++++++
  tools/perf/testsuite/base_trace/test_overhead.sh   |  51 ++++++++
  tools/perf/testsuite/base_trace/test_record.sh     |  45 +++++++
  7 files changed, 293 insertions(+)
  create mode 100755 tools/perf/testsuite/base_trace/cleanup.sh
  create mode 100644 tools/perf/testsuite/base_trace/settings.sh
  create mode 100755 tools/perf/testsuite/base_trace/setup.sh
  create mode 100644 tools/perf/testsuite/base_trace/stderr-whitelist.txt
  create mode 100755 tools/perf/testsuite/base_trace/test_basic.sh
  create mode 100755 tools/perf/testsuite/base_trace/test_overhead.sh
  create mode 100755 tools/perf/testsuite/base_trace/test_record.sh

diff --git a/tools/perf/testsuite/base_trace/cleanup.sh b/tools/perf/testsuite/base_trace/cleanup.sh
new file mode 100755
index 0000000..03984f4
--- /dev/null
+++ b/tools/perf/testsuite/base_trace/cleanup.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+#
+#	cleanup.sh of perf_trace test
+#	Author: Michael Petlan <mpetlan@redhat.com>
+#
+#	Description:
+#		FIXME
+#
+#
+
+. ../common/init.sh
+. ./settings.sh
+
+if [ -n "$PERFSUITE_RUN_DIR" ]; then
+	print_overall_skipped
+	exit 0
+fi
+
+find . -name \*.log | xargs -r rm
+find . -name \*.err | xargs -r rm
+rm -f perf.data*
+print_overall_results 0
+exit 0
diff --git a/tools/perf/testsuite/base_trace/settings.sh b/tools/perf/testsuite/base_trace/settings.sh
new file mode 100644
index 0000000..38153fe
--- /dev/null
+++ b/tools/perf/testsuite/base_trace/settings.sh
@@ -0,0 +1,25 @@
+#
+#	settings.sh of perf_trace test
+#	Author: Michael Petlan <mpetlan@redhat.com>
+#
+#	Description:
+#		FIXME
+#
+#
+
+export TEST_NAME="perf_trace"
+
+if [ -n "$PERFSUITE_RUN_DIR" ]; then
+	# when $PERFSUITE_RUN_DIR is set to something, all the logs and temp files will be placed there
+	# --> the $PERFSUITE_RUN_DIR/perf_something/examples and $PERFSUITE_RUN_DIR/perf_something/logs
+	#     dirs will be used for that
+	export PERFSUITE_RUN_DIR=`readlink -f $PERFSUITE_RUN_DIR`
+	export CURRENT_TEST_DIR="$PERFSUITE_RUN_DIR/$TEST_NAME"
+	test -d "$CURRENT_TEST_DIR" || mkdir -p "$CURRENT_TEST_DIR"
+	export LOGS_DIR="$PERFSUITE_RUN_DIR/$TEST_NAME/logs"
+	test -d "$LOGS_DIR" || mkdir -p "$LOGS_DIR"
+else
+	# when $PERFSUITE_RUN_DIR is not set, logs will be placed here
+	export CURRENT_TEST_DIR="."
+	export LOGS_DIR="."
+fi
diff --git a/tools/perf/testsuite/base_trace/setup.sh b/tools/perf/testsuite/base_trace/setup.sh
new file mode 100755
index 0000000..8d5ccaa
--- /dev/null
+++ b/tools/perf/testsuite/base_trace/setup.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+#
+#	setup.sh of SKELETON test
+#	Author: Michael Petlan <mpetlan@redhat.com>
+#
+#	Description:
+#		FIXME
+#
+#
+
+. ../common/init.sh
+. ./settings.sh
+
+print_overall_results 0
+exit 0
diff --git a/tools/perf/testsuite/base_trace/stderr-whitelist.txt b/tools/perf/testsuite/base_trace/stderr-whitelist.txt
new file mode 100644
index 0000000..d59b483
--- /dev/null
+++ b/tools/perf/testsuite/base_trace/stderr-whitelist.txt
@@ -0,0 +1 @@
+no symbols found in .*, maybe install a debug package
diff --git a/tools/perf/testsuite/base_trace/test_basic.sh b/tools/perf/testsuite/base_trace/test_basic.sh
new file mode 100755
index 0000000..91a3593
--- /dev/null
+++ b/tools/perf/testsuite/base_trace/test_basic.sh
@@ -0,0 +1,131 @@
+#!/bin/bash
+
+#
+#	test_basic of perf_trace test
+#	Author: Michael Petlan <mpetlan@redhat.com>
+#
+#	Description:
+#
+#		This test tests basic functionality of perf trace command.
+#
+#
+
+# include working environment
+. ../common/init.sh
+. ./settings.sh
+
+THIS_TEST_NAME=`basename $0 .sh`
+TEST_RESULT=0
+
+#### help message
+
+if [ "$PARAM_GENERAL_HELP_TEXT_CHECK" = "y" ]; then
+	# test that a help message is shown and looks reasonable
+	$CMD_PERF trace --help > $LOGS_DIR/basic_helpmsg.log
+	PERF_EXIT_CODE=$?
+
+	../common/check_all_patterns_found.pl "PERF-TRACE" "NAME" "SYNOPSIS" "DESCRIPTION" "OPTIONS" "PAGEFAULTS" "EXAMPLES" "SEE ALSO" "NOTES" < $LOGS_DIR/basic_helpmsg.log
+	CHECK_EXIT_CODE=$?
+	../common/check_all_patterns_found.pl "all-cpus" "expr" "output" "pid" "tid" "uid" "verbose" "cpu" "duration" "summary" "sched" "event" < $LOGS_DIR/basic_helpmsg.log
+	(( CHECK_EXIT_CODE += $? ))
+	../common/check_all_patterns_found.pl "perf trace record" < $LOGS_DIR/basic_helpmsg.log
+	(( CHECK_EXIT_CODE += $? ))
+
+	print_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "help message"
+	(( TEST_RESULT += $? ))
+else
+	print_testcase_skipped "help message"
+fi
+
+#### basic execution
+
+# test that perf trace is working
+$CMD_PERF trace $CMD_QUICK_SLEEP 2> $LOGS_DIR/basic_basic.log
+PERF_EXIT_CODE=$?
+
+../common/check_all_lines_matched.pl "$RE_LINE_TRACE" < $LOGS_DIR/basic_basic.log
+CHECK_EXIT_CODE=$?
+../common/check_all_patterns_found.pl "$RE_LINE_TRACE" < $LOGS_DIR/basic_basic.log
+(( CHECK_EXIT_CODE += $? ))
+
+print_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "basic execution"
+(( TEST_RESULT += $? ))
+
+
+### duration threshold
+
+# '--duration X' should show only syscalls that take longer than X ms
+$CMD_PERF trace --duration 80 $CMD_BASIC_SLEEP 2> $LOGS_DIR/basic_duration.log
+PERF_EXIT_CODE=$?
+
+REGEX_SLEEP_SYSCALL_ONLY="^\s*$RE_NUMBER\s*\(\s*$RE_NUMBER\s*ms\s*\):\s*$RE_PROCESS_PID\s+\w*sleep\(.*\)\s+=\s+\-?$RE_NUMBER|$RE_NUMBER_HEX.*$"
+../common/check_all_lines_matched.pl "$REGEX_SLEEP_SYSCALL_ONLY" < $LOGS_DIR/basic_duration.log
+CHECK_EXIT_CODE=$?
+
+print_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "duration threshold"
+(( TEST_RESULT += $? ))
+
+
+### systemwide
+
+# '-a' should trace system-wide from all CPUs
+$CMD_PERF trace -o $LOGS_DIR/basic_systemwide.log -a &
+PERF_PID=$!
+$CMD_LONGER_SLEEP
+kill -SIGINT $PERF_PID
+wait $PERF_PID
+PERF_EXIT_CODE=$?
+
+../common/check_all_lines_matched.pl "$RE_LINE_TRACE" < $LOGS_DIR/basic_systemwide.log
+CHECK_EXIT_CODE=$?
+
+print_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "systemwide"
+(( TEST_RESULT += $? ))
+
+
+### full timestamp
+
+# '-T' should print the full timestamp instead of the relative one
+$CMD_PERF trace -T -- $CMD_QUICK_SLEEP 2> $LOGS_DIR/basic_full_timestamp.log
+PERF_EXIT_CODE=$?
+
+../common/check_all_lines_matched.pl "$RE_LINE_TRACE" "\d{5,}\." < $LOGS_DIR/basic_full_timestamp.log
+CHECK_EXIT_CODE=$?
+
+print_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "full timestamp"
+(( TEST_RESULT += $? ))
+
+
+### summary
+
+# '-s' should print out a summary table
+$CMD_PERF trace -s -- $CMD_QUICK_SLEEP 2> $LOGS_DIR/basic_summary.log
+PERF_EXIT_CODE=$?
+
+../common/check_all_patterns_found.pl "$RE_LINE_EMPTY" "$RE_LINE_TRACE_SUMMARY_HEADER" "$RE_LINE_TRACE_SUMMARY_CONTENT" < $LOGS_DIR/basic_summary.log
+CHECK_EXIT_CODE=$?
+
+print_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "summary"
+(( TEST_RESULT += $? ))
+
+
+### attach process
+
+# perf-trace should be able to attach an existing process by '-p PID'
+$CMD_BASIC_SLEEP &
+$CMD_PERF trace -p $! -o $LOGS_DIR/basic_attach.log
+PERF_EXIT_CODE=$?
+
+../common/check_all_lines_matched.pl "$RE_LINE_TRACE" < $LOGS_DIR/basic_attach.log
+CHECK_EXIT_CODE=$?
+# perf should know the syscall even if perf attached during it (sleep)
+../common/check_all_patterns_found.pl "sleep" "close" "exit" < $LOGS_DIR/basic_attach.log
+(( CHECK_EXIT_CODE += $? ))
+
+print_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "attach process"
+(( TEST_RESULT += $? ))
+
+
+# print overall resutls
+print_overall_results "$TEST_RESULT"
+exit $?
diff --git a/tools/perf/testsuite/base_trace/test_overhead.sh b/tools/perf/testsuite/base_trace/test_overhead.sh
new file mode 100755
index 0000000..023aaff
--- /dev/null
+++ b/tools/perf/testsuite/base_trace/test_overhead.sh
@@ -0,0 +1,51 @@
+#!/bin/bash
+
+#
+#	test_overhead of perf_trace test
+#	Author: Michael Petlan <mpetlan@redhat.com>
+#
+#	Description:
+#
+#		This test tries to trace a heavier load.
+#
+#
+
+# include working environment
+. ../common/init.sh
+. ./settings.sh
+
+THIS_TEST_NAME=`basename $0 .sh`
+TEST_RESULT=0
+
+
+# skip if not enabled
+if [ "$PARAM_TRACE_OVERLOAD" = "n" ]; then
+	print_overall_skipped
+	exit 0
+fi
+
+
+#### systemwide
+
+# system-wide tracing limited by sleep time should finish
+$CMD_PERF trace -o $LOGS_DIR/overhead_systemwide.log -a -- $CMD_LONGER_SLEEP &
+PERF_PID=$!
+$CMD_LONGER_SLEEP
+$CMD_LONGER_SLEEP
+! kill -SIGINT $PERF_PID &> overhead_systemwide_kill.log
+wait $PERF_PID
+PERF_EXIT_CODE=$?
+
+../common/check_all_lines_matched.pl "$RE_LINE_TRACE" < $LOGS_DIR/overhead_systemwide.log
+CHECK_EXIT_CODE=$?
+
+../common/check_all_patterns_found.pl "No such process" < overhead_systemwide_kill.log
+(( CHECK_EXIT_CODE += $? ))
+
+print_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "systemwide"
+(( TEST_RESULT += $? ))
+
+
+# print overall resutls
+print_overall_results "$TEST_RESULT"
+exit $?
diff --git a/tools/perf/testsuite/base_trace/test_record.sh b/tools/perf/testsuite/base_trace/test_record.sh
new file mode 100755
index 0000000..672f1ea
--- /dev/null
+++ b/tools/perf/testsuite/base_trace/test_record.sh
@@ -0,0 +1,45 @@
+#!/bin/bash
+
+#
+#	test_record of perf_trace test
+#	Author: Michael Petlan <mpetlan@redhat.com>
+#
+#	Description:
+#
+#		This test tests the sampling mode of perf-trace.
+#
+#
+
+# include working environment
+. ../common/init.sh
+. ./settings.sh
+
+THIS_TEST_NAME=`basename $0 .sh`
+TEST_RESULT=0
+
+
+#### basic execution
+
+# test that perf trace record is working
+$CMD_PERF trace record -o $CURRENT_TEST_DIR/perf.data $CMD_QUICK_SLEEP 2> $LOGS_DIR/record_basic_record.log
+PERF_EXIT_CODE=$?
+$CMD_PERF report --stdio -i $CURRENT_TEST_DIR/perf.data > $LOGS_DIR/record_basic_report.log 2> $LOGS_DIR/record_basic_report.err
+(( PERF_EXIT_CODE += $? ))
+
+# check the perf record output
+../common/check_all_lines_matched.pl "$RE_LINE_RECORD1" "$RE_LINE_RECORD2" < $LOGS_DIR/record_basic_record.log
+CHECK_EXIT_CODE=$?
+# check the perf report output
+../common/check_all_lines_matched.pl "$RE_LINE_REPORT_CONTENT" "$RE_LINE_EMPTY" "$RE_LINE_COMMENT" < $LOGS_DIR/record_basic_report.log
+(( CHECK_EXIT_CODE += $? ))
+# check that the perf report stderr is empty
+../common/check_errors_whitelisted.pl "stderr-whitelist.txt" < $LOGS_DIR/record_basic_report.err
+(( CHECK_EXIT_CODE += $? ))
+
+print_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "basic execution - record"
+(( TEST_RESULT += $? ))
+
+
+# print overall resutls
+print_overall_results "$TEST_RESULT"
+exit $?
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-03-16 13:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-07 18:53 [PATCH 9/9] perf test: new testsuite: perf trace tests Michael Petlan
     [not found] <cover.1458134357.git.mpetlan@redhat.com>
2016-03-16 13:57 ` Michael Petlan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.