This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: [PATCH 1/3] add testcases for function definitions
- From: David Smith <dsmith at redhat dot com>
- To: Josh Stone <jistone at redhat dot com>, Zhou Wenjian <zhouwj-fnst at cn dot fujitsu dot com>, systemtap at sourceware dot org
- Date: Mon, 9 Nov 2015 15:24:32 -0600
- Subject: Re: [PATCH 1/3] add testcases for function definitions
- Authentication-results: sourceware.org; auth=none
- References: <1447059456-19811-1-git-send-email-zhouwj-fnst at cn dot fujitsu dot com> <5640E0EE dot 2060803 at redhat dot com>
On 11/09/2015 12:07 PM, 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)+"
Ah, I didn't know it did that.
> '+' 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.)
Hmm, having repetitions of the all_pass_string *should* work, but
doesn't. My guess would be that this used to work on older versions of
tcl/expect, but doesn't work now. The end-of-line handling has always
been iffy in tcl/expect.
> 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.
That's a good idea. I'll try to look into it in the near future.
> 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.
>
>
--
David Smith
dsmith@redhat.com
Red Hat
http://www.redhat.com
256.217.0141 (direct)
256.837.0057 (fax)