From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 111486 invoked by alias); 9 Nov 2015 22:21:38 -0000 Mailing-List: contact systemtap-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: systemtap-owner@sourceware.org Received: (qmail 111478 invoked by uid 89); 9 Nov 2015 22:21:37 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.8 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Mon, 09 Nov 2015 22:21:36 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id 857C18E233; Mon, 9 Nov 2015 22:21:35 +0000 (UTC) Received: from [10.3.113.207] (ovpn-113-207.phx2.redhat.com [10.3.113.207]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id tA9MLYSB003771; Mon, 9 Nov 2015 17:21:35 -0500 Subject: Re: [PATCH 1/3] add testcases for function definitions To: David Smith , Zhou Wenjian , systemtap@sourceware.org References: <1447059456-19811-1-git-send-email-zhouwj-fnst@cn.fujitsu.com> <5640E0EE.2060803@redhat.com> <56410F10.20104@redhat.com> From: Josh Stone Message-ID: <56411C6E.9090706@redhat.com> Date: Mon, 09 Nov 2015 22:21:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <56410F10.20104@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2015-q4/txt/msg00100.txt.bz2 On 11/09/2015 01:24 PM, David Smith wrote: > 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. It depends on how things get buffered, and I don't think you can rely on this to be consistent. If two success lines get presented at once, then '+' will gobble them both. If they're presented one at a time, then '+' will eat one and be satisfied, then the second line is left unconsumed. On the other hand, if "(systemtap test success\r\n){2}" gets them buffered separately, the first time will try and fail to get a complete match. Then IIRC expect will append the second line to the buffer and try all matches again, and "{2}" will now match. It might be better if we figured out how to process this line-by-line, instead of a big multiline regex. We already had to bump stap_run's exp_match_max to 8192 to cope with this kind of problem. But any large change here might have a wide effect across the testsuite callers... A simpler (untested) idea: stap_run could just add some final output to anchor the end of the regex, like -E 'probe final { println("EOF") }'. This can anchor the end of the regex, like "systemtap ending probe" is anchoring the beginning. Then little else has to change in the tests. The '+' above has to be followed by literal EOF or it's not a match. ("probe final" doesn't exist yet, but think opposite of "probe init", alias "probe final = end(INT64_MAX)", perhaps covering error too.) ((bikeshed: perhaps init/fini are a better pair.))