[PATCH] Oprofile-testsuite, skip mode selection tests if not supported.

Carl Love <[email protected]>
Newsgroups gmane.linux.oprofile
Message-ID <[email protected]>
Event counts may occur when the system is running in user mode, kernel
mode or hypervisor modes.  Some architectures have settings that allow
the user to select which modes the events should be collected.  The
testsuite contains tests to make sure sum of counting in each of the modes
individually is the same as counting in the modes simultaneously.  This
patch skips these tests for architectures that do not support mode selection

Signed-off-by: Carl Love <[email protected]>
---
 testsuite/lib/ocount_util.exp            |   71 ++++++++++++++++++++++++++++++
 testsuite/oprofile-ocount/ocount-run.exp |   16 +++++++
 2 files changed, 87 insertions(+), 0 deletions(-)

diff --git a/testsuite/lib/ocount_util.exp b/testsuite/lib/ocount_util.exp
index c8913f2..1a1d46a 100644
--- a/testsuite/lib/ocount_util.exp
+++ b/testsuite/lib/ocount_util.exp
@@ -196,3 +196,74 @@ proc ocount_get_version {} {
     operf_ocount_get_version "ocount"
     set ocount_version $operf_ocount_version
 }
+
+proc arch_does_not_support_exclusive_mode_settings {} {
+    set arch [lindex [split [local_exec "ophelp --get-cpu-type" "" "" 10] "\{" ] 1]
+
+    # Event counts may occur when the system is running in user mode, kernel
+    # mode or hypervisor modes.  Some architectures have settings that allow
+    # the user to select which modes the events should be collected in.  Return
+    # 1 if the architecture being tested does not support selecting the mode
+    # to collect the counts in, otherwise, return 0.
+
+    # The cpu "pretty" descriptions strings come from:
+    #    static struct cpu_descr const cpu_descrs[MAX_CPU_TYPE]  
+    # in op_cpu_type.c.
+
+    ## ARM
+    if {[ regexp "ARM/XScale PMU1" $arch ] == 1 } {  # arm/xcale1
+        return  1
+    }
+
+    if {[ regexp "ARM/XScale PMU2" $arch ] == 1 } {  # arm/xscale2
+        return  1
+    }
+
+    if {[ regexp "ARM 11MPCore" $arch ] == 1 } {  # arm/mpcore
+        return  1
+    }
+
+    if {[ regexp "ARM V6 PMU" $arch ] == 1 } {  # arm/armv6
+        return  1
+    }
+
+    if {[ regexp "ARM Cortex-A8" $arch ] == 1 } {  # arm/armv7
+        return  1
+    }
+
+    if {[ regexp "ARM Cortex-A9" $arch ] == 1 } {  # arm/armv7-ca9
+        return  1
+    }
+
+    if {[ regexp "ARMv7 Scorpion" $arch ] == 1 } {  # arm/armv7-scorpion
+        return  1
+    }
+
+    if {[ regexp "ARMv7 ScorpionMP" $arch ] == 1 } {  # arm/armv7-scorpionmp
+        return  1
+    }
+
+    if {[ regexp "ARMv7 Scorpion" $arch ] == 1 } {  # arm/armv7-scorpion
+        return  1
+    }
+
+    if {[ regexp "ARM Cortex-A5" $arch ] == 1 } {  # arm/armv7-ca5
+        return  1
+    }
+
+
+    ## IBM
+    if {[ regexp "IBM System z10" $arch ] == 1 } {  # s390/z10
+        return  1
+    }
+
+    if {[ regexp "IBM zEnterprise z196" $arch ] == 1 } {  # s390/z196
+        return  1
+    }
+
+    if {[ regexp "IBM zEnterprise EC12" $arch ] == 1 } {  # s390/zEC12
+        return  1
+    }
+
+    return 0
+}
diff --git a/testsuite/oprofile-ocount/ocount-run.exp b/testsuite/oprofile-ocount/ocount-run.exp
index 9c75fda..4e8b484 100644
--- a/testsuite/oprofile-ocount/ocount-run.exp
+++ b/testsuite/oprofile-ocount/ocount-run.exp
@@ -157,6 +157,22 @@ proc do_test_ocount_scaling {workload_exec} {
 proc do_test_ocount_modes {workload_exec} {
     global ocount_version
 
+    # The test assumes the architecture supports counting in user and 
+    # kernel modes unless the architecture is explicitly listed in function
+    # arch_does_not_support_exclusive_mode_settings{}.
+
+    # This test counts the events that occur in user mode, then for kernel
+    # mode.  The test then counts the number of events when both modes are
+    # selected.  The count with both modes selected is then compared to the
+    # sum of the counts when each mode was counted individually to see if
+    # they agree.  
+    if {[arch_does_not_support_exclusive_mode_settings] == 1} {
+        send "\nNote: Architecture is in list of architectures that"
+        send " do not support User mode and Kernel\n"
+        send "mode selection.  Skipping mode scaling tests.  \n\n"
+        return 
+    }
+
     # The actual result is expected to be within the following percent of the
     # actual count
     set percent 5
-- 
1.7.1




------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.