Re: [PATCH] OProfile 1.0 test suite, Fix calls to opcontrol
Maynard Johnson <[email protected]>
| Newsgroups | gmane.linux.oprofile |
|---|---|
| Message-ID | <[email protected]> |
On 08/06/2014 12:57 PM, Carl Love wrote: > Maynard: > > The following patch is for the OProfile 1.0 test suite release. It > fixes the test suite to handle the absence of opcontrol command for the > 1.0 and newer releases. Thanks, Carl. The patch looks good and seems to work well with my opcontrol-removal patch posted yesterday. After I've committed, the opcontrol-removal patch, I'll commit your testsuite patch. -Maynard > > Carl Love > > ----------------------------------------------------------------------------- > > OProfile 1.0 test suite, Fix calls to opcontrol > > Operf and ocount make calls to opcontrol to make sure the daemon is shut down, > clear out any existing samples etc. Starting with version 1.0, the > opcontrol command no longer exists. This patch will ensure that operf and > ocount do not make any calls to opcontrol if the command does not exist. > > The opcontrol test suite currently checks if opcontrol exists and exits if > it doesn't exist. This test suite needs just to set the opcontrol_installed > variable to 0 in the case that opcontrol isn't installed so the exit routine > will not call opcontrol --deinit. > > Signed-off-by: Carl Love <[email protected]> > --- > testsuite/config/unix.exp | 3 +- > testsuite/lib/op_util.exp | 14 +++++++++ > testsuite/oprofile-ocount/ocount-run.exp | 21 ++++++++++++- > .../oprofile-opcontrol/oprofile-opcontrol-run.exp | 34 ++++++++++----------- > testsuite/oprofile-operf/oprofile-operf-run.exp | 35 ++++++++++++++++++---- > 5 files changed, 81 insertions(+), 26 deletions(-) > > diff --git a/testsuite/config/unix.exp b/testsuite/config/unix.exp > index 9befabf..1cc2fee 100644 > --- a/testsuite/config/unix.exp > +++ b/testsuite/config/unix.exp > @@ -161,8 +161,9 @@ proc opcontrol_exit {} { > global op_module_active > global user_is_root > global op_version > + global opcontrol_installed > > - if {$user_is_root == 1 && $op_version != ""} { > + if {$user_is_root == 1 && $op_version != "" && $opcontrol_installed == 1} { > verbose "oprofile_exit: deinitializing..." > set test "opcontrol --deinit" > if {[lindex [local_exec "opcontrol --deinit" "" "" 100] 0] == 0} { > diff --git a/testsuite/lib/op_util.exp b/testsuite/lib/op_util.exp > index 296c295..7a57a46 100644 > --- a/testsuite/lib/op_util.exp > +++ b/testsuite/lib/op_util.exp > @@ -161,3 +161,17 @@ proc compile_workload {workload_src compile_options } { > # name to the same as the source name. > return $workload_src > } > + > +proc op_get_version {} { > + global op_version > + # this assumes that things work well enough for op_help > + # the modules has to be already installed via opcontrol > + set result [ local_exec "opcontrol -v" "" "" 100 ] > + > + if {[regexp "\[0-9\]+\(.\[0-9\]+\)+\[a-zA-Z_\]*" $result op_version] == 1} { > + verbose "version is $op_version" > + } else { > + verbose "unable to determine version" > + set op_version 0 > + } > +} > diff --git a/testsuite/oprofile-ocount/ocount-run.exp b/testsuite/oprofile-ocount/ocount-run.exp > index 77458ef..993cd5d 100644 > --- a/testsuite/oprofile-ocount/ocount-run.exp > +++ b/testsuite/oprofile-ocount/ocount-run.exp > @@ -19,6 +19,7 @@ > # > > load_lib "ocount_util.exp" > +load_lib "op_util.exp" > set ocount_version 0 > > > @@ -228,11 +229,29 @@ send "ocount_run_tests\n" > > ocount_get_version > > +# Check to see of opcontrol is installed. > +op_get_version > + > +if {$op_version == 0} { > + # could not find opcontrol > + set opcontrol_installed 0 > +} else { > + if {$op_version < $ocount_version} { > + # Don't run the opcontrol tests if it is an earlier version > + set opcontrol_installed 0 > + } else { > + set opcontrol_installed 1 > + } > +} > + > if { $ocount_version == 0 } { > send "\nThe OProfile ocount user tool is not supported. Will not run ocount tests.\n" > } else { > # Ensure that the oprofile kernel module is unloaded, since it can > # interfere with proper ocount operation on some platforms. > - local_exec "opcontrol --deinit" "" "" 100 > + if {$opcontrol_installed == 1} { > + #opcontrol is installed, make sure daemon is shutdown > + local_exec "opcontrol --deinit" "" "" 100 > + } > ocount_run_tests > } > diff --git a/testsuite/oprofile-opcontrol/oprofile-opcontrol-run.exp b/testsuite/oprofile-opcontrol/oprofile-opcontrol-run.exp > index e7282d8..109d12d 100644 > --- a/testsuite/oprofile-opcontrol/oprofile-opcontrol-run.exp > +++ b/testsuite/oprofile-opcontrol/oprofile-opcontrol-run.exp > @@ -264,40 +264,38 @@ proc op_check_daemon {} { > } > } > > -proc op_get_version {} { > - global op_version > - # this assumes that things work well enough for op_help > - # the modules has to be already installed via opcontrol > - set test "version check" > - verbose $test > - set result [ local_exec "opcontrol -v" "" "" 100 ] > - > - if {[regexp "\[0-9\]+\(.\[0-9\]+\)+\[a-zA-Z_\]*" $result op_version] == 1} { > - verbose "version is $op_version" > - pass $test > - } else { > - verbose "unable to determine version" > - set op_version 0 > - fail $test > - } > -} > - > # main > 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" > } else { > + set test "version check" > + verbose $test > op_get_version > + operf_get_version > > if {$op_version == 0} { > send "\nUnable to find the opcontrol command. Check to make sure \n" > send "OProfile is properly installed and the opcontrol command is \n" > send "in the root's path. Will not run opcontrol tests.\n" > + send "\nNote: The legacy opcontrol command is not available in\n" > + send " OProfile versions 1.0 and newer.\n" > + set opcontrol_installed 0 > + fail $test > + } elseif {$op_version < $operf_version} { > + # Skip the opcontrol tests as the version of opcontrol is older then operf > + send "\nThere appears to be a newer verision of OProfile installed\n" > + send "that does not support opcontrol. Opcontrol support was dropped\n" > + send "with OProfile version 1.0. Will not run the opcontrol tests with\n" > + send "the older opcontrol version.\n\n" > + set opcontrol_installed 0 > } 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 > > diff --git a/testsuite/oprofile-operf/oprofile-operf-run.exp b/testsuite/oprofile-operf/oprofile-operf-run.exp > index b4b207f..5cb5d3e 100644 > --- a/testsuite/oprofile-operf/oprofile-operf-run.exp > +++ b/testsuite/oprofile-operf/oprofile-operf-run.exp > @@ -115,23 +115,46 @@ proc oprofile-kallsyms-readable_run_tests {} { > > > #main > + > +# Check to see of opcontrol is installed. Need to do this first as > +# to set opcontrol_installed. If opcontrol is not installed, then we do > +# not make any opcontrol calls to do cleanup of exising opcontol data samples > +# or call --deinit when exiting. > + > +operf_get_version > + > +op_get_version > +if {$op_version == 0} { > + # could not find opcontrol > + set opcontrol_installed 0 > +} else { > + if {$op_version < $operf_version} { > + # Don't run the opcontrol tests if it is an earlier version > + set opcontrol_installed 0 > + } else { > + set opcontrol_installed 1 > + } > +} > + > check_user > if {$user_is_root == 0} { > send "\nYou must be root to run the operf --system-wide command.\n" > send "Will not run operf tests.\n" > } else { > > - operf_get_version > - > if { $operf_version == 0 } { > send "\nThe OProfile operf user tool is not supported. Will not run operf tests.\n" > } else { > # Ensure that the oprofile kernel module is unloaded, since it can > # interfere with proper operf operation on some platforms. > - local_exec "opcontrol --deinit" "" "" 100 > - # Make sure there are no samples from the opcontrol or operf laying > - # around that opreport might inadvertenly pick up. > - op_daemon_delete_any_samples > + if {$opcontrol_installed == 1} { > + local_exec "opcontrol --deinit" "" "" 100 > + # Make sure there are no samples from the opcontrol laying > + # around that opreport might inadvertenly pick up. > + op_daemon_delete_any_samples > + } > + # Make sure there are no samples from the operf laying > + # around that opreport might inadvertenly pick up. > operf_delete_samples > > oprofile-operf_run_tests > ------------------------------------------------------------------------------ Infragistics Professional Build stunning WinForms apps today! Reboot your WinForms applications with our WinForms controls. Build a bridge from your legacy apps to the future. http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk