This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Systemtap testsuite running on test machines


Looked over the test results run for systemtap 0.5.14 on the test
system as described by (http://fedoraproject.org/wiki/QA/Beaker). This
is a bit different than running the tests as a developer; the test
system start with stock system installed from scratch (e.g. RHEL5),
then the systemtap source rpm and appropriate
kernel-debug/kernel-devel rpms are obtained from the appropriate
places and installed. The systemtap testsuite is run on the systemtap
installed via rpm. Noticed the two following issues with the tests run
in this environment:

1) Assumptions about sudo operating
2) stap_merge not available



Assumptions about sudo

There are tests in the systemtap testsuite that use sudo. In newer
RHEL and Fedora distributions the default /etc/sudoers file has an
option that only allows sudoer to be user from a tty:

Defaults requiretty

The following 0.5.14 tests fail on the test system due to things being run as
root but without a tty:

FAIL: backtrace - could not build modules
FAIL: args - could not build modules
FAIL: pid - could not build modules

The newer versions of systemtap use sudo in more places. The tests are
already run as root on the test system. The sudo should only be used
when it is required, to avoid using the default configuration problem
with /etc/sudoers.  The attached as_root.diff attempts to deal with
this. Do people have comments about this patch's approach?

stap_merge availability

Because stap_merge is not available to the testsuite the following script
did not run:

testsuite/systemtap.printf/end1b.exp ...


-Will
? as_root.diff
Index: testsuite/lib/systemtap.exp
===================================================================
RCS file: /cvs/systemtap/src/testsuite/lib/systemtap.exp,v
retrieving revision 1.10
diff -U2 -u -r1.10 systemtap.exp
--- testsuite/lib/systemtap.exp	12 Dec 2007 16:16:50 -0000	1.10
+++ testsuite/lib/systemtap.exp	4 Jan 2008 16:38:51 -0000
@@ -112,2 +112,13 @@
     }
 }
+
+proc as_root { command } {
+
+     set effective_pid [exec /usr/bin/id -u]
+
+     if {$effective_pid != 0} {
+	 set command "sudo $command"
+     }
+     set res [catch {eval exec $command} value]
+     return  $res
+ }
Index: testsuite/systemtap.context/context.exp
===================================================================
RCS file: /cvs/systemtap/src/testsuite/systemtap.context/context.exp,v
retrieving revision 1.5
diff -U2 -u -r1.5 context.exp
--- testsuite/systemtap.context/context.exp	27 Aug 2007 14:20:35 -0000	1.5
+++ testsuite/systemtap.context/context.exp	4 Jan 2008 16:38:51 -0000
@@ -14,6 +14,6 @@
     catch {send "\003"}
     foreach n {1 2} {
-	catch {exec sudo /bin/rm -f /lib/modules/$::uname/kernel/systemtap_test_module$n.ko}
-	catch {exec sudo /sbin/rmmod systemtap_test_module$n}
+	as_root  [list /bin/rm -f /lib/modules/$::uname/kernel/systemtap_test_module$n.ko]
+	as_root [list /sbin/rmmod systemtap_test_module$n]
     }
     if {$build_dir != ""} {exec rm -rf $build_dir}
@@ -47,5 +47,6 @@
 	    return 0
 	}
-	if {[catch {exec sudo cp systemtap_test_module$n.ko /lib/modules/$::uname/kernel} res]} {
+	set res [as_root  [list cp systemtap_test_module$n.ko /lib/modules/$::uname/kernel]]
+	if { $res != 0 } {
 	    puts $res
 	    cd $old_dir
@@ -54,5 +55,5 @@
     }
     foreach n {2 1} {
-	catch {exec sudo /sbin/insmod systemtap_test_module$n.ko}
+	as_root [list /sbin/insmod systemtap_test_module$n.ko]
     }
     cd $old_dir
Index: testsuite/systemtap.printf/end1b.exp
===================================================================
RCS file: /cvs/systemtap/src/testsuite/systemtap.printf/end1b.exp,v
retrieving revision 1.4
diff -U2 -u -r1.4 end1b.exp
--- testsuite/systemtap.printf/end1b.exp	15 Aug 2007 13:54:36 -0000	1.4
+++ testsuite/systemtap.printf/end1b.exp	4 Jan 2008 16:38:51 -0000
@@ -25,5 +25,5 @@
     untested $TEST_NAME
     puts "stap failed: $res"
-    catch {eval [list exec sudo /bin/rm -f] [glob ${tmpfile}*]}
+    as_root {/bin/rm -f [glob ${tmpfile}*]}
     return
 }
@@ -32,5 +32,5 @@
     puts "merge failed: $res"
     fail "$TEST_NAME failed"
-    catch {eval [list exec sudo /bin/rm -f] [glob ${tmpfile}*]}
+    as_root {/bin/rm -f [glob ${tmpfile}*]}
     return
 }
@@ -39,9 +39,9 @@
     puts "$res"
     fail "$TEST_NAME failed"
-    catch {eval [list exec sudo /bin/rm -f] [glob ${tmpfile}*]}
+    as_root {/bin/rm -f [glob ${tmpfile}*]}
     return
 }
 
 pass "$TEST_NAME passed"
-catch {eval [list exec sudo /bin/rm -f] [glob ${tmpfile}*]}
+as_root {/bin/rm -f [glob ${tmpfile}*]}
 
Index: testsuite/systemtap.printf/mixed_outb.exp
===================================================================
RCS file: /cvs/systemtap/src/testsuite/systemtap.printf/mixed_outb.exp,v
retrieving revision 1.4
diff -U2 -u -r1.4 mixed_outb.exp
--- testsuite/systemtap.printf/mixed_outb.exp	15 Aug 2007 13:54:37 -0000	1.4
+++ testsuite/systemtap.printf/mixed_outb.exp	4 Jan 2008 16:38:51 -0000
@@ -25,5 +25,5 @@
     untested $TEST_NAME
     puts "stap failed: $res"
-    catch {eval [list exec sudo /bin/rm -f] [glob ${tmpfile}*]}
+    as_root {/bin/rm -f [glob ${tmpfile}*]}
     return
 }
@@ -32,5 +32,5 @@
     puts "merge failed: $res"
     fail "$TEST_NAME failed"
-    catch {eval [list exec sudo /bin/rm -f] [glob ${tmpfile}*]}
+    as_root {/bin/rm -f [glob ${tmpfile}*]}
     return
 }
@@ -39,9 +39,9 @@
     puts "$res"
     fail "$TEST_NAME failed"
-    catch {eval [list exec sudo /bin/rm -f] [glob ${tmpfile}*]}
+    as_root {/bin/rm -f [glob ${tmpfile}*]}
     return
 }
 
 pass "$TEST_NAME passed"
-catch {eval [list exec sudo /bin/rm -f] [glob ${tmpfile}*]}
+as_root {/bin/rm -f [glob ${tmpfile}*]}
 
Index: testsuite/systemtap.printf/out1b.exp
===================================================================
RCS file: /cvs/systemtap/src/testsuite/systemtap.printf/out1b.exp,v
retrieving revision 1.4
diff -U2 -u -r1.4 out1b.exp
--- testsuite/systemtap.printf/out1b.exp	15 Aug 2007 13:54:37 -0000	1.4
+++ testsuite/systemtap.printf/out1b.exp	4 Jan 2008 16:38:51 -0000
@@ -25,5 +25,5 @@
     untested $TEST_NAME
     puts "stap failed: $res"
-    catch {eval [list exec sudo /bin/rm -f] [glob ${tmpfile}*]}
+    as_root {/bin/rm -f [glob ${tmpfile}*]}
     return
 }
@@ -32,5 +32,5 @@
     puts "merge failed: $res"
     fail "$TEST_NAME failed"
-    catch {eval [list exec sudo /bin/rm -f] [glob ${tmpfile}*]}
+    as_root {/bin/rm -f [glob ${tmpfile}*]}
     return
 }
@@ -39,9 +39,9 @@
     puts "$res"
     fail "$TEST_NAME failed"
-    catch {eval [list exec sudo /bin/rm -f] [glob ${tmpfile}*]}
+    as_root {/bin/rm -f [glob ${tmpfile}*]}
     return
 }
 
 pass "$TEST_NAME passed"
-catch {eval [list exec sudo /bin/rm -f] [glob ${tmpfile}*]}
+as_root {/bin/rm -f [glob ${tmpfile}*]}
 
Index: testsuite/systemtap.printf/out2b.exp
===================================================================
RCS file: /cvs/systemtap/src/testsuite/systemtap.printf/out2b.exp,v
retrieving revision 1.4
diff -U2 -u -r1.4 out2b.exp
--- testsuite/systemtap.printf/out2b.exp	15 Aug 2007 13:54:37 -0000	1.4
+++ testsuite/systemtap.printf/out2b.exp	4 Jan 2008 16:38:51 -0000
@@ -25,5 +25,5 @@
     untested $TEST_NAME
     puts "stap failed: $res"
-    catch {eval [list exec sudo /bin/rm -f] [glob ${tmpfile}*]}
+    as_root {/bin/rm -f [glob ${tmpfile}*]}
     return
 }
@@ -32,5 +32,5 @@
     puts "merge failed: $res"
     fail "$TEST_NAME failed"
-    catch {eval [list exec sudo /bin/rm -f] [glob ${tmpfile}*]}
+    as_root {/bin/rm -f [glob ${tmpfile}*]}
     return
 }
@@ -39,9 +39,9 @@
     puts "$res"
     fail "$TEST_NAME failed"
-    catch {eval [list exec sudo /bin/rm -f] [glob ${tmpfile}*]}
+    as_root {/bin/rm -f [glob ${tmpfile}*]}
     return
 }
 
 pass "$TEST_NAME passed"
-catch {eval [list exec sudo /bin/rm -f] [glob ${tmpfile}*]}
+as_root {/bin/rm -f [glob ${tmpfile}*]}
 
Index: testsuite/systemtap.printf/out3b.exp
===================================================================
RCS file: /cvs/systemtap/src/testsuite/systemtap.printf/out3b.exp,v
retrieving revision 1.4
diff -U2 -u -r1.4 out3b.exp
--- testsuite/systemtap.printf/out3b.exp	15 Aug 2007 13:54:37 -0000	1.4
+++ testsuite/systemtap.printf/out3b.exp	4 Jan 2008 16:38:51 -0000
@@ -25,5 +25,5 @@
     untested $TEST_NAME
     puts "stap failed: $res"
-    catch {eval [list exec sudo /bin/rm -f] [glob ${tmpfile}*]}
+    as_root {/bin/rm -f [glob ${tmpfile}*]}
     return
 }
@@ -32,5 +32,5 @@
     puts "merge failed: $res"
     fail "$TEST_NAME failed"
-    catch {eval [list exec sudo /bin/rm -f] [glob ${tmpfile}*]}
+    as_root {/bin/rm -f [glob ${tmpfile}*]}
     return
 }
@@ -39,9 +39,9 @@
     puts "$res"
     fail "$TEST_NAME failed"
-    catch {eval [list exec sudo /bin/rm -f] [glob ${tmpfile}*]}
+    as_root {/bin/rm -f [glob ${tmpfile}*]}
     return
 }
 
 pass "$TEST_NAME passed"
-catch {eval [list exec sudo /bin/rm -f] [glob ${tmpfile}*]}
+as_root {/bin/rm -f [glob ${tmpfile}*]}
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]