[oprofile-testsuite PATCH 2/7] Add verbosity statements for test suite
Will Schmidt <[email protected]>
| Newsgroups | gmane.linux.oprofile |
|---|---|
| Message-ID | <[email protected]> |
Add some intermediate variables to hold commands; add some verbose statements to display them when run under higher verbosity. (runtest --verbose --tool=...) Signed-off-by: Will Schmidt <[email protected]> --- testsuite/lib/operf_util.exp | 17 ++++-- testsuite/lib/verify.exp | 55 ++++++++++++++------ testsuite/oprofile-operf/oprofile-operf-run.exp | 3 + .../oprofile-single_process-run.exp | 2 + 4 files changed, 53 insertions(+), 24 deletions(-) diff --git a/testsuite/lib/operf_util.exp b/testsuite/lib/operf_util.exp index 858d788..c58534e 100644 --- a/testsuite/lib/operf_util.exp +++ b/testsuite/lib/operf_util.exp @@ -63,9 +63,9 @@ proc operf_cpu_type {} { proc operf_delete_samples {} { set result [local_exec "rm -rf ./oprofile_data" "" "" 100 ] if { [lindex $result 0] == 0 } { - verbose "Successfully deleted exiting data directory" + verbose "Successfully deleted existing oprofile_data directory" } else { - verbose "Failed to delete exiting data directory" + verbose "Failed to delete existing oprofile_data directory" } } @@ -123,9 +123,9 @@ proc operf_ocount_get_version {tool} { # opcontrol results in /dev/oprofile/cpu_type being set to 'timer' by # the oprofile kernel module. If operf/ocount are run in such a situation, # they detect the "timer" mode and exit with a message telling the user - # to run 'opcontrol --deinit'. If we are root user, we'll run the deinit - # here; then we'll try again to get the version. If we're not user, we'll - # print a big message asking the user to do so. + # to run 'opcontrol --deinit'. If we are the root user, we'll run the deinit + # here; then we'll try again to get the version. If we're not running as + # root, we'll print an error message with hints to the user on what to do. set operf_ocount_version 0 check_user if {$user_is_root == 1} { @@ -204,6 +204,8 @@ proc do_single_process_test {ctrs output_check test_debug_option} { set workload_src [lindex $op_workload_table($entry) 0] set compile_options [lindex $op_workload_table($entry) 1] set workload_exc [compile_workload $workload_src $compile_options] + verbose "Workload: $workload_exc\n" + verbose "Counter options: $ctr_opts\n" # Run the workload if {$output_check == 3} { @@ -211,6 +213,7 @@ proc do_single_process_test {ctrs output_check test_debug_option} { } else { set cmd "operf --events ${ctr_opts} ${workload_exc}" } + verbose "operf command is: $cmd \n" if {$test_debug_option == 1} { set dbg_test " (--debug-info)" @@ -220,9 +223,9 @@ proc do_single_process_test {ctrs output_check test_debug_option} { switch -exact "$output_check" { 1 {set test "operf check for symbols$dbg_test: $cmd"} 2 {set test "operf check for kallsyms$dbg_test: $cmd"} - 3 {set test "operf check for callgraph output$dbg_test: $cmd"} + 3 {set test "operf check callgraph output$dbg_test: $cmd"} } - + verbose "\nTest: $test\n" if {[lindex [local_exec $cmd "" "" 100] 0] == 0} { pass $test } else { diff --git a/testsuite/lib/verify.exp b/testsuite/lib/verify.exp index 5427422..85a290a 100644 --- a/testsuite/lib/verify.exp +++ b/testsuite/lib/verify.exp @@ -68,14 +68,18 @@ proc validate_xml_report { callgraph } { set binpath [lindex [local_exec "readlink -f $binpath" "" "" 10] 1] set idx [string last "/bin" $binpath ] set op_install_dir [string range $binpath 0 $idx ] + verbose "Using install_dir location: $op_install_dir \n" append schema_file $op_install_dir "/share/doc/oprofile*/opreport.xsd" set schema_file [glob $schema_file] - set opreport_result [local_exec "opreport --debug-info --symbols $cg_option --long-filenames --xml -o out.xml" "" "" 100 ] + verbose "Using schema file: $schema_file \n" + set opreport_cmd "opreport --debug-info --symbols $cg_option --long-filenames --xml -o out.xml" + verbose "Opreport command: $opreport_cmd \n" + set opreport_result [local_exec "$opreport_cmd" "" "" 100 ] set xmllint_result [local_exec "xmllint --noout --schema $schema_file out.xml" "" "" 10 ] if { [regexp "out.xml validates" "$xmllint_result" ]} { - pass " Verified XML opreport with callgraph option=$callgraph is valid" + pass " Verified XML opreport with callgraph option=$cg_option is valid" } else { - fail " XML opreport output with callgraph option=$callgraph is invalid" + fail " XML opreport output with callgraph option=$cg_option is invalid" print [lindex $xmllint_result 1] } set result [local_exec "rm -rf ./out.xml" "" "" 100 ] @@ -97,10 +101,15 @@ proc verify_output { workload_table_entry workload ctr_opts debug_opt_enabled} { # which should be found in opreport output. for {set index $base} {$index < $max} {incr index} { set symbol [lindex $workload_spec $index] + verbose "Looking for symbol: $symbol \n" if { $debug_opt_enabled } { - set result [local_exec "opreport --debug-info --symbols --long-filenames" "" "" 100 ] + set opreport_cmd "opreport --debug-info --symbols --long-filenames" + verbose "Opreport command: $opreport_cmd \n" + set result [local_exec "$opreport_cmd" "" "" 100 ] } else { - set result [local_exec "opreport --symbols --long-filenames" "" "" 100 ] + set opreport_cmd "opreport --symbols --long-filenames" + verbose "Opreport command: $opreport_cmd \n" + set result [local_exec "$opreport_cmd" "" "" 100 ] } if { [regexp $symbol "$result" ]} { verbose "Verify the symbols for workload: $workload" @@ -125,16 +134,23 @@ proc verify_kallsyms_output { } { set symbol1 "kallsyms" set symbol2 "no-vmlinux" - set result [local_exec "opreport --symbols --long-filenames" "" "" 100 ] + set opreport_cmd "opreport --symbols --long-filenames" + verbose "Opreport command: $opreport_cmd \n" + set result [local_exec "$opreport_cmd" "" "" 100 ] if { [regexp $symbol1 "$result" ] == 1 && [regexp $symbol2 "$result" ] == 0 } { - pass " Kallsyms was used to get the kernel symbols." - verbose "\n" + pass " Kallsyms was successfully used to get the kernel symbols." + verbose "\n" } else { - print "Verify the test is being run as root and " - print "/proc/sys/kernel/kptr_restrict is either 0 or 1." - fail " Failed to obtain the kernel symbols from kallsyms." - print "\n" + fail " Failed to obtain the kernel symbols from kallsyms." + print "Verify the test is being run as root or that " + print "/proc/sys/kernel/kptr_restrict is set to 0." + send "The current value of kptr_restrict is: " + set kptr_restrict_file /proc/sys/kernel/kptr_restrict + set file [open $kptr_restrict_file] + fcopy $file stdout + close $file + print "\n" } } @@ -148,18 +164,23 @@ proc verify_callgraph_output { workload_table_entry workload ctr_opts} { # which should be found in opreport output. # Verify the output file contains the expected symbols. - set result [regsub {\{|\}} [local_exec "opreport --callgraph" "" "" 100 ] " "] + set opreport_cmd "opreport --callgraph" + verbose "Opreport command: $opreport_cmd \n" + set result [regsub {\{|\}} [local_exec "$opreport_cmd " "" "" 100 ] " "] for {set index 2} {$index < $max} {incr index} { set symbol [lindex $workload_spec $index] if { [regexp $symbol "$result" ]} { - verbose "Verify callgraph contains the workload symbols: $workload" - verbose " Performance counter events: $ctr_opts" + verbose "Verify callgraph output contains the expected symbols:\n" + verbose " Workload: $workload\n" + verbose " Performance counter events: $ctr_opts\n" + verbose " Symbol: $symbol\n" pass " opreport contains symbol: $symbol" verbose "\n" } else { - print "Verify callgraph contains the workload symbols: $workload" - print " Performance counter events: $ctr_opts" + print "Verify callgraph output contains the expected symbols:\n" + print " Workload: $workload\n" + print " Performance counter events: $ctr_opts\n" fail " opreport does not contain symbol: $symbol" print "\n" } diff --git a/testsuite/oprofile-operf/oprofile-operf-run.exp b/testsuite/oprofile-operf/oprofile-operf-run.exp index 763075d..51aa2dc 100644 --- a/testsuite/oprofile-operf/oprofile-operf-run.exp +++ b/testsuite/oprofile-operf/oprofile-operf-run.exp @@ -162,7 +162,9 @@ if {$user_is_root == 0} { # around that opreport might inadvertenly pick up. operf_delete_samples + send "Running the operf system-wide tests\n" oprofile-operf_run_system_wide_tests + send "Running the operf callgraph tests\n" oprofile-callgraph_run_tests case $operf_version { @@ -171,6 +173,7 @@ if {$user_is_root == 0} { } { * } { # kallsyms support was added in version 1.0. + send "Running the operf kallsyms-readable tests. (symbols,kallsyms,callgraph) \n" oprofile-kallsyms-readable_run_tests } } diff --git a/testsuite/oprofile-single_process/oprofile-single_process-run.exp b/testsuite/oprofile-single_process/oprofile-single_process-run.exp index 752585d..69fc85f 100644 --- a/testsuite/oprofile-single_process/oprofile-single_process-run.exp +++ b/testsuite/oprofile-single_process/oprofile-single_process-run.exp @@ -85,6 +85,8 @@ if { $operf_version == 0} { # the opcontrol data was previously deleted as root. The goal is to be # able to run this test as a regular user. operf_delete_samples + # single process tests oprofile-single_process_run_tests + # debug option tests oprofile-debug-option_run_tests } ------------------------------------------------------------------------------ Transform Data into Opportunity. Accelerate data analysis in your applications with Intel Data Analytics Acceleration Library. Click to learn more. http://pubads.g.doubleclick.net/gampad/clk?id=278785471&iu=/4140