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]

Re: [PATCH 1/3] add testcases for function definitions


On 11/10/2015 02:07 AM, Josh Stone wrote:
On 11/09/2015 12:57 AM, Zhou Wenjian wrote:
+foreach runtime [get_runtime_list] {
+    if {$runtime != ""} {
+	stap_run $srcdir/$subdir/$test.stp no_load ${all_pass_string}${all_pass_string}${all_pass_string}${all_pass_string}${all_pass_string} \
+	    --runtime=$runtime
+    } else {
+	stap_run $srcdir/$subdir/$test.stp no_load ${all_pass_string}${all_pass_string}${all_pass_string}${all_pass_string}${all_pass_string}
+    }
+}

I disagree with using repetition like this for "exact" results.  The
string already has regex repetition built in:

   set all_pass_string "(systemtap test success\r\n)+"

'+' means match one or more, greedily.  Repeating this expression on top
of itself creates a bad case for the regex engine to backtrack.
(It will work, but slowly.)


IMO we ought to make stap_run ensure nothing comes *after* the expected
output string.  If there are tests that are legitimately printing more
output, those are the ones we should be fixing.

Maybe we could also add the string without repetition, something like:

   set pass_string "systemtap test success\r\n"
   set all_pass_string "($pass_string)+"

Then you can use "($pass_string){5}" if you really want exactly 5
matches.  But stap_run should still make sure nothing comes after that.



I think either of them is enough to generate the correct result.
Why should stap_run still make sure nothing comes after matching
the exact output?

And between them, I prefer matching the exact output.

To make sure nothing comes, we have to modify all cases which use the
stap_run. I don't think it's a good idea that modifying the cases which
are working well.

--
Thanks
Zhou


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