All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 4/9] perf test: new testsuite: perf buildid-list tests
@ 2015-12-07 18:53 Michael Petlan
  2015-12-15 12:04 ` Jiri Olsa
  0 siblings, 1 reply; 3+ 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 buildid-list tool. It is a placeholder
for future perf buildid-cache tests as well.

Signed-off-by: Michael Petlan <mpetlan@redhat.com>
---
 tools/perf/testsuite/base_buildid/cleanup.sh       | 20 ++++++
 tools/perf/testsuite/base_buildid/settings.sh      | 23 +++++++
 tools/perf/testsuite/base_buildid/setup.sh         | 26 +++++++
 .../testsuite/base_buildid/test_buildid-list.sh    | 79 ++++++++++++++++++++++
 4 files changed, 148 insertions(+)
 create mode 100755 tools/perf/testsuite/base_buildid/cleanup.sh
 create mode 100644 tools/perf/testsuite/base_buildid/settings.sh
 create mode 100755 tools/perf/testsuite/base_buildid/setup.sh
 create mode 100755 tools/perf/testsuite/base_buildid/test_buildid-list.sh

diff --git a/tools/perf/testsuite/base_buildid/cleanup.sh b/tools/perf/testsuite/base_buildid/cleanup.sh
new file mode 100755
index 0000000..e8ca6a3
--- /dev/null
+++ b/tools/perf/testsuite/base_buildid/cleanup.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+#
+#	cleanup.sh of perf buildid test
+#	Author: Michael Petlan <mpetlan@redhat.com>
+#
+#
+
+# include working environment
+. ../common/init.sh
+. ./settings.sh
+
+THIS_TEST_NAME=`basename $0 .sh`
+
+find . -name \*.log | xargs -r rm
+find . -name \*.err | xargs -r rm
+test -e perf.data && rm -rf perf.data
+
+print_results 0 0 "clean-up logs"
+exit $?
diff --git a/tools/perf/testsuite/base_buildid/settings.sh b/tools/perf/testsuite/base_buildid/settings.sh
new file mode 100644
index 0000000..87052dc
--- /dev/null
+++ b/tools/perf/testsuite/base_buildid/settings.sh
@@ -0,0 +1,23 @@
+#
+#	settings.sh of perf buildid test
+#	Author: Michael Petlan <mpetlan@redhat.com>
+#
+#	Description:
+#		FIXME
+#
+#
+
+export TEST_NAME="perf_buildid-cache"
+export MY_ARCH=`arch`
+export MY_HOSTNAME=`hostname`
+export MY_KERNEL_VERSION=`uname -r`
+export MY_CPUS_ONLINE=`nproc`
+export MY_CPUS_AVAILABLE=`cat /proc/cpuinfo | grep processor | wc -l`
+
+# FIXME look for the cache dir to /etc/perfconfig
+export BUILDIDDIR="$HOME/.debug"
+
+clear_buildid_cache()
+{
+	rm -rf $BUILDIDDIR/*
+}
diff --git a/tools/perf/testsuite/base_buildid/setup.sh b/tools/perf/testsuite/base_buildid/setup.sh
new file mode 100755
index 0000000..314f68f
--- /dev/null
+++ b/tools/perf/testsuite/base_buildid/setup.sh
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+#
+#	setup.sh of perf buildid test
+#	Author: Michael Petlan <mpetlan@redhat.com>
+#
+#	Description:
+#
+#		FIXME - maybe the setup is not necessary
+#
+#
+
+# include working environment
+. ../common/init.sh
+. ./settings.sh
+
+THIS_TEST_NAME=`basename $0 .sh`
+
+# clear the cache
+clear_buildid_cache
+
+# record some perf.data
+$CMD_PERF record -a -- $CMD_LONGER_SLEEP &> setup.log
+
+print_overall_results $?
+exit $?
diff --git a/tools/perf/testsuite/base_buildid/test_buildid-list.sh b/tools/perf/testsuite/base_buildid/test_buildid-list.sh
new file mode 100755
index 0000000..a4acbec
--- /dev/null
+++ b/tools/perf/testsuite/base_buildid/test_buildid-list.sh
@@ -0,0 +1,79 @@
+#!/bin/bash
+
+#
+#	test_buildid-list of perf buildid test
+#	Author: Michael Petlan <mpetlan@redhat.com>
+#
+#	Description:
+#
+#		This test checks whether the buildids captured by perf record
+#	and listed by perf buildid-list from the perf.data file matches
+#	reality. Some other checks of the tool are done too.
+#
+
+# include working environment
+. ../common/init.sh
+. ./settings.sh
+
+THIS_TEST_NAME=`basename $0 .sh`
+TEST_RESULT=0
+
+test -s perf.data || ./setup.sh
+
+
+### help message
+
+if [ "$PARAM_GENERAL_HELP_TEXT_CHECK" = "y" ]; then
+	# test that a help message is shown and looks reasonable
+	$CMD_PERF buildid-list --help > list_helpmsg.log
+	PERF_EXIT_CODE=$?
+
+	../common/check_all_patterns_found.pl "PERF-BUILDID-LIST" "NAME" "SYNOPSIS" "DESCRIPTION" "OPTIONS" "SEE ALSO" < list_helpmsg.log
+	CHECK_EXIT_CODE=$?
+	../common/check_all_patterns_found.pl "perf\-buildid\-list \- List the buildids in a perf\.data file" < list_helpmsg.log
+	(( CHECK_EXIT_CODE += $? ))
+
+	print_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "help message"
+	(( TEST_RESULT += $? ))
+else
+	print_testcase_skipped "help message"
+fi
+
+### buildids check
+
+# test that perf list is even working
+$CMD_PERF buildid-list > list_basic.log 2> list_basic.err
+PERF_EXIT_CODE=$?
+
+# output sanity checks
+REGEX_LINE_BASIC="\w{40}\s+$RE_PATH"
+../common/check_all_lines_matched.pl "$REGEX_LINE_BASIC" < list_basic.log
+CHECK_EXIT_CODE=$?
+test ! -s basic_basic.err
+(( CHECK_EXIT_CODE += $? ))
+
+# output semantics check
+../common/check_buildids_vs_files.pl < list_basic.log
+(( CHECK_EXIT_CODE += $? ))
+
+print_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "buildids check"
+(( TEST_RESULT += $? ))
+
+
+### kernel buildid
+
+# the --kernel option should print the buildid of the running kernel
+$CMD_PERF buildid-list --kernel > list_kernel.log
+PERF_EXIT_CODE=$?
+
+# check whether the buildid is printed
+../common/check_all_lines_matched.pl "\w{40}" < list_kernel.log
+(( CHECK_EXIT_CODE += $? ))
+
+print_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "kernel buildid"
+(( TEST_RESULT += $? ))
+
+
+# print overall resutls
+print_overall_results "$TEST_RESULT"
+exit $?

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

* Re: [PATCH 4/9] perf test: new testsuite: perf buildid-list tests
  2015-12-07 18:53 [PATCH 4/9] perf test: new testsuite: perf buildid-list tests Michael Petlan
@ 2015-12-15 12:04 ` Jiri Olsa
  0 siblings, 0 replies; 3+ messages in thread
From: Jiri Olsa @ 2015-12-15 12:04 UTC (permalink / raw)
  To: Michael Petlan; +Cc: Arnaldo Carvalho de Melo, linux-perf-users

On Mon, Dec 07, 2015 at 07:53:18PM +0100, Michael Petlan wrote:

SNIP

> diff --git a/tools/perf/testsuite/base_buildid/settings.sh b/tools/perf/testsuite/base_buildid/settings.sh
> new file mode 100644
> index 0000000..87052dc
> --- /dev/null
> +++ b/tools/perf/testsuite/base_buildid/settings.sh
> @@ -0,0 +1,23 @@
> +#
> +#	settings.sh of perf buildid test
> +#	Author: Michael Petlan <mpetlan@redhat.com>
> +#
> +#	Description:
> +#		FIXME
> +#
> +#
> +
> +export TEST_NAME="perf_buildid-cache"
> +export MY_ARCH=`arch`
> +export MY_HOSTNAME=`hostname`
> +export MY_KERNEL_VERSION=`uname -r`
> +export MY_CPUS_ONLINE=`nproc`
> +export MY_CPUS_AVAILABLE=`cat /proc/cpuinfo | grep processor | wc -l`
> +
> +# FIXME look for the cache dir to /etc/perfconfig
> +export BUILDIDDIR="$HOME/.debug"
> +
> +clear_buildid_cache()
> +{
> +	rm -rf $BUILDIDDIR/*
> +}

I understand it's supposed to run on developers servers,
but cleaning ~/.debug is not a good idea

you could use './perf --buildid-dir DIR' and use
some temporary directory for the buildid cache

thanks,
jirka

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

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

This commit adds tests for perf buildid-list tool. It is a placeholder
for future perf buildid-cache tests as well.

Signed-off-by: Michael Petlan <mpetlan@redhat.com>
---
  tools/perf/testsuite/base_buildid/cleanup.sh       | 23 ++++++
  tools/perf/testsuite/base_buildid/settings.sh      | 45 ++++++++++++
  tools/perf/testsuite/base_buildid/setup.sh         | 26 +++++++
  .../testsuite/base_buildid/test_buildid-list.sh    | 81 ++++++++++++++++++++++
  4 files changed, 175 insertions(+)
  create mode 100755 tools/perf/testsuite/base_buildid/cleanup.sh
  create mode 100644 tools/perf/testsuite/base_buildid/settings.sh
  create mode 100755 tools/perf/testsuite/base_buildid/setup.sh
  create mode 100755 tools/perf/testsuite/base_buildid/test_buildid-list.sh

diff --git a/tools/perf/testsuite/base_buildid/cleanup.sh b/tools/perf/testsuite/base_buildid/cleanup.sh
new file mode 100755
index 0000000..fb90cc3
--- /dev/null
+++ b/tools/perf/testsuite/base_buildid/cleanup.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+#
+#	cleanup.sh of perf buildid test
+#	Author: Michael Petlan <mpetlan@redhat.com>
+#
+#
+
+# include working environment
+. ../common/init.sh
+. ./settings.sh
+
+if [ ! -n "$PERFSUITE_RUN_DIR" ]; then
+	remove_buildid_cache
+	find . -name \*.log | xargs -r rm
+	find . -name \*.err | xargs -r rm
+	test -e perf.data && rm -rf perf.data
+else
+	mv "$BUILDIDDIR" "$PERFSUITE_RUN_DIR/perf_buildid-cache/"
+fi
+
+print_overall_results 0
+exit $?
diff --git a/tools/perf/testsuite/base_buildid/settings.sh b/tools/perf/testsuite/base_buildid/settings.sh
new file mode 100644
index 0000000..9bc0415
--- /dev/null
+++ b/tools/perf/testsuite/base_buildid/settings.sh
@@ -0,0 +1,45 @@
+#
+#	settings.sh of perf buildid test
+#	Author: Michael Petlan <mpetlan@redhat.com>
+#
+#	Description:
+#		FIXME
+#
+#
+
+export TEST_NAME="perf_buildid-cache"
+export MY_ARCH=`arch`
+export MY_HOSTNAME=`hostname`
+export MY_KERNEL_VERSION=`uname -r`
+export MY_CPUS_ONLINE=`nproc`
+export MY_CPUS_AVAILABLE=`cat /proc/cpuinfo | grep -P "processor\s" | wc -l`
+
+export BUILDIDDIR=${BUILDIDDIR:-"$HOME/.debug-`date +%s`"}
+test -d "$BUILDIDDIR" || mkdir "$BUILDIDDIR"
+
+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
+
+
+clear_buildid_cache()
+{
+	rm -rf $BUILDIDDIR/*
+}
+
+remove_buildid_cache()
+{
+	clear_buildid_cache
+	rmdir $BUILDIDDIR
+}
diff --git a/tools/perf/testsuite/base_buildid/setup.sh b/tools/perf/testsuite/base_buildid/setup.sh
new file mode 100755
index 0000000..e9f6d56
--- /dev/null
+++ b/tools/perf/testsuite/base_buildid/setup.sh
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+#
+#	setup.sh of perf buildid test
+#	Author: Michael Petlan <mpetlan@redhat.com>
+#
+#	Description:
+#
+#		FIXME - maybe the setup is not necessary
+#
+#
+
+# include working environment
+. ../common/init.sh
+. ./settings.sh
+
+THIS_TEST_NAME=`basename $0 .sh`
+
+# clear the cache
+clear_buildid_cache
+
+# record some perf.data
+$CMD_PERF record -o $CURRENT_TEST_DIR/perf.data -a -- $CMD_LONGER_SLEEP &> $LOGS_DIR/setup.log
+
+print_overall_results $?
+exit $?
diff --git a/tools/perf/testsuite/base_buildid/test_buildid-list.sh b/tools/perf/testsuite/base_buildid/test_buildid-list.sh
new file mode 100755
index 0000000..4b40500
--- /dev/null
+++ b/tools/perf/testsuite/base_buildid/test_buildid-list.sh
@@ -0,0 +1,81 @@
+#!/bin/bash
+
+#
+#	test_buildid-list of perf buildid test
+#	Author: Michael Petlan <mpetlan@redhat.com>
+#
+#	Description:
+#
+#		This test checks whether the buildids captured by perf record
+#	and listed by perf buildid-list from the perf.data file matches
+#	reality. Some other checks of the tool are done too.
+#
+
+# include working environment
+. ../common/init.sh
+. ./settings.sh
+
+THIS_TEST_NAME=`basename $0 .sh`
+TEST_RESULT=0
+
+test -s perf.data || ./setup.sh
+
+
+### help message
+
+if [ "$PARAM_GENERAL_HELP_TEXT_CHECK" = "y" ]; then
+	# test that a help message is shown and looks reasonable
+	$CMD_PERF buildid-list --help > $LOGS_DIR/list_helpmsg.log
+	PERF_EXIT_CODE=$?
+
+	../common/check_all_patterns_found.pl "PERF-BUILDID-LIST" "NAME" "SYNOPSIS" "DESCRIPTION" "OPTIONS" "SEE ALSO" < $LOGS_DIR/list_helpmsg.log
+	CHECK_EXIT_CODE=$?
+	../common/check_all_patterns_found.pl "perf\-buildid\-list \- List the buildids in a perf\.data file" < $LOGS_DIR/list_helpmsg.log
+	(( CHECK_EXIT_CODE += $? ))
+
+	print_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "help message"
+	(( TEST_RESULT += $? ))
+else
+	print_testcase_skipped "help message"
+fi
+
+
+### buildids check
+
+# test that perf list is even working
+$CMD_PERF buildid-list -i $CURRENT_TEST_DIR/perf.data > $LOGS_DIR/list_buildids.log 2> $LOGS_DIR/list_buildids.err
+PERF_EXIT_CODE=$?
+
+# output sanity checks
+REGEX_LINE_BASIC="\w{40}\s+$RE_PATH"
+REGEX_LINE_KALLSYMS="\w{40}\s+\[kernel\.kallsyms\]"
+../common/check_all_lines_matched.pl "$REGEX_LINE_BASIC" "$REGEX_LINE_KALLSYMS" < $LOGS_DIR/list_buildids.log
+CHECK_EXIT_CODE=$?
+test ! -s $LOGS_DIR/basic_buildids.err
+(( CHECK_EXIT_CODE += $? ))
+
+# output semantics check
+../common/check_buildids_vs_files.pl < $LOGS_DIR/list_buildids.log
+(( CHECK_EXIT_CODE += $? ))
+
+print_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "buildids check"
+(( TEST_RESULT += $? ))
+
+
+### kernel buildid
+
+# the --kernel option should print the buildid of the running kernel
+$CMD_PERF buildid-list --kernel > $LOGS_DIR/list_kernel.log
+PERF_EXIT_CODE=$?
+
+# check whether the buildid is printed
+../common/check_all_lines_matched.pl "\w{40}" < $LOGS_DIR/list_kernel.log
+CHECK_EXIT_CODE=$?
+
+print_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "kernel buildid"
+(( TEST_RESULT += $? ))
+
+
+# print overall resutls
+print_overall_results "$TEST_RESULT"
+exit $?
-- 
1.8.3.1

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

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

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-07 18:53 [PATCH 4/9] perf test: new testsuite: perf buildid-list tests Michael Petlan
2015-12-15 12:04 ` Jiri Olsa
     [not found] <cover.1458134357.git.mpetlan@redhat.com>
2016-03-16 13:55 ` 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.