[oprofile-testsuite PATCH 5/7] swizzle kptr_restrict logic

Will Schmidt <[email protected]>
Newsgroups gmane.linux.oprofile
Message-ID <[email protected]>
swizzle kptr_restrict logic

The kptr_restrict field is currently documented as holding one of
three values:
 # 0 - no restriction.
 # 1 - restricted.
 # 2 - addresses are zero'd out.

The existing tests that check the value of the kptr_restrict field
are obsolete in that they don't handle the restricted mode. After some
review and experimentation, simply removing the check simplifies the scripts
and allows more tests to run successfully.  Thus, remove the checks.

Signed-off-by: Will Schmidt <[email protected]>
---
 testsuite/oprofile-operf/oprofile-operf-run.exp |   28 +++--------------------
 1 file changed, 4 insertions(+), 24 deletions(-)

diff --git a/testsuite/oprofile-operf/oprofile-operf-run.exp b/testsuite/oprofile-operf/oprofile-operf-run.exp
index a6496be..c81f75e 100644
--- a/testsuite/oprofile-operf/oprofile-operf-run.exp
+++ b/testsuite/oprofile-operf/oprofile-operf-run.exp
@@ -55,17 +55,6 @@ proc oprofile-callgraph_run_tests {} {
     global op_event_table
 
     set cpu [operf_cpu_type]
-    set cmd "cat /proc/sys/kernel/kptr_restrict"
-    set kptr_restrict [ lindex [split [local_exec $cmd "" "" 10 ] "\{\}" ] 1 ]
-
-    if { $kptr_restrict > 1 } {
-        send "  The setting of /proc/sys/kernel/kptr_restrict is not 0 or 1.\n"
-        send "  Can not verify the kernel symbols were properly found in \n"
-        send "  /proc/kallsyms.\n"
-        send "\n"
-        send "  SKIPPING the callgraph option test\n"
-        send "\n"
-    } else {
 	if {$cpu == "bogus"} {
 	    send "Error, not able find cpu type exiting.\n"
 	} else {
@@ -78,27 +67,19 @@ proc oprofile-callgraph_run_tests {} {
 	    set spec [lindex $op_event_table($cpu) 0]
 	    do_single_process_test $spec $output_check $test_debug_option
 	}
-    }
 }
 
 proc oprofile-kallsyms-readable_run_tests {} {
-    # This test should be run as root as the default is to restrict users
-    # from getting the kernel addresses from kallsyms.  The test is done as
-    # a single process test to keep it simple.
+    # Under the deprecated opcontrol utility, this test would only be valid
+    # when run as root.  With the perf-events interface (oprofile 1.0 and
+    # newer), and when kptr_restrict set to permissive, it is
+    # now possible to get kernel symbol information as a normal user.
     global op_event_table
 
     set cpu [operf_cpu_type]
     set cmd "cat /proc/sys/kernel/kptr_restrict"
     set kptr_restrict [ lindex [split [local_exec $cmd "" "" 10 ] "\{\}" ] 1 ]
 
-    if { $kptr_restrict > 1 } {
-        send "  The setting of /proc/sys/kernel/kptr_restrict is not 0 or 1.\n"
-        send "  Can not verify the kernel symbols were properly found in \n"
-        send "  /proc/kallsyms.\n"
-        send "\n"
-        send "  SKIPPING the test to verify kallsyms was readable!!!\n"
-        send "\n"
-    } else {
 	if {$cpu == "bogus"} {
 	    send "Error, not able find cpu type exiting.\n"
 	} else {
@@ -110,7 +91,6 @@ proc oprofile-kallsyms-readable_run_tests {} {
 	    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
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.