[oprofile-testsuite PATCH 7/7] whitespace update, tabs to spaces
Will Schmidt <[email protected]>
| Newsgroups | gmane.linux.oprofile |
|---|---|
| Message-ID | <[email protected]> |
Refresh all the source files I've touched in this series to use four spaces for indentation instead of tabs. Signed-off-by: Will Schmidt <[email protected]> --- testsuite/lib/operf_util.exp | 222 ++++++++--------- testsuite/lib/verify.exp | 154 ++++++----- .../oprofile-opcontrol/oprofile-opcontrol-run.exp | 269 ++++++++++---------- testsuite/oprofile-operf/oprofile-operf-run.exp | 128 +++++----- .../oprofile-single_process-run.exp | 35 +-- 5 files changed, 402 insertions(+), 406 deletions(-) diff --git a/testsuite/lib/operf_util.exp b/testsuite/lib/operf_util.exp index 8aea77e..b34fd33 100644 --- a/testsuite/lib/operf_util.exp +++ b/testsuite/lib/operf_util.exp @@ -29,12 +29,12 @@ proc operf_get_proc_name {string} { set i 0 foreach field $string { - set res $res$field - incr i + set res $res$field + incr i - if {$i != $len} { - set res $res\_ - } + if {$i != $len} { + set res $res\_ + } } return $res } @@ -51,10 +51,10 @@ proc operf_cpu_type {} { # Note, operf does not support the timer modes switch -exact "$cpu_name" { - 4 {set cpu_events bogus} - timer {set cpu_events bogus} - 5 {set cpu_events bogus} - rtc {set cpu_events bogus} + 4 {set cpu_events bogus} + timer {set cpu_events bogus} + 5 {set cpu_events bogus} + rtc {set cpu_events bogus} } return $cpu_events @@ -75,16 +75,16 @@ proc operf_check_samples_exist {ctrs} { verbose "checking for nonzero sample files" foreach ctr $ctrs { - set n [lindex $ctr 0] - set event [lindex $ctr 1] - - verbose "running opreport --symbols --long-filenames event:$event" - set result [ local_exec "opreport --symbols --long-filenames event:$event" "" "" 100 ] - if { [regexp "error:" "$result" ]} { - fail "$test: {$event} created nonzero sample files" - } else { - pass "$test: {$event} created nonzero sample files" - } + set n [lindex $ctr 0] + set event [lindex $ctr 1] + + verbose "running opreport --symbols --long-filenames event:$event" + set result [ local_exec "opreport --symbols --long-filenames event:$event" "" "" 100 ] + if { [regexp "error:" "$result" ]} { + fail "$test: {$event} created nonzero sample files" + } else { + pass "$test: {$event} created nonzero sample files" + } } } @@ -105,7 +105,7 @@ proc operf_ocount_get_version {tool} { if {[regexp "\[0-9\]+\(.\[0-9\]+\)+\[a-zA-Z_\]*" $result operf_ocount_version] == 1} { -# Need to make sure the kernel has perf support as well +# Need to make sure the kernel has perf support as well if {[lindex [local_exec op-check-perfevents "" "" 100] 0] == 0} { pass $test } else { @@ -186,74 +186,74 @@ proc do_single_process_test {ctrs output_check test_debug_option} { foreach ctr $ctrs { # n - counter number, no longer used but didn't want to change # specification format - set n [lindex $ctr 0] - set event [lindex $ctr 1] - set um [lindex $ctr 2] - if {$output_check == 3} { - # With callgraph profiling, we only use the cycles-based event for the - # architecture. Just set the count value high enough to make sure it's - # at least 15x the minimum; 1,500,000 should do it. - set count 1500000 - } else { - set count [lindex $ctr 3] - } - append ctr_opts "${event}:${count}:${um}:${kernel}:${user}," + set n [lindex $ctr 0] + set event [lindex $ctr 1] + set um [lindex $ctr 2] + if {$output_check == 3} { + # With callgraph profiling, we only use the cycles-based event for the + # architecture. Just set the count value high enough to make sure it's + # at least 15x the minimum; 1,500,000 should do it. + set count 1500000 + } else { + set count [lindex $ctr 3] + } + append ctr_opts "${event}:${count}:${um}:${kernel}:${user}," } foreach entry [array name op_workload_table] { - 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] + 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} { - set cmd "operf --callgraph --lazy-conversion --events ${ctr_opts} ${workload_exc}" - } else { - set cmd "operf --events ${ctr_opts} ${workload_exc}" - } + # Run the workload + if {$output_check == 3} { + set cmd "operf --callgraph --lazy-conversion --events ${ctr_opts} ${workload_exc}" + } 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)" - } else { - set dbg_test "" - } - 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 callgraph output$dbg_test: $cmd"} - } + if {$test_debug_option == 1} { + set dbg_test " (--debug-info)" + } else { + set dbg_test "" + } + 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 callgraph output$dbg_test: $cmd"} + } verbose "\nTest: $test\n" if {[lindex [local_exec $cmd "" "" 100] 0] == 0} { pass $test } else { fail $test - } - - operf_check_samples_exist $ctrs - - # Verify the interesting symbols for this test are found in - # the output. Only checking the symbols for the first group of - # events. - if {$output_check == 1} { - local_exec "sleep 1" "" "" 10 - verify_output $op_workload_table($entry) $workload_exc $ctr_opts $test_debug_option - } - - if {$output_check == 2} { - local_exec "sleep 1" "" "" 10 - verify_kallsyms_output - } - - if {$output_check == 3} { - # check callgraph output - local_exec "sleep 1" "" "" 10 - verify_callgraph_output $op_workload_table($entry) $workload_exc $ctr_opts - } - - operf_delete_samples + } + + operf_check_samples_exist $ctrs + + # Verify the interesting symbols for this test are found in + # the output. Only checking the symbols for the first group of + # events. + if {$output_check == 1} { + local_exec "sleep 1" "" "" 10 + verify_output $op_workload_table($entry) $workload_exc $ctr_opts $test_debug_option + } + + if {$output_check == 2} { + local_exec "sleep 1" "" "" 10 + verify_kallsyms_output + } + + if {$output_check == 3} { + # check callgraph output + local_exec "sleep 1" "" "" 10 + verify_callgraph_output $op_workload_table($entry) $workload_exc $ctr_opts + } + + operf_delete_samples } } @@ -277,33 +277,33 @@ proc do_system-wide_test {ctrs symbol_check} { foreach ctr $ctrs { # n - counter number, no longer used but didn't want to change # specification format - set n [lindex $ctr 0] - set event [lindex $ctr 1] - set um [lindex $ctr 2] - set count [lindex $ctr 3] - append ctr_opts "${event}:${count}:${um}:${kernel}:${user}," + set n [lindex $ctr 0] + set event [lindex $ctr 1] + set um [lindex $ctr 2] + set count [lindex $ctr 3] + append ctr_opts "${event}:${count}:${um}:${kernel}:${user}," } foreach entry [array name op_workload_table] { - 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] + 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] - if {$symbol_check == 1} { - set test "operf systemwide check for symbols: $workload_exc" - } else { - set test "operf systemwide: $workload_exc" - } + if {$symbol_check == 1} { + set test "operf systemwide check for symbols: $workload_exc" + } else { + set test "operf systemwide: $workload_exc" + } # create the script to run the operf command set operf_run_script [exec mktemp "/tmp/operf_run.XXXX"] set operf_output_log [exec mktemp "/tmp/operf_output.XXXX"] set fileId [open $operf_run_script "w"] - puts $fileId "#!/bin/bash" - puts -nonewline $fileId "operf --system-wide --events " - puts -nonewline $fileId $ctr_opts - puts -nonewline $fileId " 2>&1 | tee > $operf_output_log" - close $fileId + puts $fileId "#!/bin/bash" + puts -nonewline $fileId "operf --system-wide --events " + puts -nonewline $fileId $ctr_opts + puts -nonewline $fileId " 2>&1 | tee > $operf_output_log" + close $fileId local_exec "chmod 755 $operf_run_script" "" "" 10 # Run the script to start operf data collection in the background @@ -315,21 +315,21 @@ proc do_system-wide_test {ctrs symbol_check} { set create_stop_script [exec mktemp "/tmp/operf_create_stop_script.XXXX"] set fileId [open $create_stop_script "w"] set operf_stop_script [exec mktemp "/tmp/operf_stop_operf.XXXX"] - puts $fileId "#!/bin/bash" + puts $fileId "#!/bin/bash" puts $fileId "echo -n \"kill -s INT \" > $operf_stop_script " # logic that collects the process id to be killed puts $fileId "cat $operf_output_log | grep \"kill\" | cut -d\"\'\" -f2 | cut -d\" \" -f3 >> $operf_stop_script " - close $fileId + close $fileId - # check that operf started correctly + # check that operf started correctly if {[lindex [local_exec "grep \"usage\" $operf_output_log " "" "" 100] 0] == 1} { - pass $test - } else { - fail $test - } + pass $test + } else { + fail $test + } # Now, call the script to create the operf kill script. - local_exec "sleep 2" "" "" 10 + local_exec "sleep 2" "" "" 10 local_exec "chmod 755 $create_stop_script" "" "" 10 exec $create_stop_script @@ -342,20 +342,20 @@ proc do_system-wide_test {ctrs symbol_check} { operf_check_samples_exist $ctrs - # Verify the interesting symbols for this test are found in - # the output. Only checking the symbols for the first group of - # events. - if {$symbol_check == 1} { - local_exec "sleep 2" "" "" 10 - set test_debug_option 0 - verify_output $op_workload_table($entry) $workload_exc $ctr_opts $test_debug_option - } + # Verify the interesting symbols for this test are found in + # the output. Only checking the symbols for the first group of + # events. + if {$symbol_check == 1} { + local_exec "sleep 2" "" "" 10 + set test_debug_option 0 + verify_output $op_workload_table($entry) $workload_exc $ctr_opts $test_debug_option + } - # cleanup the files created + # cleanup the files created local_exec "rm -f $operf_run_script" "" "" 10 local_exec "rm -f $operf_output_log" "" "" 10 local_exec "rm -f $create_stop_script" "" "" 10 local_exec "rm -f $operf_stop_script" "" "" 10 - operf_delete_samples + operf_delete_samples } } diff --git a/testsuite/lib/verify.exp b/testsuite/lib/verify.exp index 85a290a..4aad17b 100644 --- a/testsuite/lib/verify.exp +++ b/testsuite/lib/verify.exp @@ -3,86 +3,86 @@ set XML_report_cg_done 0 set XML_report_no_cg_done 0 proc should_run_xml_tests { } { - global operf_version - if { $operf_version == 0 } { - return 0 - } else { - case $operf_version { - { 0.9.9 } { - return 1 - } - { 0.* } { - return 0 - } - { * } { - return 1 - } - } - } + global operf_version + if { $operf_version == 0 } { + return 0 + } else { + case $operf_version { + { 0.9.9 } { + return 1 + } + { 0.* } { + return 0 + } + { * } { + return 1 + } + } + } } proc validate_xml_help { } { - global XML_help_done - if { [should_run_xml_tests] == 0 || $XML_help_done == 1 } { - return - } - set binpath [lindex [local_exec "which ophelp" "" "" 10] 1] - 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 ] - append schema_file $op_install_dir "/share/doc/oprofile*/ophelp.xsd" - set schema_file [glob $schema_file] - set ophelp_result [local_exec "ophelp --xml" "" "" 100 ] - set out [open "help_out.xml" w] - puts $out [lindex $ophelp_result 1] - close $out - set xmllint_result [local_exec "xmllint --noout --schema $schema_file help_out.xml" "" "" 10 ] - if { [regexp "help_out.xml validates" "$xmllint_result" ]} { - pass " Verified XML ophelp output is valid" - } else { - fail " XML ophelp output is invalid" - print [lindex $xmllint_result 1] - } - set result [local_exec "rm -rf ./help_out.xml" "" "" 100 ] - set XML_help_done 1 + global XML_help_done + if { [should_run_xml_tests] == 0 || $XML_help_done == 1 } { + return + } + set binpath [lindex [local_exec "which ophelp" "" "" 10] 1] + 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 ] + append schema_file $op_install_dir "/share/doc/oprofile*/ophelp.xsd" + set schema_file [glob $schema_file] + set ophelp_result [local_exec "ophelp --xml" "" "" 100 ] + set out [open "help_out.xml" w] + puts $out [lindex $ophelp_result 1] + close $out + set xmllint_result [local_exec "xmllint --noout --schema $schema_file help_out.xml" "" "" 10 ] + if { [regexp "help_out.xml validates" "$xmllint_result" ]} { + pass " Verified XML ophelp output is valid" + } else { + fail " XML ophelp output is invalid" + print [lindex $xmllint_result 1] + } + set result [local_exec "rm -rf ./help_out.xml" "" "" 100 ] + set XML_help_done 1 } proc validate_xml_report { callgraph } { - global XML_report_cg_done - global XML_report_no_cg_done - if { [should_run_xml_tests] == 0 } { - return - } - if { $XML_report_cg_done == 1 && $XML_report_no_cg_done == 1 } { - return - } - - if { $callgraph } { - set cg_option "--callgraph" - set XML_report_cg_done 1 - } else { - set cg_option "" - set XML_report_no_cg_done 1 - } - set binpath [lindex [local_exec "which operf" "" "" 10] 1] - 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] - 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=$cg_option is valid" - } else { - 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 ] + global XML_report_cg_done + global XML_report_no_cg_done + if { [should_run_xml_tests] == 0 } { + return + } + if { $XML_report_cg_done == 1 && $XML_report_no_cg_done == 1 } { + return + } + + if { $callgraph } { + set cg_option "--callgraph" + set XML_report_cg_done 1 + } else { + set cg_option "" + set XML_report_no_cg_done 1 + } + set binpath [lindex [local_exec "which operf" "" "" 10] 1] + 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] + 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=$cg_option is valid" + } else { + 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 ] } proc verify_output { workload_table_entry workload ctr_opts debug_opt_enabled} { @@ -92,9 +92,9 @@ proc verify_output { workload_table_entry workload ctr_opts debug_opt_enabled} { if { $debug_opt_enabled } { # debug option enabled, adds a column to the output for the source - set base 3 + set base 3 } else { - set base 2 + set base 2 } # Note, starting with the second entry in the workload spec is the name # of the workload executable file. The remaining entries are symbols @@ -201,7 +201,7 @@ proc verify_callgraph_output { workload_table_entry workload ctr_opts} { set cur_word [ lindex $line $i ] set next_word [ lindex $line [ expr $i + 1 ] ] if { ([string compare $cur_word "kallsyms"] == 0 ) && - ([string compare $next_word "/proc/kallsyms"] == 0 ) } { + ([string compare $next_word "/proc/kallsyms"] == 0 ) } { set err 1 } set i [expr $i + 1] diff --git a/testsuite/oprofile-opcontrol/oprofile-opcontrol-run.exp b/testsuite/oprofile-opcontrol/oprofile-opcontrol-run.exp index a20aa7f..1a1d59d 100644 --- a/testsuite/oprofile-opcontrol/oprofile-opcontrol-run.exp +++ b/testsuite/oprofile-opcontrol/oprofile-opcontrol-run.exp @@ -33,14 +33,14 @@ proc op_daemon_flush {} { set test "opcontrol --dump" if {$op_daemon_running == 0} { - unsupported $test - return + unsupported $test + return } verbose "running opcontrol --dump" if {[lindex [local_exec "opcontrol --dump" "" "" 100] 0] == 0} { - pass $test + pass $test } else { - fail $test + fail $test } } @@ -52,51 +52,51 @@ proc op_daemon_check_samples_exist {ctrs} { set test "nonzero-sized sample file creation" if {$op_daemon_running == 0} { - print "op_daemon_check_samples_exist, op_daemon not running as expected" - unsupported $test - return + print "op_daemon_check_samples_exist, op_daemon not running as expected" + unsupported $test + return } verbose "checking for nonzero sample files" foreach ctr $ctrs { - set n [lindex $ctr 0] - set event [lindex $ctr 1] - case $op_version { - { 0.1* 0.2* 0.3* 0.4* } { - fail "ERROR: testsuite not supported on version {$op_version}" - } - { 0.5* } { - set files [glob -nocomplain -types f "$op_var_prefix/samples/*#$n"] - if {[llength $files] == 0} { - unresolved "$test: {$ctr} created no files" - } else { - set sz 0 - verbose "looking at [llength $files] sample files for ctr $n" - foreach f $files { - set nsz [file size $f] - if {$nsz > $sz} { - set sz $nsz - } - } - if {$sz == 0} { - unresolved "$test: {$ctr} created only zero-length files" - } else { - pass "$test: {$ctr} created nonzero sample files" - } - } - } - { * } { - # default for all newer versions of oprofile - verbose "running opreport --long-filenames event:$event" - set result [local_exec "opreport --long-filenames event:$event" "" "" 100 ] - if { [regexp "error:" "$result" ]} { - fail "$test: {$event} created nonzero sample files" - } else { - pass "$test: {$event} created nonzero sample files" - } - } - } + set n [lindex $ctr 0] + set event [lindex $ctr 1] + case $op_version { + { 0.1* 0.2* 0.3* 0.4* } { + fail "ERROR: testsuite not supported on version {$op_version}" + } + { 0.5* } { + set files [glob -nocomplain -types f "$op_var_prefix/samples/*#$n"] + if {[llength $files] == 0} { + unresolved "$test: {$ctr} created no files" + } else { + set sz 0 + verbose "looking at [llength $files] sample files for ctr $n" + foreach f $files { + set nsz [file size $f] + if {$nsz > $sz} { + set sz $nsz + } + } + if {$sz == 0} { + unresolved "$test: {$ctr} created only zero-length files" + } else { + pass "$test: {$ctr} created nonzero sample files" + } + } + } + { * } { + # default for all newer versions of oprofile + verbose "running opreport --long-filenames event:$event" + set result [local_exec "opreport --long-filenames event:$event" "" "" 100 ] + if { [regexp "error:" "$result" ]} { + fail "$test: {$event} created nonzero sample files" + } else { + pass "$test: {$event} created nonzero sample files" + } + } + } } } @@ -111,30 +111,30 @@ proc op_daemon_start {ctrs} { local_exec "rm -f /root/.oprofile/daemonrc" "" "" 100 if {$op_module_active == 0} { - unsupported "daemon start" - return + unsupported "daemon start" + return } set ctr_opts {} foreach ctr $ctrs { - set n [lindex $ctr 0] - set event [lindex $ctr 1] - set um [lindex $ctr 2] - set count [lindex $ctr 3] - case $op_version { - { 0.1* 0.2* 0.3* 0.4* } { - fail "ERROR: testsuite not supported on version {$op_version}" - } - { 0.5* } { - append ctr_opts " --ctr${n}-event=${event}" - append ctr_opts " --ctr${n}-count=${count}" - append ctr_opts " --ctr${n}-unit-mask=${um}" - } - { * } { - # default for all newer versions of oprofile - append ctr_opts " --event=${event}:${count}:${um}" - } - } + set n [lindex $ctr 0] + set event [lindex $ctr 1] + set um [lindex $ctr 2] + set count [lindex $ctr 3] + case $op_version { + { 0.1* 0.2* 0.3* 0.4* } { + fail "ERROR: testsuite not supported on version {$op_version}" + } + { 0.5* } { + append ctr_opts " --ctr${n}-event=${event}" + append ctr_opts " --ctr${n}-count=${count}" + append ctr_opts " --ctr${n}-unit-mask=${um}" + } + { * } { + # default for all newer versions of oprofile + append ctr_opts " --event=${event}:${count}:${um}" + } + } } verbose "running opcontrol --reset" @@ -143,18 +143,18 @@ proc op_daemon_start {ctrs} { # this will activate the daemon too. opcontrol is so silly. if {$op_vmlinux == 0} { - set kernel_control "--no-vmlinux" + set kernel_control "--no-vmlinux" } else { - set kernel_control "--vmlinux=${op_vmlinux}" + set kernel_control "--vmlinux=${op_vmlinux}" } set cmd "opcontrol --setup ${kernel_control} ${ctr_opts}" set test $cmd verbose "running '$cmd'" set result [local_exec $cmd "" "" 100] if {[lindex $result 0] == 0} { - pass $test + pass $test } else { - fail $test + fail $test } # this starts daemon, but doesn't start profiling @@ -163,33 +163,33 @@ proc op_daemon_start {ctrs} { verbose "running '$cmd'" set result [local_exec $cmd "" "" 100] if {[lindex $result 0] == 0} { - if {[regexp oprofiled [exec /bin/ps ax]] == 1} { - verbose "daemon is now running" - set op_daemon_running 1 - pass $test - } else { - verbose "daemon did not start as requested" - set op_daemon_running 0 - fail $test - } + if {[regexp oprofiled [exec /bin/ps ax]] == 1} { + verbose "daemon is now running" + set op_daemon_running 1 + pass $test + } else { + verbose "daemon did not start as requested" + set op_daemon_running 0 + fail $test + } } else { - verbose "opcontrol --init failed. are you root?" - set op_daemon_running 0 - fail $test + verbose "opcontrol --init failed. are you root?" + set op_daemon_running 0 + fail $test } # this activates profiling set test "opcontrol --start" if {$op_daemon_running == 0} { - unsupported $test + unsupported $test } else { - verbose "running 'opcontrol --start'" - if {[lindex [local_exec "opcontrol --start" "" "" 100] 0] == 0} { - pass $test - } else { - fail $test - } + verbose "running 'opcontrol --start'" + if {[lindex [local_exec "opcontrol --start" "" "" 100] 0] == 0} { + pass $test + } else { + fail $test + } } } @@ -198,15 +198,15 @@ proc op_daemon_stop {} { set test "opcontrol --shutdown" if {$op_daemon_running == 0} { - unsupported $test + unsupported $test } else { - verbose "running 'opcontrol --shutdown'" - if {[lindex [local_exec "opcontrol --shutdown" "" "" 100] 0] == 0} { - pass $test - set op_daemon_running 0 - } else { - fail $test - } + verbose "running 'opcontrol --shutdown'" + if {[lindex [local_exec "opcontrol --shutdown" "" "" 100] 0] == 0} { + pass $test + set op_daemon_running 0 + } else { + fail $test + } } # delete the daemonrc file to remove any settings from the testsuite @@ -218,38 +218,37 @@ proc op_daemon_cycle {ctrs symbol_check} { set ctr_opts {} foreach ctr $ctrs { - set n [lindex $ctr 0] - set event [lindex $ctr 1] - set um [lindex $ctr 2] - set count [lindex $ctr 3] - append ctr_opts "{$n $event $um $count} " + set n [lindex $ctr 0] + set event [lindex $ctr 1] + set um [lindex $ctr 2] + set count [lindex $ctr 3] + append ctr_opts "{$n $event $um $count} " } foreach entry [array name op_workload_table] { + 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] - 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] - - op_daemon_start $ctrs + op_daemon_start $ctrs # run the workload - local_exec ${workload_exc} "" "" 100 - - op_daemon_flush - op_daemon_check_samples_exist $ctrs - op_daemon_stop - - # Verify the interesting symbols for this test are found in - # the output. Only checking the symbols for the first group of - # events. - if {$symbol_check == 1} { - local_exec "sleep 2" "" "" 10 - set test_debug_option 0 - verify_output $op_workload_table($entry) $workload_exc $ctr_opts $test_debug_option - } - - op_daemon_delete_any_samples + local_exec ${workload_exc} "" "" 100 + + op_daemon_flush + op_daemon_check_samples_exist $ctrs + op_daemon_stop + + # Verify the interesting symbols for this test are found in + # the output. Only checking the symbols for the first group of + # events. + if {$symbol_check == 1} { + local_exec "sleep 2" "" "" 10 + set test_debug_option 0 + verify_output $op_workload_table($entry) $workload_exc $ctr_opts $test_debug_option + } + + op_daemon_delete_any_samples } } @@ -259,8 +258,8 @@ proc op_check_daemon {} { set symbol_check 1 foreach spec $op_event_table($cpu) { - op_daemon_cycle $spec $symbol_check - set symbol_check 0 + op_daemon_cycle $spec $symbol_check + set symbol_check 0 } } @@ -296,18 +295,18 @@ if {$op_version == 0} { } else { check_user if {$user_is_root == 0} { - send "\nYou must be root to run the OProfile opcontrol interface.\n" - send "Will not run opcontrol tests.\n" + send "\nYou must be root to run the OProfile opcontrol interface.\n" + send "Will not run opcontrol tests.\n" } else { - # Just to be paranoid and make sure there is no operf or opcontrol - # data that opreport might pickup by mistake, delete any existing - # data. - pass $test - set opcontrol_installed 1 - operf_delete_samples - op_daemon_delete_any_samples - - oprofile_start - op_check_daemon + # Just to be paranoid and make sure there is no operf or opcontrol + # data that opreport might pickup by mistake, delete any existing + # data. + pass $test + set opcontrol_installed 1 + operf_delete_samples + op_daemon_delete_any_samples + + oprofile_start + op_check_daemon } } diff --git a/testsuite/oprofile-operf/oprofile-operf-run.exp b/testsuite/oprofile-operf/oprofile-operf-run.exp index 2a4b4f8..0d846cf 100644 --- a/testsuite/oprofile-operf/oprofile-operf-run.exp +++ b/testsuite/oprofile-operf/oprofile-operf-run.exp @@ -33,18 +33,16 @@ proc oprofile-operf_run_system_wide_tests {} { set cpu [operf_cpu_type] if {$cpu == "bogus"} { - send "Error, not able find cpu type exiting.\n" - + send "Error, not able find cpu type exiting.\n" } else { - - set symbol_check 1 - foreach spec $op_event_table($cpu) { - # Just do the symbol check on the first event group. The - # assumption is the first event group contains cycles or count - # instructions which will reliably collect a lot of samples. - do_system-wide_test $spec $symbol_check - set symbol_check 0 - } + set symbol_check 1 + foreach spec $op_event_table($cpu) { + # Just do the symbol check on the first event group. The + # assumption is the first event group contains cycles or count + # instructions which will reliably collect a lot of samples. + do_system-wide_test $spec $symbol_check + set symbol_check 0 + } } } @@ -55,18 +53,18 @@ proc oprofile-callgraph_run_tests {} { global op_event_table set cpu [operf_cpu_type] - if {$cpu == "bogus"} { - send "Error, not able find cpu type exiting.\n" - } else { - # test callgraph output - set output_check 3 - set test_debug_option 0 - - # The goal here is a quick sanity check so we will just do the - # test using the first event entry - set spec [lindex $op_event_table($cpu) 0] - do_single_process_test $spec $output_check $test_debug_option - } + if {$cpu == "bogus"} { + send "Error, not able find cpu type exiting.\n" + } else { + # test callgraph output + set output_check 3 + set test_debug_option 0 + + # The goal here is a quick sanity check so we will just do the + # test using the first event entry + set spec [lindex $op_event_table($cpu) 0] + do_single_process_test $spec $output_check $test_debug_option + } } proc oprofile-kallsyms-readable_run_tests {} { @@ -80,17 +78,17 @@ proc oprofile-kallsyms-readable_run_tests {} { set cmd "cat /proc/sys/kernel/kptr_restrict" set kptr_restrict [ lindex [split [local_exec $cmd "" "" 10 ] "\{\}" ] 1 ] - if {$cpu == "bogus"} { - send "Error, not able find cpu type exiting.\n" - } else { - # kallsyms output check - set output_check 2 - set test_debug_option 0 - - # The goal here is a quick check to see if /proc/kallsyms was readable - set spec [lindex $op_event_table($cpu) 0] - do_single_process_test $spec $output_check $test_debug_option - } + if {$cpu == "bogus"} { + send "Error, not able find cpu type exiting.\n" + } else { + # kallsyms output check + set output_check 2 + set test_debug_option 0 + + # The goal here is a quick check to see if /proc/kallsyms was readable + set spec [lindex $op_event_table($cpu) 0] + do_single_process_test $spec $output_check $test_debug_option + } } @@ -126,37 +124,37 @@ if { $operf_version == 0 } { send "Skipping the operf tests.\n" send "Unable to find or verify the version of the OProfile operf utility.\n" } else { - # Ensure that the oprofile kernel module is unloaded, since it can - # interfere with proper operf operation on some platforms. - if {$opcontrol_installed == 1} { - local_exec "opcontrol --deinit" "" "" 100 - # Make sure there are no samples from the opcontrol laying - # around that opreport might inadvertently pick up. - op_daemon_delete_any_samples - } - # Make sure there are no samples from the operf laying + # Ensure that the oprofile kernel module is unloaded, since it can + # interfere with proper operf operation on some platforms. + if {$opcontrol_installed == 1} { + local_exec "opcontrol --deinit" "" "" 100 + # Make sure there are no samples from the opcontrol laying # around that opreport might inadvertently pick up. - operf_delete_samples - - check_user - if {$user_is_root == 0} { - send "Skipping the operf system-wide tests.\n" - send " You must be root to run operf with the --system-wide parameter.\n\n" - } else { - send "Running the operf system-wide tests.\n" - oprofile-operf_run_system_wide_tests + op_daemon_delete_any_samples + } + # Make sure there are no samples from the operf laying + # around that opreport might inadvertently pick up. + operf_delete_samples + + check_user + if {$user_is_root == 0} { + send "Skipping the operf system-wide tests.\n" + send " You must be root to run operf with the --system-wide parameter.\n\n" + } else { + 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 { + { 0.* } { + # no pre 1.0 specific tests to run + } + { * } { + # kallsyms support was added in version 1.0. + send "Running the operf kallsyms-readable tests. (symbols,kallsyms,callgraph) \n" + oprofile-kallsyms-readable_run_tests } - send "Running the operf callgraph tests\n" - oprofile-callgraph_run_tests - - case $operf_version { - { 0.* } { - # no pre 1.0 specific tests to run - } - { * } { - # 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 caeb002..516780b 100644 --- a/testsuite/oprofile-single_process/oprofile-single_process-run.exp +++ b/testsuite/oprofile-single_process/oprofile-single_process-run.exp @@ -32,18 +32,17 @@ proc oprofile-single_process_run_tests {} { global op_event_table set cpu [operf_cpu_type] - if {$cpu == "bogus"} { - send "Error, run single process test not able find CPU type, exiting.\n" + send "Error, run single process test not able find CPU type, exiting.\n" } else { - # check for workload symbols in output - set output_check 1 - set test_debug_option 0 + # check for workload symbols in output + set output_check 1 + set test_debug_option 0 - # The goal here is a quick sanity check so we will just do the - # test using the first event entry - set spec [lindex $op_event_table($cpu) 0] - do_single_process_test $spec $output_check $test_debug_option + # The goal here is a quick sanity check so we will just do the + # test using the first event entry + set spec [lindex $op_event_table($cpu) 0] + do_single_process_test $spec $output_check $test_debug_option } } @@ -52,17 +51,17 @@ proc oprofile-debug-option_run_tests {} { set cpu [operf_cpu_type] if {$cpu == "bogus"} { - send "Error, run debug-info option test not able find CPU type, exiting.\n" + send "Error, run debug-info option test not able find CPU type, exiting.\n" } else { - # check for workload symbols in output - set output_check 1 - # test --debug-info option - set test_debug_option 1 + # check for workload symbols in output + set output_check 1 + # test --debug-info option + set test_debug_option 1 - # The goal here is a quick sanity check that the --debug - # option doesn't crash the opreport tool - set spec [lindex $op_event_table($cpu) 0] - do_single_process_test $spec $output_check $test_debug_option + # The goal here is a quick sanity check that the --debug + # option doesn't crash the opreport tool + set spec [lindex $op_event_table($cpu) 0] + do_single_process_test $spec $output_check $test_debug_option } } ------------------------------------------------------------------------------ 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