public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* Systemtap testsuite running on test machines
@ 2008-01-04 21:26 William Cohen
  2008-01-04 23:59 ` Frank Ch. Eigler
  0 siblings, 1 reply; 2+ messages in thread
From: William Cohen @ 2008-01-04 21:26 UTC (permalink / raw)
  To: SystemTAP

[-- Attachment #1: Type: text/plain, Size: 1569 bytes --]

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

[-- Attachment #2: as_root.diff --]
[-- Type: text/x-patch, Size: 7363 bytes --]

? 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}*]}
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Systemtap testsuite running on test machines
  2008-01-04 21:26 Systemtap testsuite running on test machines William Cohen
@ 2008-01-04 23:59 ` Frank Ch. Eigler
  0 siblings, 0 replies; 2+ messages in thread
From: Frank Ch. Eigler @ 2008-01-04 23:59 UTC (permalink / raw)
  To: William Cohen; +Cc: SystemTAP


wcohen wrote:

> [...]  1) Assumptions about sudo operating [...]

Your patch and suggestions look good, please commit.

- FChE

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-01-04 23:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-04 21:26 Systemtap testsuite running on test machines William Cohen
2008-01-04 23:59 ` Frank Ch. Eigler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).