[PATCH 2/2] [TAKE 3] Testcase For str_replace()

Frank Ch. Eigler fche@redhat.com
Thu Jun 18 15:04:00 GMT 2009


Varun Chandramohan <varunc@linux.vnet.ibm.com> writes:

> This patch adds the test case needed for this function. [...]
> +spawn stap -DMAXERRORS=2 $srcdir/$subdir/$test.stp
> +expect {
> +   -timeout 15
> +   -re {ERROR: Invalid Search String} { incr ko; exp_continue }
> +   -re {WARNING: Number of errors} { incr ko ; exp_continue }
> +   -re {Result = hello pointer tap} { incr ok ; exp_continue }
> +   -re {Result = pointer system tap} { incr ok ; exp_continue }
> +   -re {Result = hello system pointer} { incr ok ; exp_continue }
> [...]

One nit: your search strings are not regular expressions, so you
wouldn't normally use "-re" there.

However, I've had cases where I had to use -re anyway, forcing precise
line-begin/end matches, so that multiple output lines in expect's
input buffer aren't matched (=> consumed) by just a single regexp
line.  This is what all those wacky regexps are for.  Maybe you need
these too.

e.g., systemtap.base/skipped.exp: 

   -re {^WARNING: Number of errors: 0, skipped probes: [0-9]+\r\n} { incr ok; exp_continue }


- FChE



More information about the Systemtap mailing list