]> sourceware.org Git - systemtap.git/commitdiff
PR11405: Warn and continue for parsing errors in tapsets
authorJosh Stone <jistone@redhat.com>
Sat, 20 Mar 2010 19:29:37 +0000 (12:29 -0700)
committerJosh Stone <jistone@redhat.com>
Sat, 20 Mar 2010 19:29:37 +0000 (12:29 -0700)
When we start seeing tapsets provided by third parties, any errors in
their files should not be fatal to us.  Since we don't really know which
tapsets are our own, this leniency applies to all.

* main.cxx (main): Warn on tapset errors, but continue unless -W.
* testsuite/parseko/bad_tapset/foo.stp: New bogus tapset.
* testsuite/parseko/bad_tapset.stp: Check that "-W -I bad_tapset" fails.
* testsuite/parseok/bad_tapset.stp: Check that "-I bad_tapset" succeeds.
* testsuite/parseok/all_tapsets.stp: Check -W with the default tapsets.

main.cxx
testsuite/parseko/bad_tapset.stp [new file with mode: 0755]
testsuite/parseko/bad_tapset/foo.stp [new file with mode: 0644]
testsuite/parseok/all_tapsets.stp [new file with mode: 0755]
testsuite/parseok/bad_tapset.stp [new file with mode: 0755]

index dd2694ae9b0fcd2a2455cbccfbdd01323a2d80bd..5f746efd2cb6b5c035b1f756b0e8a0903c144fb4 100644 (file)
--- a/main.cxx
+++ b/main.cxx
@@ -1261,7 +1261,8 @@ main (int argc, char * const argv [])
               // XXX: privilege only for /usr/share/systemtap?
               stapfile* f = parser::parse (s, globbuf.gl_pathv[j], true);
               if (f == 0)
-                rc ++;
+                s.print_warning("tapset '" + string(globbuf.gl_pathv[j])
+                                + "' has errors, and will be skipped.");
               else
                 s.library_files.push_back (f);
 
@@ -1281,6 +1282,8 @@ main (int argc, char * const argv [])
           globfree (& globbuf);
         }
     }
+  if (s.num_errors())
+    rc ++;
 
   if (rc == 0 && s.last_pass == 1)
     {
diff --git a/testsuite/parseko/bad_tapset.stp b/testsuite/parseko/bad_tapset.stp
new file mode 100755 (executable)
index 0000000..bd15577
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# PR11405: with -W, bad tapsets should still be an error
+
+TAPSET=`dirname $0`/bad_tapset/
+stap -p1 -e 'probe begin {}' -I $TAPSET -W
diff --git a/testsuite/parseko/bad_tapset/foo.stp b/testsuite/parseko/bad_tapset/foo.stp
new file mode 100644 (file)
index 0000000..c4c7725
--- /dev/null
@@ -0,0 +1,2 @@
+# this is an intentional syntax error for testing PR11405
+probe foo = .bar {}
diff --git a/testsuite/parseok/all_tapsets.stp b/testsuite/parseok/all_tapsets.stp
new file mode 100755 (executable)
index 0000000..1777cc1
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+# PR11405: all the default tapsets should succeed even with -W
+
+stap -p1 -e 'probe begin {}' -W
diff --git a/testsuite/parseok/bad_tapset.stp b/testsuite/parseok/bad_tapset.stp
new file mode 100755 (executable)
index 0000000..a97c037
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# PR11405: without -W, bad tapsets will be warned but shouldn't be an error
+
+TAPSET=`dirname $0`/../parseko/bad_tapset/
+stap -p1 -e 'probe begin {}' -I $TAPSET
This page took 0.031434 seconds and 5 git commands to generate.