blob: d2abed04b6ed4cacdf40ff5d832fb77758d9de93 [file] [log] [blame]
Dmitry V. Levin318b0dd2013-05-02 00:44:57 +00001#!/bin/sh
2
3# Check how ftruncate, lseek and stat family syscalls are traced.
4
5. "${srcdir=.}/init.sh"
6
7check_strace
8check_prog dd
9check_prog find
10check_prog grep
11check_prog rm
12check_prog timeout
13
14umask 022
15truncate_cmd='dd seek=46118400000 obs=1 count=0 if=/dev/null of=sample'
16$truncate_cmd > check.log 2>&1 ||
17 { cat check.log; framework_skip_ 'failed to create a large sparse file'; }
18rm -f sample
19
20timeout -s 9 $check_timeout \
21$STRACE -edesc $truncate_cmd 2>&1 > /dev/null 2> check.log &&
22LC_ALL=C grep -x 'ftruncate\(64\)\?(1, 46118400000) \+= 0' check.log > /dev/null ||
23 { cat check.log; fail_ 'strace -edesc failed to trace ftruncate/ftruncate64 properly'; }
24
25LC_ALL=C grep -x 'lseek(1, 46118400000, SEEK_CUR) \+= 46118400000\|_llseek(1, 46118400000, \[46118400000\], SEEK_CUR) \+= 0' check.log > /dev/null ||
26 { cat check.log; fail_ 'strace -edesc failed to trace lseek/_llseek properly'; }
27
28timeout -s 9 $check_timeout \
29$STRACE -efile find -L sample > /dev/null 2> check.log &&
30LC_ALL=C grep -x 'stat\(64\)\?("sample", {st_mode=S_IFREG|0644, st_size=46118400000, \.\.\.}) \+= 0' check.log > /dev/null ||
31 { cat check.log; fail_ 'strace -efile failed to trace stat/stat64 properly'; }
32
33timeout -s 9 $check_timeout \
34$STRACE -efile find sample > /dev/null 2> check.log &&
35LC_ALL=C grep '^[[:alnum:]_]*stat[[:alnum:]_]*([^()"]*"sample", {st_mode=S_IFREG|0644, st_size=46118400000, \.\.\.}' check.log > /dev/null ||
36 { cat check.log; fail_ 'strace -efile failed to trace newfstatat/fstatat64 properly'; }
37
38exit 0