perf test: Adding an entry for the perftool-testsuite
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/9 perf test: Adding an entry for the perftool-testsuite
In order to be able to run the bash/subcommand-based testsuite directly from perf test a new perf-test entry has been created for it.
The driver (suite.c) runs all the tests that it finds in the testsuite
directory: tools/perf/testsuite/ (rather ./testsuite as it expects it
it being run from the perf's directory).
In case the testsuite is not found, the testcase is skipped. If this is not the desired behaviour, some packaging will be needed.
Usage:
./perf test suite
or
./perf test suite -v
./perf test suite -vv
(for the verbose output)
--- tools/perf/tests/Build | 1 + tools/perf/tests/builtin-test.c | 4 ++ tools/perf/tests/suite.c | 150 ++++++++++++++++++++++++++++++++++++++++ tools/perf/tests/suite.h | 30 ++++++++ tools/perf/tests/tests.h | 1 + 5 files changed, 186 insertions(+) create mode 100644 tools/perf/tests/suite.c create mode 100644 tools/perf/tests/suite.h
tools/perf/tests/Build +1 -0
@@ -37,6 +37,7 @@ perf-y += topology.o perf-y += cpumap.o perf-y += stat.o perf-y += event_update.o +perf-y += suite.o $(OUTPUT)tests/llvm-src-base.c: tests/bpf-script-example.c tests/Build $(call rule_mkdir)
tools/perf/tests/builtin-test.c +4 -0
@@ -204,6 +204,10 @@ static struct test generic_tests[] = { .func = test__event_update, }, { + .desc = "Testsuite", + .func = test__suite, + }, + { .func = NULL, }, };
tools/perf/tests/suite.c new file +150 -0
150 lines not on this page · raw message
tools/perf/tests/suite.h new file +30 -0
@@ -0,0 +1,30 @@ +#ifndef PERF_TEST_SUITE_H +#define PERF_TEST_SUITE_H + +#include <linux/compiler.h> +#include "tests.h" +#include <stdlib.h> +#include <stdio.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <dirent.h> +#include <unistd.h> +#include <string.h> + + +/* verbosity */ +extern int verbose; + +/* runs a shell script */ +int _run_shell (const char *script); + +/* checks for existence of a file and runs it */ +int run_shell (const char *script); + +/* if a script is available, run it, otherwise ignore it */ +int try_shell (const char *script); + +/* runs a group of tests ("base_something", ...) */ +int run_group (const char *path); + +#endif
tools/perf/tests/tests.h +1 -0
@@ -85,6 +85,7 @@ int test__synthesize_stat_config(int subtest);int test__synthesize_stat (int subtest);int test__synthesize_stat_round (int subtest);int test__event_update (int subtest); +int test__suite (int subtest);#if defined(__arm__) || defined(__aarch64__)#ifdef HAVE_DWARF_UNWIND_SUPPORT
Signature · 1 line
1.8.3.1
On Wed, Mar 16, 2016 at 02:50:59PM +0100, Michael Petlan wrote:
SNIP
tools/perf/tests/suite.c line 14
Quoted 12 lines
tools/perf/tests/suite.c new file +12
-0+#define TESTSUITE_ROOT "./testsuite/" + +/* globals */ +int fatal_occured =0 ; +char *cwd; + + +/* runs a shell script */ +int _run_shell (const char *script) +{ +int ret; +char *cmd =malloc (strlen (script) +3 *sizeof (char ));
please check the return value
jirka
Quoted 4 lines · Jiri Olsa
On Wed, Mar 16, 2016 at 02:50:59PM +0100, Michael Petlan wrote:
SNIP
Quoted 14 lines
Review
Quoted 12 lines
(quoted diff) +12
-0+#define TESTSUITE_ROOT "./testsuite/" + +/* globals */ +int fatal_occured = 0; +char *cwd; + + +/* runs a shell script */ +int _run_shell(const char *script) +{ + int ret; + char *cmd = malloc(strlen(script) + 3 * sizeof(char));please check the return value
Fixed in the attached patch.
To the other notes:
Quoted 1 line
'cwd' does not need to be global
Fixed in the attached patch.
Quoted 2 lines
you propage all the error all the way through, so what's the point of having extra global
fatal_occuredvariable?
It is reserved for distinguishing between a regular failures in the tests (failures of perf in the ideal state) and the failures of the infrastructure (cannot allocate memory for the *cmd string above).
if(failures || fatal_occurred)
test_status = TEST_FAIL;I know that this idiom merges that into TEST_FAIL, but we still are able to make differences here. The suite is pretty complex, I think there should be a way to notice infrastructure failures.
Quoted 1 line
also I think you could erase the ==== quoted lines
I think it is more human-eye-friendly when the sections are separated by one more \n and the header. I moved that into the (verbose >= 2) mode. Once there might be twice or thrice more lines and sections as well. When reviewing the results of the suite, I like the headers.
Quoted 1 line
is there a point to run tests if the setup fails?
There is a reason, since not all of the tests of the 'group' (base_something/test_*.sh) need the setup.
Thanks for the notes. The remaining two I have to check separately. All the failures that I usually encounter have their stderrs cut out in -v, so the testsuite logs look still nice. I have to check the failure you posted.
Regarding to the C-c, yes, there are commands running in background, we need that e.g. for perf stat -p testing. However I don't think that that is why it cannot be C-c'd. I have to look at it more.
Michael
Quoted 7 lines
jirka
--
To unsubscribe from this list: send the line "unsubscribe linux-perf-users" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
tools/perf/tests/suite.c +13 -8
@@ -3,8 +3,7 @@#define TESTSUITE_ROOT "./testsuite/"/* globals */ -int fatal_occured =0 ; -char *cwd; +int fatal_occurred =0 ;/* runs a shell script */
@@ -12,12 +11,17 @@ int _run_shell(const char *script) {int ret;char *cmd =malloc (strlen (script) +3 *sizeof (char )); +if (cmd ==NULL ) + { +fprintf (stderr,"FATAL: Could not allocate memory.\n" ); +return 1 ; + }strcpy (cmd,"./" );strcpy (cmd +2 , script); ret =system (cmd);if (ret ==-1 ) {fprintf (stderr,"FATAL: Could not run %s" , cmd); - fatal_occured++; + fatal_occurred++;return 1 ; }return ret;
@@ -30,12 +34,12 @@ int run_shell(const char *script)struct stat sb;if (stat (script, &sb) ==-1 ) { - fatal_occured++; + fatal_occurred++;return 1 ; }if (! (sb.st_mode & (S_IXUSR |S_IFREG ))) { - fatal_occured++; + fatal_occurred++;return 1 ; }
@@ -68,7 +72,7 @@ int run_group(const char *path)int failures =0 ; ret =chdir (path); -if (verbose) +if (verbose >1 )printf ("======== %s ========\n" , path);/* try to run setup */
@@ -102,13 +106,14 @@ int run_group(const char *path)int test__suite (int subtest__maybe_unused ) {DIR *dp; +char *cwd;struct dirent *ep;int failures =0 ;int ret;int test_status =TEST_OK ;char verbosity_str[2 ];int _verbose = (verbose >9 )?9 : verbose; -char tempdir_template[24 ], _tempdir_template; +char tempdir_template[24 ], *_tempdir_template;/* set verbosity according to perf-test command line switches */ snprintf (verbosity_str,2 ,"%i" , _verbose);
@@ -143,7 +148,7 @@ int test__suite(int subtest __maybe_unused) ret = ret;free (cwd); -if (failures || fatal_occured) +if (failures || fatal_occurred) test_status =TEST_FAIL ;return test_status;
On Wed, Mar 16, 2016 at 02:50:59PM +0100, Michael Petlan wrote:
SNIP
tools/perf/tests/suite.c line 7
Quoted 13 lines
tools/perf/tests/suite.c new file +7
-0@@ -0,0 +1,150 @@ +#include "suite.h" + +#define TESTSUITE_ROOT "./testsuite/" + +/* globals */ +int fatal_occured =0 ; +char *cwd;
'cwd' does not need to be global
jirka
On Wed, Mar 16, 2016 at 02:50:59PM +0100, Michael Petlan wrote:
SNIP
Quoted 8 lines
tools/perf/tests/suite.c new file +8
-0+ dp =opendir ("./" ); +if (dp !=NULL ) { + +while ((ep =readdir (dp))) { +if (strncmp (ep->d_name,"base_" ,5 )) +continue ; + failures +=run_group (ep->d_name); + }
tools/perf/tests/suite.c line 146
Quoted 10 lines
tools/perf/tests/suite.c new file +10
-0+closedir (dp); + } +else + test_status =TEST_SKIP ; + + ret =chdir (cwd); + ret = ret; +free (cwd); + +if (failures || fatal_occured)
you propage all the error all the way through, so what's the point of having extra global fatal_occured variable?
thanks,
jirka
Quoted 13 lines · Michael Petlan
In order to be able to run the bash/subcommand-based testsuite directly from perf test a new perf-test entry has been created for it.
The driver (
suite.c) runs all the tests that it finds in the testsuite
directory:tools/perf/testsuite/(rather ./testsuite as it expects it
it being run from the perf's directory).In case the testsuite is not found, the testcase is skipped. If this is not the desired behaviour, some packaging will be needed.
Usage:
./perf test suite
Quoted 7 lines
or
./perf test suite -v
./perf test suite -vv(for the verbose output)
Signed-off-by Michael Petlan <[email protected]>
got following compile error:
CC tests/suite.otests/suite.c: In function ‘test__suite’:tests/suite.c:119:20: error: assignment makes integer from pointer without a cast [-Werror=int-conversion]
_tempdir_template = mkdtemp(tempdir_template);
^
tests/suite.c:120:30: error: passing argument 2 of ‘setenv’ makes pointer from integer without a cast [-Werror=int-conversion]
setenv("PERFSUITE_RUN_DIR", _tempdir_template, 1);
^In file included from tests/suite.h:6:0,
from tests/suite.c:1:/usr/include/stdlib.h:584:12: note: expected ‘const char *’ but argument is of type ‘char’
extern int setenv (const char *__name, const char *__value, int __replace)
^
cc1: all warnings being treated as errors
moving on with attached patch
thanks,
jirka
---
tools/perf/tests/suite.c +2 -1
@@ -108,7 +108,8 @@ int test__suite(int subtest __maybe_unused)int test_status =TEST_OK ;char verbosity_str[2 ];int _verbose = (verbose >9 )?9 : verbose; -char tempdir_template[24 ], _tempdir_template; +char tempdir_template[24 ]; +char *_tempdir_template;/* set verbosity according to perf-test command line switches */ snprintf (verbosity_str,2 ,"%i" , _verbose);
Quoted 15 lines · Jiri Olsa
got following compile error:
CC
tests/suite.otests/suite.c: In function ‘test__suite’:tests/suite.c:119:20: error: assignment makes integer from pointer without a cast [-Werror=int-conversion]_tempdir_template = mkdtemp(tempdir_template); ^ tests/suite.c:120:30: error: passing argument 2 of ‘setenv’ makes pointer from integer without a cast [-Werror=int-conversion] setenv("PERFSUITE_RUN_DIR", _tempdir_template, 1); ^In file included from
tests/suite.h:6:0,
fromtests/suite.c:1:/usr/include/stdlib.h:584:12: note: expected ‘const char *’ but argument is of type ‘char’ extern int setenv (const char*__name, const char*__value, int__replace)
Quoted 5 lines
^cc1: all warnings being treated as errors
moving on with attached patch
I noticed this error too and that's why I sent the mail with the following $subj:
"[PATCH 1/9] perf test: Adding an entry for the perftool-testsuite - CORRECT"
A stupid mistake, of course it must be a pointer.
Michael
Quoted 25 lines
thanks,
jirka---
tools/perf/tests/suite.c +2
-2@@ -108,7 +108,8 @@ int test__suite(int subtest __maybe_unused)int test_status =TEST_OK ;char verbosity_str[2 ];int _verbose = (verbose >9 )?9 : verbose; -char tempdir_template[24 ], _tempdir_template; +char tempdir_template[24 ]; +char *_tempdir_template;/* set verbosity according to perf-test command line switches */ snprintf (verbosity_str,2 ,"%i" , _verbose); --To unsubscribe from this list: send the line "unsubscribe linux-perf-users" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
On Wed, Mar 16, 2016 at 02:50:59PM +0100, Michael Petlan wrote:
SNIP
Quoted 24 lines
tools/perf/tests/suite.c new file +24
-0+/* runs a group of tests ("base_something", ...) */ +int run_group (const char *path) +{ +DIR *dp; +struct dirent *ep; +int ret; + +int failures =0 ; + ret =chdir (path); + +if (verbose) +printf ("======== %s ========\n" , path); + +/* try to run setup */ + failures +=try_shell ("setup.sh" ); + +/* scan the dir and run tests */ + dp =opendir ("./" ); +if (dp !=NULL ) { +while ((ep =readdir (dp))) { +if (strncmp (ep->d_name,"test_" ,5 )) +continue ; + failures +=run_shell (ep->d_name); + }
tools/perf/tests/suite.c line 94
Quoted 10 lines
tools/perf/tests/suite.c new file +10
-0+closedir (dp); + } +else +perror ("Cannot open inner dir." ); + +/* try to do clean-up */ +try_shell ("cleanup.sh" ); + + ret =chdir (".." ); + ret = ret;
hm? ;-)
jirka
Quoted 8 lines · Jiri Olsa
On Wed, Mar 16, 2016 at 02:50:59PM +0100, Michael Petlan wrote:
SNIP
Review
Quoted 2 lines
(quoted diff) +2
-0+ ret = chdir(".."); + ret = ret;hm? ;-)
That must be there, otherwise the compiler would complain about unused variable 'ret'. When removing 'ret' at all, the compiler complains about ignoring return value of 'chdir()'.
Well, ok, there could be something like:
if(!ret)
{
fprintf("FATAL: Cannot cd to ..\n");
return 1;
}Do you think it is worth of being there instead?
Quoted 7 lines
jirka
--
To unsubscribe from this list: send the line "unsubscribe linux-perf-users" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 14 lines · Michael Petlan
Quoted 8 lines · Jiri Olsa
On Wed, Mar 16, 2016 at 02:50:59PM +0100, Michael Petlan wrote:
SNIP
Review
Quoted 2 lines
(quoted diff) +2
-0+ ret = chdir(".."); + ret = ret;hm? ;-)
That must be there, otherwise the compiler would complain about unused variable 'ret'. When removing 'ret' at all, the compiler complains about ignoring return value of '
chdir()'.
Quoted 7 lines
Well, ok, there could be something like:
if(!ret)
{ fprintf("FATAL: Cannot cd to ..\n"); return 1; }
I dont see a point of having the ret variable at all then..
jirka
On Wed, Mar 16, 2016 at 02:50:59PM +0100, Michael Petlan wrote:
SNIP
Quoted 5 lines
tools/perf/tests/suite.c new file +5
-0+/* runs a group of tests ("base_something", ...) */ +int run_group (const char *path) +{ +DIR *dp; +struct dirent *ep;
tools/perf/tests/suite.c line 75
Quoted 10 lines
tools/perf/tests/suite.c new file +10
-0+int ret; + +int failures =0 ; + ret =chdir (path); + +if (verbose) +printf ("======== %s ========\n" , path); + +/* try to run setup */ + failures +=try_shell ("setup.sh" );
is there a point to run tests if the setup fails?
jirka
PATCH 2/9 perf test: adding new testsuite: common files
In reply to a message not in the archiveA new testsuite based on black-box testing of perf's subcommands is located in tools/perf/testsuite. It can be run from the perf's dir by "perf test suite".
The suite aims on testing the subcommands and their sanity from the user's point of view. It is designed to be easily extensible when a new feature needs to be covered.
This commit adds the base part of the testsuite (config, checkers):
common/
init.sh
- to be sourced within the test scripts
patterns.sh
- contains common regexp patterns
settings.sh
- sourced from init.sh
- contains various constants and settings
parametrization.sh
- sourced from settings.sh
- like a config file for enablement and disablement of some features, regulation of depth, etc.
check_*.pl
- various scripts for checking output
- might be extended by some more advanced checking tools and techniques
--- .../testsuite/common/check_all_lines_matched.pl | 38 +++++++ .../testsuite/common/check_all_patterns_found.pl | 33 ++++++ .../testsuite/common/check_any_pattern_found.pl | 14 +++ .../testsuite/common/check_buildids_vs_files.pl | 31 ++++++ .../testsuite/common/check_errors_whitelisted.pl | 50 +++++++++ .../testsuite/common/check_exact_pattern_order.pl | 27 +++++ .../testsuite/common/check_kallsyms_vs_probes.pl | 61 +++++++++++ .../testsuite/common/check_no_patterns_found.pl | 33 ++++++ tools/perf/testsuite/common/init.sh | 67 ++++++++++++ tools/perf/testsuite/common/parametrization.sh | 39 +++++++ tools/perf/testsuite/common/patterns.sh | 119 +++++++++++++++++++++ tools/perf/testsuite/common/settings.sh | 57 ++++++++++ 12 files changed, 569 insertions(+) create mode 100755 tools/perf/testsuite/common/check_all_lines_matched.pl create mode 100755 tools/perf/testsuite/common/check_all_patterns_found.pl create mode 100755 tools/perf/testsuite/common/check_any_pattern_found.pl create mode 100755 tools/perf/testsuite/common/check_buildids_vs_files.pl create mode 100755 tools/perf/testsuite/common/check_errors_whitelisted.pl create mode 100755 tools/perf/testsuite/common/check_exact_pattern_order.pl create mode 100755 tools/perf/testsuite/common/check_kallsyms_vs_probes.pl create mode 100755 tools/perf/testsuite/common/check_no_patterns_found.pl create mode 100644 tools/perf/testsuite/common/init.sh create mode 100644 tools/perf/testsuite/common/parametrization.sh create mode 100644 tools/perf/testsuite/common/patterns.sh create mode 100644 tools/perf/testsuite/common/settings.sh
tools/perf/testsuite/common/check_all_lines_matched.pl new file +38 -0
@@ -0,0 +1,38 @@ +#!/usr/bin/perl + +@regexps = @ARGV; + +$max_printed_lines = 20; +$max_printed_lines = $ENV{ERROR_MESSAGE_MAX_LINES} if (defined $ENV{ERROR_MESSAGE_MAX_LINES}); + +$quiet = 1; +$quiet = 0 if (defined $ENV{TESTLOG_VERBOSITY} && $ENV{TESTLOG_VERBOSITY} ge 2); + +$passed = 1; +$lines_printed = 0; + +while (<STDIN>) +{ + s/\n//; + + $line_matched = 0; + for $r (@regexps) + { + if (/$r/) + { + $line_matched = 1; + last; + } + } + + unless ($line_matched) + { + if ($lines_printed++ < $max_printed_lines) + { + print "Line did not match any pattern: \"$_\"\n" unless $quiet; + } + $passed = 0; + } +} + +exit ($passed == 0);
tools/perf/testsuite/common/check_all_patterns_found.pl new file +33 -0
@@ -0,0 +1,33 @@ +#!/usr/bin/perl + +@regexps = @ARGV; + +$quiet = 1; +$quiet = 0 if (defined $ENV{TESTLOG_VERBOSITY} && $ENV{TESTLOG_VERBOSITY} ge 2); + +%found = (); +$passed = 1; + +while (<STDIN>) +{ + s/\n//; + + for $r (@regexps) + { + if (/$r/) + { + $found{$r} = 1; # FIXME: maybe add counters -- how many times was the regexp matched + } + } +} + +for $r (@regexps) +{ + unless (exists $found{$r}) + { + print "Regexp not found: \"$r\"\n" unless $quiet; + $passed = 0; + } +} + +exit ($passed == 0);
tools/perf/testsuite/common/check_any_pattern_found.pl new file +14 -0
@@ -0,0 +1,14 @@ +#!/usr/bin/perl + +@regexps = @ARGV; + +while (<STDIN>) +{ + s/\n//; + for $r (@regexps) + { + exit 0 if (/$r/); + } +} + +exit 1;
tools/perf/testsuite/common/check_buildids_vs_files.pl new file +31 -0
@@ -0,0 +1,31 @@ +#!/usr/bin/perl + +$quiet = 1; +$quiet = 0 if (defined $ENV{TESTLOG_VERBOSITY} && $ENV{TESTLOG_VERBOSITY} ge 2); + +$passed = 1; + +while (<STDIN>) +{ + chomp; + ($buildid_from_list, $filepath) = $_ =~ /^(\w{40})\s+((?:\/[\w\+.-]+)+|(?:\[kernel\.kallsyms\]))$/; + if ($filepath =~ /\[kernel\.kallsyms\]/) + { + $CMD_PERF = $ENV{'CMD_PERF'}; + $buildid_from_file = `$CMD_PERF buildid-list -k`; + chomp $buildid_from_file; + } + else + { + $filecmd_output = `file $filepath 2>/dev/null`; + ($buildid_from_file) = $filecmd_output =~ /BuildID\[sha1\]=(\w{40})/; + } + + if ($buildid_from_file ne $buildid_from_list) + { + $passed = 0; + print "$filepath has $buildid_from_file buildid but perf shows $buildid_from_list\n" unless $quiet; + } +} + +exit !($passed);
tools/perf/testsuite/common/check_errors_whitelisted.pl new file +50 -0
50 lines not on this page · raw message
tools/perf/testsuite/common/check_exact_pattern_order.pl new file +27 -0
@@ -0,0 +1,27 @@ +#!/usr/bin/perl + +@regexps = @ARGV; + +$quiet = 1; +$quiet = 0 if (defined $ENV{TESTLOG_VERBOSITY} && $ENV{TESTLOG_VERBOSITY} ge 2); + +$passed = 1; +$r = shift @regexps; + +while (<STDIN>) +{ + s/\n//; + + if (/$r/) + { + $r = shift @regexps; + } +} + +if (defined $r) +{ + print "Pattern not found in the proper order: $r\n" unless $quiet; + exit 1; +} + +exit 0;
tools/perf/testsuite/common/check_kallsyms_vs_probes.pl new file +61 -0
61 lines not on this page · raw message
tools/perf/testsuite/common/check_no_patterns_found.pl new file +33 -0
@@ -0,0 +1,33 @@ +#!/usr/bin/perl + +@regexps = @ARGV; + +$quiet = 1; +$quiet = 0 if (defined $ENV{TESTLOG_VERBOSITY} && $ENV{TESTLOG_VERBOSITY} ge 2); + +%found = (); +$passed = 1; + +while (<STDIN>) +{ + s/\n//; + + for $r (@regexps) + { + if (/$r/) + { + $found{$r} = 1; + } + } +} + +for $r (@regexps) +{ + if (exists $found{$r}) + { + print "Regexp found: \"$r\"\n" unless $quiet; + $passed = 0; + } +} + +exit ($passed == 0);
tools/perf/testsuite/common/init.sh new file +67 -0
67 lines not on this page · raw message
tools/perf/testsuite/common/parametrization.sh new file +39 -0
@@ -0,0 +1,39 @@ +# +# parametrization.sh +# Author: Michael Petlan <[email protected]> +# +# Description: +# +# This file configures the testcases how deeply they should +# look at things. The parametrization allows you to use the suite +# for both smoke testing and deeper testing. +# + +#### general + +# If set, the '--help' outputs of the commands will be checked. +# Since the '--help' option calls a manpage and manpages are not +# always generated, you may skip the man-page checks. +export PARAM_GENERAL_HELP_TEXT_CHECK=${PARAM_GENERAL_HELP_TEXT_CHECK:-n} + + +#### perf_stat + +# If set, the 24x7 events will be tested on all available cores. +# That might make it 'nproc' times longer. Basically it should be +# enough to run each event on one core only. +# Note: POWER8 only +export PARAM_STAT_24x7_ALL_CORES=${PARAM_STAT_24x7_ALL_CORES:-n} + +# If set, all the tracepoint events will be checked for syntax +# errors in their definition. This testcase may take a long time +# and the checks are not that crucial, so it can be turned off +# when you do not want to deep dive. +export PARAM_STAT_TRACEPOINT_EVENTS_SYNTAX=${PARAM_STAT_TRACEPOINT_EVENTS_SYNTAX:-n} + + +#### perf_trace + +# If set, some heavy load tests are run. That might be not always +# desired behaviour. +export PARAM_TRACE_OVERLOAD=${PARAM_TRACE_OVERLOAD:-y}
tools/perf/testsuite/common/patterns.sh new file +119 -0
119 lines not on this page · raw message
tools/perf/testsuite/common/settings.sh new file +57 -0
57 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH 3/9 perf test: new testsuite: perf annotate tests
In reply to a message not in the archiveThis commit adds tests for perf annotate tool.
The structure of the base_something dirs is the following:
base_something/
settings.sh
- a script mentioned to be sourced within the tests
setup.sh
- if present, necessary for setup of the subset
test_*.sh
- various tests of the subset
cleanup.sh
- a cleanup script that should remove logs, etc.
All the tests should be stand-alone. So if needed, it is enough to cd to the proper base_directory and run the test. Sometimes, setup is needed to be run first.
Example:
cd testsuite/base_annotate
./setup.sh
./test_basic.sh
--- tools/perf/testsuite/base_annotate/cleanup.sh | 24 +++ .../perf/testsuite/base_annotate/examples/Makefile | 16 ++ tools/perf/testsuite/base_annotate/examples/load.c | 24 +++ tools/perf/testsuite/base_annotate/settings.sh | 31 ++++ tools/perf/testsuite/base_annotate/setup.sh | 35 +++++ tools/perf/testsuite/base_annotate/test_basic.sh | 169 +++++++++++++++++++++ 6 files changed, 299 insertions(+) create mode 100755 tools/perf/testsuite/base_annotate/cleanup.sh create mode 100644 tools/perf/testsuite/base_annotate/examples/Makefile create mode 100644 tools/perf/testsuite/base_annotate/examples/load.c create mode 100644 tools/perf/testsuite/base_annotate/settings.sh create mode 100755 tools/perf/testsuite/base_annotate/setup.sh create mode 100755 tools/perf/testsuite/base_annotate/test_basic.sh
tools/perf/testsuite/base_annotate/cleanup.sh new file +24 -0
@@ -0,0 +1,24 @@ +#!/bin/bash + +# +# cleanup.sh of perf annotate test +# Author: Michael Petlan <[email protected]> +# +# + +# include working environment +. ../common/init.sh +. ./settings.sh + +if [ -n "$PERFSUITE_RUN_DIR" ]; then + print_overall_skipped + exit 0 +fi + +make -s -C examples clean +find . -name \*.log | xargs -r rm +find . -name \*.err | xargs -r rm +rm -f perf.data* + +print_overall_results 0 +exit $?
tools/perf/testsuite/base_annotate/examples/Makefile new file +16 -0
@@ -0,0 +1,16 @@ +CC=gcc +CFLAGS=-g -O0 + +SRCS = $(wildcard *.c) +PROGS = $(patsubst %.c,%,$(SRCS)) + +all: $(PROGS) +ifneq "$(MAKE_TARGET_DIR)x" 'x' + mv $(PROGS) $(MAKE_TARGET_DIR)/ +endif + +%: %.c + $(CC) $(CFLAGS) -o $@ $< + +clean: + rm -f $(PROGS)
tools/perf/testsuite/base_annotate/examples/load.c new file +24 -0
@@ -0,0 +1,24 @@ +#include <stdio.h> +#include <stdlib.h> + + +int main (int argc,char *argv[]) +{ +long from, i, j =20L ; + +if (argc >1 ) + from =atol (argv[1 ]); +else + from =20L ; + +for (i =1L ; j; ++i) + { +for (j = from; j >0L ; --j) +if (i % j) +break ; + } + +printf ("%ld\n" , --i); + +return 0 ; +}
tools/perf/testsuite/base_annotate/settings.sh new file +31 -0
@@ -0,0 +1,31 @@ +# +# settings.sh of perf_annotate test +# Author: Michael Petlan <[email protected]> +# +# Description: +# FIXME +# +# + +export TEST_NAME="perf_annotate" +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` + +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" + export MAKE_TARGET_DIR="$CURRENT_TEST_DIR/examples" + test -d "$MAKE_TARGET_DIR" || mkdir -p "$MAKE_TARGET_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
tools/perf/testsuite/base_annotate/setup.sh new file +35 -0
@@ -0,0 +1,35 @@ +#!/bin/bash + +# +# setup.sh of perf annotate test +# Author: Michael Petlan <[email protected]> +# +# Description: +# +# FIXME - build C program +# +# + +# include working environment +. ../common/init.sh +. ./settings.sh + +THIS_TEST_NAME=`basename $0 .sh` + +make -s -C examples +print_results $? 0 "building the example code" +TEST_RESULT=$? + +# record some data +$CMD_PERF record -o $CURRENT_TEST_DIR/perf.data $CURRENT_TEST_DIR/examples/load > /dev/null 2> $LOGS_DIR/setup_record.log +PERF_EXIT_CODE=$? + +# check the perf record output +../common/check_all_lines_matched.pl "$RE_LINE_RECORD1" "$RE_LINE_RECORD2" < $LOGS_DIR/setup_record.log +CHECK_EXIT_CODE=$? + +print_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "record data" +(( TEST_RESULT += $? )) + +print_overall_results $TEST_RESULT +exit $?
tools/perf/testsuite/base_annotate/test_basic.sh new file +169 -0
169 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH 4/9 perf test: new testsuite: perf buildid-list tests
In reply to a message not in the archiveThis commit adds tests for perf buildid-list tool. It is a placeholder for future perf buildid-cache tests as well.
--- 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
tools/perf/testsuite/base_buildid/cleanup.sh new file +23 -0
@@ -0,0 +1,23 @@ +#!/bin/bash + +# +# cleanup.sh of perf buildid test +# Author: Michael Petlan <[email protected]> +# +# + +# 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 $?
tools/perf/testsuite/base_buildid/settings.sh new file +45 -0
45 lines not on this page · raw message
tools/perf/testsuite/base_buildid/setup.sh new file +26 -0
@@ -0,0 +1,26 @@ +#!/bin/bash + +# +# setup.sh of perf buildid test +# Author: Michael Petlan <[email protected]> +# +# 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 $?
tools/perf/testsuite/base_buildid/test_buildid-list.sh new file +81 -0
81 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH 5/9 perf test: new testsuite: perf list tests
In reply to a message not in the archiveThis commit adds tests for perf list tool.
--- tools/perf/testsuite/base_list/cleanup.sh | 22 ++++++ tools/perf/testsuite/base_list/settings.sh | 30 ++++++++ tools/perf/testsuite/base_list/setup.sh | 20 ++++++ tools/perf/testsuite/base_list/test_basic.sh | 101 +++++++++++++++++++++++++++ 4 files changed, 173 insertions(+) create mode 100755 tools/perf/testsuite/base_list/cleanup.sh create mode 100644 tools/perf/testsuite/base_list/settings.sh create mode 100755 tools/perf/testsuite/base_list/setup.sh create mode 100755 tools/perf/testsuite/base_list/test_basic.sh
tools/perf/testsuite/base_list/cleanup.sh new file +22 -0
@@ -0,0 +1,22 @@ +#!/bin/bash + +# +# cleanup.sh of perf list test +# Author: Michael Petlan <[email protected]> +# +# + +# include working environment +. ../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 + +print_overal_results 0 +exit $?
tools/perf/testsuite/base_list/settings.sh new file +30 -0
@@ -0,0 +1,30 @@ +# +# settings.sh of perf_list test +# Author: Michael Petlan <[email protected]> +# +# Description: +# FIXME +# +# + +export TEST_NAME="perf_list" +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` + +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
tools/perf/testsuite/base_list/setup.sh new file +20 -0
@@ -0,0 +1,20 @@ +#!/bin/bash + +# +# setup.sh of perf list test +# Author: Michael Petlan <[email protected]> +# +# Description: +# +# FIXME - maybe the setup is not necessary +# +# + +# include working environment +. ../common/init.sh +. ./settings.sh + +THIS_TEST_NAME=`basename $0 .sh` + +print_overall_results 0 +exit $?
tools/perf/testsuite/base_list/test_basic.sh new file +101 -0
101 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH 6/9 perf test: new testsuite: perf probe tests
In reply to a message not in the archiveThis commit adds tests for perf probe tool. Some of the tests are based on Masami Hiramatsu's perf-probe tests.
--- tools/perf/testsuite/base_probe/cleanup.sh | 22 ++ tools/perf/testsuite/base_probe/examples/Makefile | 16 ++ .../perf/testsuite/base_probe/examples/advanced.c | 40 ++++ .../testsuite/base_probe/examples/exact_counts.c | 35 ++++ tools/perf/testsuite/base_probe/examples/test.c | 35 ++++ tools/perf/testsuite/base_probe/settings.sh | 58 ++++++ tools/perf/testsuite/base_probe/setup.sh | 23 +++ .../base_probe/test_adding_blacklisted.sh | 63 ++++++ .../testsuite/base_probe/test_adding_kernel.sh | 229 +++++++++++++++++++++ tools/perf/testsuite/base_probe/test_advanced.sh | 124 +++++++++++ tools/perf/testsuite/base_probe/test_basic.sh | 79 +++++++ .../perf/testsuite/base_probe/test_exact_counts.sh | 106 ++++++++++ .../testsuite/base_probe/test_invalid_options.sh | 80 +++++++ .../testsuite/base_probe/test_line_semantics.sh | 56 +++++ tools/perf/testsuite/base_probe/test_listing.sh | 154 ++++++++++++++ .../perf/testsuite/base_probe/test_probe_syntax.sh | 119 +++++++++++ 16 files changed, 1239 insertions(+) create mode 100755 tools/perf/testsuite/base_probe/cleanup.sh create mode 100644 tools/perf/testsuite/base_probe/examples/Makefile create mode 100644 tools/perf/testsuite/base_probe/examples/advanced.c create mode 100644 tools/perf/testsuite/base_probe/examples/exact_counts.c create mode 100644 tools/perf/testsuite/base_probe/examples/test.c create mode 100644 tools/perf/testsuite/base_probe/settings.sh create mode 100755 tools/perf/testsuite/base_probe/setup.sh create mode 100755 tools/perf/testsuite/base_probe/test_adding_blacklisted.sh create mode 100755 tools/perf/testsuite/base_probe/test_adding_kernel.sh create mode 100755 tools/perf/testsuite/base_probe/test_advanced.sh create mode 100755 tools/perf/testsuite/base_probe/test_basic.sh create mode 100755 tools/perf/testsuite/base_probe/test_exact_counts.sh create mode 100755 tools/perf/testsuite/base_probe/test_invalid_options.sh create mode 100755 tools/perf/testsuite/base_probe/test_line_semantics.sh create mode 100755 tools/perf/testsuite/base_probe/test_listing.sh create mode 100755 tools/perf/testsuite/base_probe/test_probe_syntax.sh
tools/perf/testsuite/base_probe/cleanup.sh new file +22 -0
@@ -0,0 +1,22 @@ +#!/bin/bash + +# +# cleanup.sh of perf probe test +# Author: Michael Petlan <[email protected]> +# Author: Masami Hiramatsu <[email protected]> +# +# + +# include working environment +. ../common/init.sh +. ./settings.sh + +clear_all_probes +if [ ! -n "$PERFSUITE_RUN_DIR" ]; then + find . -name \*.log | xargs -r rm + find . -name \*.err | xargs -r rm + make -s -C examples clean +fi + +print_overall_results 0 +exit $?
tools/perf/testsuite/base_probe/examples/Makefile new file +16 -0
@@ -0,0 +1,16 @@ +CC=gcc +CFLAGS=-g -O0 + +SRCS = $(wildcard *.c) +PROGS = $(patsubst %.c,%,$(SRCS)) + +all: $(PROGS) +ifneq "$(MAKE_TARGET_DIR)x" 'x' + mv $(PROGS) $(MAKE_TARGET_DIR)/ +endif + +%: %.c + $(CC) $(CFLAGS) -o $@ $< + +clean: + rm -f $(PROGS)
tools/perf/testsuite/base_probe/examples/advanced.c new file +40 -0
@@ -0,0 +1,40 @@ +#include <stdlib.h> +#include <stdio.h> + +static int counter =0 ; + +int incr (void ) +{ +int a; + a = counter++ *2 ; +return a; +} + +int isprime (int a) +{ +int i; +if (a <=1 ) +return 0 ; +for (i =2 ; i <= a /2 ; i++) +if (!(a % i)) +return 0 ; +return 1 ; +} + +int main (int argc,char **argv) +{ +int numbers[] = {2 ,3 ,4 ,5 ,6 ,7 ,13 ,17 ,19 }; +int i; + +for (i =0 ; i <9 ; i++) + { +printf ("%i %s prime\n" , numbers[i], (isprime (numbers[i]))?"is" :"is not" ); + } + +for (i =0 ; i <9 ; i++) + { +printf ("Now the state is %i.\n" ,incr ()); + } + +return 0 ; +}
tools/perf/testsuite/base_probe/examples/exact_counts.c new file +35 -0
@@ -0,0 +1,35 @@ +#include <stdio.h> +#include <stdlib.h> + + +int f_1x (void ) {return 1 ; } +int f_2x (void ) {return 2 ; } +int f_3x (void ) {return 3 ; } +int f_103x (void ) {return 103 ; } +int f_997x (void ) {return 997 ; } +int f_65535x (void ) {return 65535 ; } + +int main (int argc,char **argv) +{ +int i, a; + +for (i =0 ; i <1 ; i++) + a =f_1x (); + +for (i =0 ; i <2 ; i++) + a =f_2x (); + +for (i =0 ; i <3 ; i++) + a =f_3x (); + +for (i =0 ; i <103 ; i++) + a =f_103x (); + +for (i =0 ; i <997 ; i++) + a =f_997x (); + +for (i =0 ; i <65535 ; i++) + a =f_65535x (); + +return 0 ; +}
tools/perf/testsuite/base_probe/examples/test.c new file +35 -0
@@ -0,0 +1,35 @@ +#include <stdio.h> +#include <stdlib.h> + +int some_function_with_a_really_long_name_that_must_be_longer_than_64_bytes (int some_argument_with_a_really_long_name_that_must_be_longer_than_64_bytes) +{ +int some_variable_with_a_really_long_name_that_must_be_longer_than_64_bytes =0 ; +int i; + +for (i =0 ; i <= some_argument_with_a_really_long_name_that_must_be_longer_than_64_bytes; i++) + { + some_variable_with_a_really_long_name_that_must_be_longer_than_64_bytes += i; + } + +return some_variable_with_a_really_long_name_that_must_be_longer_than_64_bytes; +} + +int some_normal_function (int a) +{ +return a * a * a; +} + +int main (int argc,char **argv) +{ +int x =20 , y, z; + +if (argc >1 ) + x =atoi (argv[1 ]); + + y =some_function_with_a_really_long_name_that_must_be_longer_than_64_bytes (x); + z =some_normal_function (x); + +printf ("f1(%i) = %i\nf2(%i) = %i\n" , x, y, x, z); + +return 0 ; +}
tools/perf/testsuite/base_probe/settings.sh new file +58 -0
58 lines not on this page · raw message
tools/perf/testsuite/base_probe/setup.sh new file +23 -0
@@ -0,0 +1,23 @@ +#!/bin/bash + +# +# setup.sh of perf probe test +# Author: Michael Petlan <[email protected]> +# +# Description: +# +# We need to clean-up all the previously added probes +# FIXME +# +# + +# include working environment +. ../common/init.sh +. ./settings.sh + +THIS_TEST_NAME=`basename $0 .sh` + +make -s -C examples + +print_results $? 0 "building examples" +exit $?
tools/perf/testsuite/base_probe/test_adding_blacklisted.sh new file +63 -0
63 lines not on this page · raw message
tools/perf/testsuite/base_probe/test_adding_kernel.sh new file +229 -0
229 lines not on this page · raw message
tools/perf/testsuite/base_probe/test_advanced.sh new file +124 -0
124 lines not on this page · raw message
tools/perf/testsuite/base_probe/test_basic.sh new file +79 -0
79 lines not on this page · raw message
tools/perf/testsuite/base_probe/test_exact_counts.sh new file +106 -0
106 lines not on this page · raw message
tools/perf/testsuite/base_probe/test_invalid_options.sh new file +80 -0
80 lines not on this page · raw message
tools/perf/testsuite/base_probe/test_line_semantics.sh new file +56 -0
56 lines not on this page · raw message
tools/perf/testsuite/base_probe/test_listing.sh new file +154 -0
154 lines not on this page · raw message
tools/perf/testsuite/base_probe/test_probe_syntax.sh new file +119 -0
119 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH 7/9 perf test: new testsuite: perf report tests
In reply to a message not in the archiveThis commit adds tests for perf report tool.
--- tools/perf/testsuite/base_report/cleanup.sh | 24 +++ tools/perf/testsuite/base_report/settings.sh | 30 ++++ tools/perf/testsuite/base_report/setup.sh | 26 ++++ .../testsuite/base_report/stderr-whitelist.txt | 1 + tools/perf/testsuite/base_report/test_basic.sh | 169 +++++++++++++++++++++ 5 files changed, 250 insertions(+) create mode 100755 tools/perf/testsuite/base_report/cleanup.sh create mode 100644 tools/perf/testsuite/base_report/settings.sh create mode 100755 tools/perf/testsuite/base_report/setup.sh create mode 100644 tools/perf/testsuite/base_report/stderr-whitelist.txt create mode 100755 tools/perf/testsuite/base_report/test_basic.sh
tools/perf/testsuite/base_report/cleanup.sh new file +24 -0
@@ -0,0 +1,24 @@ +#!/bin/bash + +# +# cleanup.sh of perf report test +# Author: Michael Petlan <[email protected]> +# +# + +# include working environment +. ../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* +RM_EXIT_CODE=$? + +print_overall_results $RM_EXIT_CODE +exit $?
tools/perf/testsuite/base_report/settings.sh new file +30 -0
@@ -0,0 +1,30 @@ +# +# settings.sh of perf_report test +# Author: Michael Petlan <[email protected]> +# +# Description: +# FIXME +# +# + +export TEST_NAME="perf_report" +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` + +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
tools/perf/testsuite/base_report/setup.sh new file +26 -0
@@ -0,0 +1,26 @@ +#!/bin/bash + +# +# setup.sh of perf report test +# Author: Michael Petlan <[email protected]> +# +# Description: +# +# We need some sample data for perf-report testing +# +# + +# include working environment +. ../common/init.sh +. ./settings.sh + +THIS_TEST_NAME=`basename $0 .sh` + +$CMD_PERF record -asdg -o $CURRENT_TEST_DIR/perf.data -- $CMD_LONGER_SLEEP 2> $LOGS_DIR/setup.log +PERF_EXIT_CODE=$? + +../common/check_all_patterns_found.pl "$RE_LINE_RECORD1" "$RE_LINE_RECORD2" < $LOGS_DIR/setup.log +CHECK_EXIT_CODE=$? + +print_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "prepare the perf.data file" +exit $?
tools/perf/testsuite/base_report/stderr-whitelist.txt new file +1 -0
@@ -0,0 +1 @@ +no symbols found in .*, maybe install a debug package
tools/perf/testsuite/base_report/test_basic.sh new file +169 -0
169 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH 8/9 perf test: new testsuite: perf stat tests
In reply to a message not in the archiveThis commit adds tests for perf stat tool and event checking.
--- tools/perf/testsuite/base_stat/cleanup.sh | 26 ++++++++ tools/perf/testsuite/base_stat/settings.sh | 25 ++++++++ tools/perf/testsuite/base_stat/test_basic.sh | 69 ++++++++++++++++++++++ tools/perf/testsuite/base_stat/test_hw.sh | 50 ++++++++++++++++ tools/perf/testsuite/base_stat/test_hwcache.sh | 51 ++++++++++++++++ .../perf/testsuite/base_stat/test_intel_uncore.sh | 46 +++++++++++++++ .../testsuite/base_stat/test_powerpc_hv_24x7.sh | 60 +++++++++++++++++++ .../base_stat/test_tracepoints_definition.sh | 62 +++++++++++++++++++ 8 files changed, 389 insertions(+) create mode 100755 tools/perf/testsuite/base_stat/cleanup.sh create mode 100644 tools/perf/testsuite/base_stat/settings.sh create mode 100755 tools/perf/testsuite/base_stat/test_basic.sh create mode 100755 tools/perf/testsuite/base_stat/test_hw.sh create mode 100755 tools/perf/testsuite/base_stat/test_hwcache.sh create mode 100755 tools/perf/testsuite/base_stat/test_intel_uncore.sh create mode 100755 tools/perf/testsuite/base_stat/test_powerpc_hv_24x7.sh create mode 100755 tools/perf/testsuite/base_stat/test_tracepoints_definition.sh
tools/perf/testsuite/base_stat/cleanup.sh new file +26 -0
@@ -0,0 +1,26 @@ +#!/bin/bash + +# +# cleanup.sh of perf stat test +# Author: Michael Petlan <[email protected]> +# +# 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 +test -d hw && rmdir hw +test -d hwcache && rmdir hwcache +test -d hv24x7 && rmdir hv_24x7 +test -d intel_uncore && rmdir intel_uncore +print_overall_results 0 +exit 0
tools/perf/testsuite/base_stat/settings.sh new file +25 -0
@@ -0,0 +1,25 @@ +# +# settings.sh of perf_stat test +# Author: Michael Petlan <[email protected]> +# +# Description: +# FIXME +# +# + +export TEST_NAME="perf_stat" + +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
tools/perf/testsuite/base_stat/test_basic.sh new file +69 -0
69 lines not on this page · raw message
tools/perf/testsuite/base_stat/test_hw.sh new file +50 -0
50 lines not on this page · raw message
tools/perf/testsuite/base_stat/test_hwcache.sh new file +51 -0
51 lines not on this page · raw message
tools/perf/testsuite/base_stat/test_intel_uncore.sh new file +46 -0
46 lines not on this page · raw message
tools/perf/testsuite/base_stat/test_powerpc_hv_24x7.sh new file +60 -0
60 lines not on this page · raw message
tools/perf/testsuite/base_stat/test_tracepoints_definition.sh new file +62 -0
62 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH 9/9 perf test: new testsuite: perf trace tests
In reply to a message not in the archiveThis commit adds tests for perf trace tool.
--- 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
tools/perf/testsuite/base_trace/cleanup.sh new file +24 -0
@@ -0,0 +1,24 @@ +#!/bin/bash + +# +# cleanup.sh of perf_trace test +# Author: Michael Petlan <[email protected]> +# +# 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
tools/perf/testsuite/base_trace/settings.sh new file +25 -0
@@ -0,0 +1,25 @@ +# +# settings.sh of perf_trace test +# Author: Michael Petlan <[email protected]> +# +# 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
tools/perf/testsuite/base_trace/setup.sh new file +16 -0
@@ -0,0 +1,16 @@ +#!/bin/bash + +# +# setup.sh of SKELETON test +# Author: Michael Petlan <[email protected]> +# +# Description: +# FIXME +# +# + +. ../common/init.sh +. ./settings.sh + +print_overall_results 0 +exit 0
tools/perf/testsuite/base_trace/stderr-whitelist.txt new file +1 -0
@@ -0,0 +1 @@ +no symbols found in .*, maybe install a debug package
tools/perf/testsuite/base_trace/test_basic.sh new file +131 -0
131 lines not on this page · raw message
tools/perf/testsuite/base_trace/test_overhead.sh new file +51 -0
51 lines not on this page · raw message
tools/perf/testsuite/base_trace/test_record.sh new file +45 -0
45 lines not on this page · raw message
Signature · 1 line
1.8.3.1