]> granicus.if.org Git - strace/commitdiff
tests/stat: support fstatat syscall for stat()
authorChris Metcalf <cmetcalf@tilera.com>
Mon, 6 May 2013 15:21:13 +0000 (11:21 -0400)
committerDmitry V. Levin <ldv@altlinux.org>
Mon, 6 May 2013 18:47:50 +0000 (18:47 +0000)
Newer Linux architectures don't support the stat/stat64 syscalls.
Instead they use fstatat() with AT_FDCWD and an extra flags argument.
Support seeing this output in the 'strace -efile' test.

As part of this change, use "grep -E -x" syntax consistently for
all stat tests, since the number of \(foo\)\? expressions was becoming
pretty unwieldy.

* tests/stat: Update stat/stat64 check regexp to handle architectures
that use fstatat instead.  Use "grep -E -x" syntax consistently.

Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
tests/stat

index 5fe0b866786936b8f53c8a5d1bb7c55e2b2aac79..0c1b8043ab6597554314be86cf40f70fa8065e11 100755 (executable)
@@ -19,20 +19,20 @@ rm -f sample
 
 timeout -s 9 $check_timeout \
 $STRACE -edesc $truncate_cmd 2>&1 > /dev/null 2> check.log &&
-LC_ALL=C grep -x 'ftruncate\(64\)\?(1, 46118400000) \+= 0' check.log > /dev/null ||
+LC_ALL=C grep -E -x 'ftruncate(64)?\(1, 46118400000\) += 0' check.log > /dev/null ||
        { cat check.log; fail_ 'strace -edesc failed to trace ftruncate/ftruncate64 properly'; }
 
-LC_ALL=C grep -x 'lseek(1, 46118400000, SEEK_CUR) \+= 46118400000\|_llseek(1, 46118400000, \[46118400000\], SEEK_CUR) \+= 0' check.log > /dev/null ||
+LC_ALL=C grep -E -x 'lseek\(1, 46118400000, SEEK_CUR\) += 46118400000|_llseek\(1, 46118400000, \[46118400000\], SEEK_CUR\) += 0' check.log > /dev/null ||
        { cat check.log; fail_ 'strace -edesc failed to trace lseek/_llseek properly'; }
 
 timeout -s 9 $check_timeout \
 $STRACE -efile find -L sample > /dev/null 2> check.log &&
-LC_ALL=C grep -x 'stat\(64\)\?("sample", {st_mode=S_IFREG|0644, st_size=46118400000, \.\.\.}) \+= 0' check.log > /dev/null ||
+LC_ALL=C grep -E -x 'f?stat(at)?(64)?\((AT_FDCWD, )?"sample", [{]st_mode=S_IFREG\|0644, st_size=46118400000, \.\.\.}(, 0)?\) += 0' check.log > /dev/null ||
        { cat check.log; fail_ 'strace -efile failed to trace stat/stat64 properly'; }
 
 timeout -s 9 $check_timeout \
 $STRACE -efile find sample > /dev/null 2> check.log &&
-LC_ALL=C grep '^[[:alnum:]_]*stat[[:alnum:]_]*([^()"]*"sample", {st_mode=S_IFREG|0644, st_size=46118400000, \.\.\.}' check.log > /dev/null ||
+LC_ALL=C grep -E -x '[[:alnum:]_]*stat[[:alnum:]_]*\([^()"]*"sample", [{]st_mode=S_IFREG\|0644, st_size=46118400000, \.\.\.}.*' check.log > /dev/null ||
        { cat check.log; fail_ 'strace -efile failed to trace newfstatat/fstatat64 properly'; }
 
 rm -f sample