diff options
author | David Smith <dsmith@redhat.com> | 2009-10-29 16:12:18 -0500 |
---|---|---|
committer | David Smith <dsmith@redhat.com> | 2009-10-29 16:12:18 -0500 |
commit | 49e20063710b1d5dbb4efeb53d751b684835413c (patch) | |
tree | 2e8f68e8f5a60bb765b1b535660ab362e85571d9 /testsuite | |
parent | d855fc1db953a049b953d0c987f93a252232e6f2 (diff) | |
download | systemtap-steved-49e20063710b1d5dbb4efeb53d751b684835413c.tar.gz systemtap-steved-49e20063710b1d5dbb4efeb53d751b684835413c.tar.xz systemtap-steved-49e20063710b1d5dbb4efeb53d751b684835413c.zip |
Fix syscall testsuite bugs.
* testsuite/systemtap.syscall/test.tcl: Substitute '[[[[' and ']]]]' for
'(' and ')'. This allows us to get unquoted parens.
* testsuite/systemtap.syscall/test-debug.tcl: Matches substitute logic of
test.tcl.
* testsuite/systemtap.syscall/README: Document '[[[[' and ']]]]'.
* testsuite/systemtap.syscall/chmod.c: Handle optional O_LARGEFILE flag in
open calls.
* testsuite/systemtap.syscall/dir.c: Ditto.
* testsuite/systemtap.syscall/mmap.c: Ditto.
* testsuite/systemtap.syscall/openclose.c: Ditto.
* testsuite/systemtap.syscall/readwrite.c: Ditto.
* testsuite/systemtap.syscall/stat.c: Ditto.
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/systemtap.syscall/README | 3 | ||||
-rw-r--r-- | testsuite/systemtap.syscall/chmod.c | 2 | ||||
-rw-r--r-- | testsuite/systemtap.syscall/dir.c | 4 | ||||
-rw-r--r-- | testsuite/systemtap.syscall/mmap.c | 4 | ||||
-rw-r--r-- | testsuite/systemtap.syscall/openclose.c | 18 | ||||
-rw-r--r-- | testsuite/systemtap.syscall/readwrite.c | 4 | ||||
-rw-r--r-- | testsuite/systemtap.syscall/stat.c | 2 | ||||
-rwxr-xr-x | testsuite/systemtap.syscall/test-debug.tcl | 11 | ||||
-rwxr-xr-x | testsuite/systemtap.syscall/test.tcl | 6 |
9 files changed, 37 insertions, 17 deletions
diff --git a/testsuite/systemtap.syscall/README b/testsuite/systemtap.syscall/README index 480bd8cd..836ac747 100644 --- a/testsuite/systemtap.syscall/README +++ b/testsuite/systemtap.syscall/README @@ -18,6 +18,9 @@ is expected, put "NNNN" (for decimal) or "XXXX" (for hex). Or you can just write regular expressions. The "NNNN" and "XXXX" are just shorthand to aid readability and are converted to regular expressions in test.tcl. +Normally opening and closing parentheses ('(' and ')') get quoted. If +you want unquoted parentheses, use '[[[[' (for '(') or ']]]]' (for ')'). + 3. Somewhere is your test program puts a comment line like this: /* COVERAGE: syscall1 syscall2 ... */ where you list the systemcalls that are tested. Then you can run diff --git a/testsuite/systemtap.syscall/chmod.c b/testsuite/systemtap.syscall/chmod.c index 724b86c4..ce18b3d0 100644 --- a/testsuite/systemtap.syscall/chmod.c +++ b/testsuite/systemtap.syscall/chmod.c @@ -11,7 +11,7 @@ int main() int fd; fd = open("foobar",O_WRONLY|O_CREAT, 0666); - //staptest// open ("foobar", O_WRONLY|O_CREAT, 0666) = NNNN + //staptest// open ("foobar", O_WRONLY|O_CREAT[[[[.O_LARGEFILE]]]]?, 0666) = NNNN chmod("foobar", 0644); //staptest// chmod ("foobar", 0644) diff --git a/testsuite/systemtap.syscall/dir.c b/testsuite/systemtap.syscall/dir.c index 3eda8175..f5b9f320 100644 --- a/testsuite/systemtap.syscall/dir.c +++ b/testsuite/systemtap.syscall/dir.c @@ -20,7 +20,7 @@ int main() //staptest// chdir ("..") = 0 fd = open("foobar", O_RDONLY); - //staptest// open ("foobar", O_RDONLY) = NNNN + //staptest// open ("foobar", O_RDONLY[[[[.O_LARGEFILE]]]]?) = NNNN fchdir(fd); //staptest// fchdir (NNNN) = 0 @@ -35,7 +35,7 @@ int main() //staptest// rmdir ("foobar") = 0 fd = open(".", O_RDONLY); - //staptest// open (".", O_RDONLY) = NNNN + //staptest// open (".", O_RDONLY[[[[.O_LARGEFILE]]]]?) = NNNN #ifdef SYS_mkdirat mkdirat(fd, "xyzzy", 0765); diff --git a/testsuite/systemtap.syscall/mmap.c b/testsuite/systemtap.syscall/mmap.c index 13145fb2..a09888b4 100644 --- a/testsuite/systemtap.syscall/mmap.c +++ b/testsuite/systemtap.syscall/mmap.c @@ -13,14 +13,14 @@ int main() /* create a file with something in it */ fd = open("foobar",O_WRONLY|O_CREAT|O_TRUNC, 0600); - //staptest// open ("foobar", O_WRONLY|O_CREAT|O_TRUNC, 0600) = NNNN + //staptest// open ("foobar", O_WRONLY|O_CREAT[[[[.O_LARGEFILE]]]]?|O_TRUNC, 0600) = NNNN lseek(fd, 1024, SEEK_SET); write(fd, "abcdef", 6); close(fd); //staptest// close (NNNN) = 0 fd = open("foobar", O_RDONLY); - //staptest// open ("foobar", O_RDONLY) = NNNN + //staptest// open ("foobar", O_RDONLY[[[[.O_LARGEFILE]]]]?) = NNNN /* stat for file size */ ret = fstat(fd, &fs); diff --git a/testsuite/systemtap.syscall/openclose.c b/testsuite/systemtap.syscall/openclose.c index cb003a9e..aeabbe19 100644 --- a/testsuite/systemtap.syscall/openclose.c +++ b/testsuite/systemtap.syscall/openclose.c @@ -13,46 +13,46 @@ int main() int fd1, fd2; fd2 = creat("foobar1",S_IREAD|S_IWRITE); - //staptest// open ("foobar1", O_WRONLY|O_CREAT|O_TRUNC, 0600) = NNNN + //staptest// open ("foobar1", O_WRONLY|O_CREAT[[[[.O_LARGEFILE]]]]?|O_TRUNC, 0600) = NNNN fd1 = open("foobar2",O_WRONLY|O_CREAT, S_IRWXU); - //staptest// open ("foobar2", O_WRONLY|O_CREAT, 0700) = NNNN + //staptest// open ("foobar2", O_WRONLY|O_CREAT[[[[.O_LARGEFILE]]]]?, 0700) = NNNN close(fd1); //staptest// close (NNNN) = 0 fd1 = open("foobar2",O_RDONLY); - //staptest// open ("foobar2", O_RDONLY) = NNNN + //staptest// open ("foobar2", O_RDONLY[[[[.O_LARGEFILE]]]]?) = NNNN close(fd1); //staptest// close (NNNN) = 0 fd1 = open("foobar2",O_RDWR); - //staptest// open ("foobar2", O_RDWR) = NNNN + //staptest// open ("foobar2", O_RDWR[[[[.O_LARGEFILE]]]]?) = NNNN close(fd1); //staptest// close (NNNN) = 0 fd1 = open("foobar2",O_APPEND|O_WRONLY); - //staptest// open ("foobar2", O_WRONLY|O_APPEND) = NNNN + //staptest// open ("foobar2", O_WRONLY|O_APPEND[[[[.O_LARGEFILE]]]]?) = NNNN close(fd1); //staptest// close (NNNN) = 0 fd1 = open("foobar2",O_DIRECT|O_RDWR); - //staptest// open ("foobar2", O_RDWR|O_DIRECT) = NNNN + //staptest// open ("foobar2", O_RDWR|O_DIRECT[[[[.O_LARGEFILE]]]]?) = NNNN close(fd1); //staptest// close (NNNN) = 0 fd1 = open("foobar2",O_NOATIME|O_SYNC|O_RDWR); - //staptest// open ("foobar2", O_RDWR|O_NOATIME|O_SYNC) = NNNN + //staptest// open ("foobar2", O_RDWR[[[[.O_LARGEFILE]]]]?|O_NOATIME|O_SYNC) = NNNN close(fd1); //staptest// close (NNNN) = 0 /* Now test some bad opens */ fd1 = open("/",O_WRONLY); - //staptest// open ("/", O_WRONLY) = -NNNN (EISDIR) + //staptest// open ("/", O_WRONLY[[[[.O_LARGEFILE]]]]?) = -NNNN (EISDIR) close (fd1); //staptest// close (NNNN) = -NNNN (EBADF) fd1 = open("foobar2",O_WRONLY|O_CREAT|O_EXCL, S_IRWXU); - //staptest// open ("foobar2", O_WRONLY|O_CREAT|O_EXCL, 0700) = -NNNN (EEXIST) + //staptest// open ("foobar2", O_WRONLY|O_CREAT|O_EXCL[[[[.O_LARGEFILE]]]]?, 0700) = -NNNN (EEXIST) return 0; } diff --git a/testsuite/systemtap.syscall/readwrite.c b/testsuite/systemtap.syscall/readwrite.c index bd0914cc..d966c0a8 100644 --- a/testsuite/systemtap.syscall/readwrite.c +++ b/testsuite/systemtap.syscall/readwrite.c @@ -26,7 +26,7 @@ int main() v[2].iov_len = sizeof(STRING3); fd = open("foobar1",O_WRONLY|O_CREAT, 0666); - //staptest// open ("foobar1", O_WRONLY|O_CREAT, 0666) = NNNN + //staptest// open ("foobar1", O_WRONLY|O_CREAT[[[[.O_LARGEFILE]]]]?, 0666) = NNNN write(fd,"Hello world", 11); //staptest// write (NNNN, "Hello world", 11) = 11 @@ -66,7 +66,7 @@ int main() close (fd); fd = open("foobar1",O_RDONLY); - //staptest// open ("foobar1", O_RDONLY) = NNNN + //staptest// open ("foobar1", O_RDONLY[[[[.O_LARGEFILE]]]]?) = NNNN read(fd, buf, 11); //staptest// read (NNNN, XXXX, 11) = 11 diff --git a/testsuite/systemtap.syscall/stat.c b/testsuite/systemtap.syscall/stat.c index d47c1440..20a66b09 100644 --- a/testsuite/systemtap.syscall/stat.c +++ b/testsuite/systemtap.syscall/stat.c @@ -20,7 +20,7 @@ int main() //staptest// getcwd (XXXX, 128) = NNNN fd = creat("foobar",S_IREAD|S_IWRITE); - //staptest// open ("foobar", O_WRONLY|O_CREAT|O_TRUNC, 0600) = NNNN + //staptest// open ("foobar", O_WRONLY|O_CREAT[[[[.O_LARGEFILE]]]]?|O_TRUNC, 0600) = NNNN fstat(fd, &sbuf); //staptest// fstat (NNNN, XXXX) = 0 diff --git a/testsuite/systemtap.syscall/test-debug.tcl b/testsuite/systemtap.syscall/test-debug.tcl index eb730459..3eb6bbf0 100755 --- a/testsuite/systemtap.syscall/test-debug.tcl +++ b/testsuite/systemtap.syscall/test-debug.tcl @@ -50,9 +50,20 @@ foreach line [split $output "\n"] { if {[regsub {//} $line {} line]} { set line "$testname: [string trimleft $line]" + # We need to quote all these metacharacters regsub -all {\(} $line {\\(} line regsub -all {\)} $line {\\)} line regsub -all {\|} $line {\|} line + # + and * are metacharacters, but should always be used + # as metacharacters in the expressions, don't escape them. + #regsub -all {\+} $line {\\+} line + #regsub -all {\*} $line {\\*} line + + # Turn '[[[[' and ']]]]' into '(' and ')' respectively. + # Because normally parens get quoted, this allows us to + # have non-quoted parens. + regsub -all {\[\[\[\[} $line {(} line + regsub -all {\]\]\]\]} $line {)} line regsub -all NNNN $line {[\-0-9]+} line regsub -all XXXX $line {[x0-9a-fA-F]+} line diff --git a/testsuite/systemtap.syscall/test.tcl b/testsuite/systemtap.syscall/test.tcl index b9d3c0d9..e640db66 100755 --- a/testsuite/systemtap.syscall/test.tcl +++ b/testsuite/systemtap.syscall/test.tcl @@ -67,6 +67,12 @@ proc run_one_test {filename flags bits} { #regsub -all {\+} $line {\\+} line #regsub -all {\*} $line {\\*} line + # Turn '[[[[' and ']]]]' into '(' and ')' respectively. + # Because normally parens get quoted, this allows us to + # have non-quoted parens. + regsub -all {\[\[\[\[} $line {(} line + regsub -all {\]\]\]\]} $line {)} line + regsub -all NNNN $line {[\-0-9]+} line regsub -all XXXX $line {[x0-9a-fA-F]+} line |