[PATCH v2] tests/stat: support fstatat syscall for stat()

Chris Metcalf cmetcalf at tilera.com
Mon May 6 15:21:13 UTC 2013


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.

Signed-off-by: Chris Metcalf <cmetcalf at tilera.com>
---
 tests/stat |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tests/stat b/tests/stat
index 5fe0b86..0c1b804 100755
--- a/tests/stat
+++ b/tests/stat
@@ -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
-- 
1.7.10.3





More information about the Strace-devel mailing list