From: Dmitry V. Levin Date: Tue, 13 Jan 2015 00:06:09 +0000 (+0000) Subject: tests: portability fixes X-Git-Tag: v4.10~204 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ed7ada24ac4647e56ce1bf3befbaec29a250cd38;p=strace tests: portability fixes * tests/stat.test: dd obs= is not portable, use bs= instead. * tests/stat32-v.test: Likewise. * tests/stat64-v.test: Likewise. * tests/net.test: Use $* instead of $@ in the quoted string. * tests/net-fd.test: Likewise. * tests/statfs.test: Quote { and } in regexps. * tests/caps.awk: Likewise. * tests/getdents.awk: Likewise. * tests/net-yy-accept.awk: Likewise. * tests/net-yy-connect.awk: Likewise. * tests/sigaction.awk: Likewise. * tests/unix-yy-accept.awk: Likewise. * tests/unix-yy-connect.awk: Likewise. --- diff --git a/tests/caps.awk b/tests/caps.awk index 9f992800..3db69c53 100644 --- a/tests/caps.awk +++ b/tests/caps.awk @@ -2,7 +2,7 @@ BEGIN { fail = 0 lines = 3 cap = "(0|CAP_[A-Z_]+(\\|CAP_[A-Z_]+)*)" - capget = "^capget\\({_LINUX_CAPABILITY_VERSION_3, 0}, {" cap ", " cap ", " cap "}\\) = 0$" + capget = "^capget\\(\\{_LINUX_CAPABILITY_VERSION_3, 0\\}, \\{" cap ", " cap ", " cap "\\}\\) = 0$" } NR == 1 {if (match($0, capget)) next} diff --git a/tests/getdents.awk b/tests/getdents.awk index 9e7b9682..686d578b 100644 --- a/tests/getdents.awk +++ b/tests/getdents.awk @@ -12,13 +12,13 @@ BEGIN { d_name2 = "d_name=\"\\.\\.\"" d_type = "d_type=DT_DIR" - d1_1 = "{" d_ino ", " d_off ", " d_reclen ", " d_name1 ", " d_type "}" - d1_2 = "{" d_ino ", " d_off ", " d_reclen ", " d_name2 ", " d_type "}" - d2_1 = "{" d_ino ", " d_off ", " d_reclen ", " d_type ", " d_name1 "}" - d2_2 = "{" d_ino ", " d_off ", " d_reclen ", " d_type ", " d_name2 "}" + d1_1 = "\\{" d_ino ", " d_off ", " d_reclen ", " d_name1 ", " d_type "\\}" + d1_2 = "\\{" d_ino ", " d_off ", " d_reclen ", " d_name2 ", " d_type "\\}" + d2_1 = "\\{" d_ino ", " d_off ", " d_reclen ", " d_type ", " d_name1 "\\}" + d2_2 = "\\{" d_ino ", " d_off ", " d_reclen ", " d_type ", " d_name2 "\\}" - getdents = "^getdents\\(" i ", {(" d1_1 " " d1_2 "|" d1_2 " " d1_1 ")}, " len "\\) += " len "$" - getdents64 = "^getdents64\\(" i ", {(" d2_1 " " d2_2 "|" d2_2 " " d2_1 ")}, " len "\\) += " len "$" + getdents = "^getdents\\(" i ", \\{(" d1_1 " " d1_2 "|" d1_2 " " d1_1 ")\\}, " len "\\) += " len "$" + getdents64 = "^getdents64\\(" i ", \\{(" d2_1 " " d2_2 "|" d2_2 " " d2_1 ")\\}, " len "\\) += " len "$" } NR == 1 {if (match($0, getdents) || match($0, getdents64)) next} diff --git a/tests/net-fd.test b/tests/net-fd.test index 8bbf7e73..4c24efda 100755 --- a/tests/net-fd.test +++ b/tests/net-fd.test @@ -33,7 +33,7 @@ grep_log() local syscall="$1"; shift local prefix='[1-9][0-9]* +[0-9]+:[0-9]+:[0-9]+\.[0-9]+ +' - LC_ALL=C grep -E -x "$prefix$syscall$@" $LOG > /dev/null || { + LC_ALL=C grep -E -x "$prefix$syscall$*" $LOG > /dev/null || { cat $LOG fail_ "strace -enetwork failed to trace \"$syscall\" properly" } diff --git a/tests/net-yy-accept.awk b/tests/net-yy-accept.awk index b3743ef2..35432772 100644 --- a/tests/net-yy-accept.awk +++ b/tests/net-yy-accept.awk @@ -5,8 +5,8 @@ BEGIN { r_i = "[1-9][0-9]*" r_port = "[1-9][0-9][0-9][0-9]+" r_localhost = "127\\.0\\.0\\.1" - r_bind = "^bind\\(0, {sa_family=AF_INET, sin_port=htons\\(0\\), sin_addr=inet_addr\\(\"" r_localhost "\"\\)}, " r_i "\\) += 0$" - r_getsockname = "^getsockname\\(0, {sa_family=AF_INET, sin_port=htons\\((" r_port ")\\), sin_addr=inet_addr\\(\"" r_localhost "\"\\)}, \\[" r_i "\\]\\) += 0$" + r_bind = "^bind\\(0, \\{sa_family=AF_INET, sin_port=htons\\(0\\), sin_addr=inet_addr\\(\"" r_localhost "\"\\)\\}, " r_i "\\) += 0$" + r_getsockname = "^getsockname\\(0, \\{sa_family=AF_INET, sin_port=htons\\((" r_port ")\\), sin_addr=inet_addr\\(\"" r_localhost "\"\\)\\}, \\[" r_i "\\]\\) += 0$" } NR == 1 && /^socket\(PF_INET, SOCK_STREAM, IPPROTO_IP\) += 0$/ {next} @@ -24,7 +24,7 @@ NR == 3 {if (r_listen != "" && match($0, r_listen)) next} NR == 4 { if (match($0, r_getsockname, a) && a[1] == a[2]) { port_l = a[1] - r_accept = "^accept\\(0, {sa_family=AF_INET, sin_port=htons\\((" r_port ")\\), sin_addr=inet_addr\\(\"" r_localhost "\"\\)}, \\[" r_i "\\]\\) += 1" r_localhost ":(" r_port ")\\]>$" + r_accept = "^accept\\(0, \\{sa_family=AF_INET, sin_port=htons\\((" r_port ")\\), sin_addr=inet_addr\\(\"" r_localhost "\"\\)\\}, \\[" r_i "\\]\\) += 1" r_localhost ":(" r_port ")\\]>$" r_close0 = "^close\\(0) += 0$" next } diff --git a/tests/net-yy-connect.awk b/tests/net-yy-connect.awk index 81ef47e6..67613666 100644 --- a/tests/net-yy-connect.awk +++ b/tests/net-yy-connect.awk @@ -5,7 +5,7 @@ BEGIN { r_i = "[1-9][0-9]*" r_port = "[1-9][0-9][0-9][0-9]+" r_localhost = "127\\.0\\.0\\.1" - r_connect = "^connect\\(0, {sa_family=AF_INET, sin_port=htons\\((" r_port ")\\), sin_addr=inet_addr\\(\"" r_localhost "\"\\)}, " r_i ") += 0$" + r_connect = "^connect\\(0, \\{sa_family=AF_INET, sin_port=htons\\((" r_port ")\\), sin_addr=inet_addr\\(\"" r_localhost "\"\\)\\}, " r_i ") += 0$" } NR == 1 && /^socket\(PF_INET, SOCK_STREAM, IPPROTO_IP\) += 0$/ {next} diff --git a/tests/net.test b/tests/net.test index a7944663..c0072713 100755 --- a/tests/net.test +++ b/tests/net.test @@ -28,7 +28,7 @@ grep_log() local syscall="$1"; shift local prefix='[1-9][0-9]* +[0-9]+:[0-9]+:[0-9]+\.[0-9]+ +' - LC_ALL=C grep -E -x "$prefix$syscall$@" $LOG > /dev/null || { + LC_ALL=C grep -E -x "$prefix$syscall$*" $LOG > /dev/null || { cat $LOG fail_ "strace -enetwork failed to trace \"$syscall\" properly" } diff --git a/tests/sigaction.awk b/tests/sigaction.awk index 08f49c3a..01133d29 100644 --- a/tests/sigaction.awk +++ b/tests/sigaction.awk @@ -15,24 +15,24 @@ BEGIN { } # Test 1. -NR == 1 && /^rt_sigaction\(SIGUSR2, {SIG_IGN, \[HUP INT\], SA_RESTORER\|SA_RESTART, 0x[0-9a-f]+}, {SIG_DFL, \[\], 0}, (0x[0-9a-f]+, )?(4|8|16)\) = 0$/ {next} -NR == 1 && /^rt_sigaction\(SIGUSR2, {SIG_IGN, \[HUP INT\], SA_RESTART}, {SIG_DFL, \[\], 0}, (4|8|16)(, 0x[0-9a-f]+)?\) = 0$/ {next} -NR == 1 && /^rt_sigaction\(SIGUSR2, {SIG_IGN, \[HUP INT\], SA_RESTART}, {SIG_DFL, \[\], 0}, 0x[0-9a-f]+, (4|8|16)\) = 0$/ {next} +NR == 1 && /^rt_sigaction\(SIGUSR2, \{SIG_IGN, \[HUP INT\], SA_RESTORER\|SA_RESTART, 0x[0-9a-f]+\}, \{SIG_DFL, \[\], 0\}, (0x[0-9a-f]+, )?(4|8|16)\) = 0$/ {next} +NR == 1 && /^rt_sigaction\(SIGUSR2, \{SIG_IGN, \[HUP INT\], SA_RESTART\}, \{SIG_DFL, \[\], 0\}, (4|8|16)(, 0x[0-9a-f]+)?\) = 0$/ {next} +NR == 1 && /^rt_sigaction\(SIGUSR2, \{SIG_IGN, \[HUP INT\], SA_RESTART\}, \{SIG_DFL, \[\], 0\}, 0x[0-9a-f]+, (4|8|16)\) = 0$/ {next} # Test 2. -NR == 2 && /^rt_sigaction\(SIGUSR2, {0x[0-9a-f]+, \[QUIT TERM\], SA_RESTORER\|SA_SIGINFO, 0x[0-9a-f]+}, {SIG_IGN, \[HUP INT\], SA_RESTORER\|SA_RESTART, 0x[0-9a-f]+}, (0x[0-9a-f]+, )?(4|8|16)\) = 0$/ {next} -NR == 2 && /^rt_sigaction\(SIGUSR2, {0x[0-9a-f]+, \[QUIT TERM\], SA_SIGINFO}, {SIG_IGN, \[HUP INT\], SA_RESTART}, (4|8|16)(, 0x[0-9a-f]+)?\) = 0$/ {next} -NR == 2 && /^rt_sigaction\(SIGUSR2, {0x[0-9a-f]+, \[QUIT TERM\], SA_SIGINFO}, {SIG_IGN, \[HUP INT\], SA_RESTART}, 0x[0-9a-f]+, (4|8|16)\) = 0$/ {next} +NR == 2 && /^rt_sigaction\(SIGUSR2, \{0x[0-9a-f]+, \[QUIT TERM\], SA_RESTORER\|SA_SIGINFO, 0x[0-9a-f]+\}, \{SIG_IGN, \[HUP INT\], SA_RESTORER\|SA_RESTART, 0x[0-9a-f]+\}, (0x[0-9a-f]+, )?(4|8|16)\) = 0$/ {next} +NR == 2 && /^rt_sigaction\(SIGUSR2, \{0x[0-9a-f]+, \[QUIT TERM\], SA_SIGINFO\}, \{SIG_IGN, \[HUP INT\], SA_RESTART\}, (4|8|16)(, 0x[0-9a-f]+)?\) = 0$/ {next} +NR == 2 && /^rt_sigaction\(SIGUSR2, \{0x[0-9a-f]+, \[QUIT TERM\], SA_SIGINFO\}, \{SIG_IGN, \[HUP INT\], SA_RESTART\}, 0x[0-9a-f]+, (4|8|16)\) = 0$/ {next} # Test 3. -NR == 3 && /^rt_sigaction\(SIGUSR2, {SIG_DFL, \[\], SA_RESTORER, 0x[0-9a-f]+}, {0x[0-9a-f]+, \[QUIT TERM\], SA_RESTORER\|SA_SIGINFO, 0x[0-9a-f]+}, (0x[0-9a-f]+, )?(4|8|16)\) = 0$/ {next} -NR == 3 && /^rt_sigaction\(SIGUSR2, {SIG_DFL, \[\], 0}, {0x[0-9a-f]+, \[QUIT TERM\], SA_SIGINFO}, (4|8|16)(, 0x[0-9a-f]+)?\) = 0$/ {next} -NR == 3 && /^rt_sigaction\(SIGUSR2, {SIG_DFL, \[\], 0}, {0x[0-9a-f]+, \[QUIT TERM\], SA_SIGINFO}, 0x[0-9a-f]+, (4|8|16)\) = 0$/ {next} +NR == 3 && /^rt_sigaction\(SIGUSR2, \{SIG_DFL, \[\], SA_RESTORER, 0x[0-9a-f]+\}, \{0x[0-9a-f]+, \[QUIT TERM\], SA_RESTORER\|SA_SIGINFO, 0x[0-9a-f]+\}, (0x[0-9a-f]+, )?(4|8|16)\) = 0$/ {next} +NR == 3 && /^rt_sigaction\(SIGUSR2, \{SIG_DFL, \[\], 0\}, \{0x[0-9a-f]+, \[QUIT TERM\], SA_SIGINFO\}, (4|8|16)(, 0x[0-9a-f]+)?\) = 0$/ {next} +NR == 3 && /^rt_sigaction\(SIGUSR2, \{SIG_DFL, \[\], 0\}, \{0x[0-9a-f]+, \[QUIT TERM\], SA_SIGINFO\}, 0x[0-9a-f]+, (4|8|16)\) = 0$/ {next} # Test 4. -NR == 4 && /^rt_sigaction\(SIGUSR2, {SIG_DFL, ~\[HUP( ((RT|SIGRT)[^] ]+|[3-9][0-9]|1[0-9][0-9]))*\], SA_RESTORER, 0x[0-9a-f]+}, {SIG_DFL, \[\], SA_RESTORER, 0x[0-9a-f]+}, (0x[0-9a-f]+, )?(4|8|16)\) = 0$/ {next} -NR == 4 && /^rt_sigaction\(SIGUSR2, {SIG_DFL, ~\[HUP( ((RT|SIGRT)[^] ]+|[3-9][0-9]|1[0-9][0-9]))*\], 0}, {SIG_DFL, \[\], 0}, (4|8|16)(, 0x[0-9a-f]+)?\) = 0$/ {next} -NR == 4 && /^rt_sigaction\(SIGUSR2, {SIG_DFL, ~\[HUP( ((RT|SIGRT)[^] ]+|[3-9][0-9]|1[0-9][0-9]))*\], 0}, {SIG_DFL, \[\], 0}, 0x[0-9a-f]+, (4|8|16)\) = 0$/ {next} +NR == 4 && /^rt_sigaction\(SIGUSR2, \{SIG_DFL, ~\[HUP( ((RT|SIGRT)[^] ]+|[3-9][0-9]|1[0-9][0-9]))*\], SA_RESTORER, 0x[0-9a-f]+\}, \{SIG_DFL, \[\], SA_RESTORER, 0x[0-9a-f]+\}, (0x[0-9a-f]+, )?(4|8|16)\) = 0$/ {next} +NR == 4 && /^rt_sigaction\(SIGUSR2, \{SIG_DFL, ~\[HUP( ((RT|SIGRT)[^] ]+|[3-9][0-9]|1[0-9][0-9]))*\], 0\}, \{SIG_DFL, \[\], 0\}, (4|8|16)(, 0x[0-9a-f]+)?\) = 0$/ {next} +NR == 4 && /^rt_sigaction\(SIGUSR2, \{SIG_DFL, ~\[HUP( ((RT|SIGRT)[^] ]+|[3-9][0-9]|1[0-9][0-9]))*\], 0\}, \{SIG_DFL, \[\], 0\}, 0x[0-9a-f]+, (4|8|16)\) = 0$/ {next} # The last line. NR == lines && /^\+\+\+ exited with 0 \+\+\+$/ {next} diff --git a/tests/stat.test b/tests/stat.test index b913c17a..ef57396e 100755 --- a/tests/stat.test +++ b/tests/stat.test @@ -15,7 +15,7 @@ sample=stat_sample rm -f $sample umask 022 -truncate_cmd="dd seek=$size obs=1 count=0 if=/dev/null of=$sample" +truncate_cmd="dd seek=$size bs=1 count=0 if=/dev/null of=$sample" $truncate_cmd > "$OUT" 2>&1 || { cat "$OUT" framework_skip_ 'failed to create a large sparse file' diff --git a/tests/stat32-v.test b/tests/stat32-v.test index 8c5f479d..7f8cb4a4 100755 --- a/tests/stat32-v.test +++ b/tests/stat32-v.test @@ -13,7 +13,7 @@ size=233811181 sample=stat32_sample umask 022 -truncate_cmd="dd seek=$size obs=1 count=0 if=/dev/null of=$sample" +truncate_cmd="dd seek=$size bs=1 count=0 if=/dev/null of=$sample" $truncate_cmd > "$OUT" 2>&1 || { cat "$OUT" framework_skip_ 'failed to create a large sparse file' diff --git a/tests/stat64-v.test b/tests/stat64-v.test index c7ebf49c..49153861 100755 --- a/tests/stat64-v.test +++ b/tests/stat64-v.test @@ -13,7 +13,7 @@ size=46118400000 sample=stat64_sample umask 022 -truncate_cmd="dd seek=$size obs=1 count=0 if=/dev/null of=$sample" +truncate_cmd="dd seek=$size bs=1 count=0 if=/dev/null of=$sample" $truncate_cmd > "$OUT" 2>&1 || { cat "$OUT" framework_skip_ 'failed to create a large sparse file' diff --git a/tests/statfs.test b/tests/statfs.test index 9c95989e..5b8cc972 100755 --- a/tests/statfs.test +++ b/tests/statfs.test @@ -29,6 +29,6 @@ grep_log() } } -grep_log 'statfs(64)?' '\("/proc/self/status"(, [1-9][0-9]*)?, {f_type="PROC_SUPER_MAGIC", f_bsize=[1-9][0-9]*, f_blocks=[0-9]+, f_bfree=[0-9]+, f_bavail=[0-9]+, f_files=[0-9]+, f_ffree=[0-9]+, f_fsid={[0-9]+, [0-9]+}, f_namelen=[1-9][0-9]*(, f_frsize=[0-9]+)?(, f_flags=[0-9]+)?}\) += 0' +grep_log 'statfs(64)?' '\("/proc/self/status"(, [1-9][0-9]*)?, \{f_type="PROC_SUPER_MAGIC", f_bsize=[1-9][0-9]*, f_blocks=[0-9]+, f_bfree=[0-9]+, f_bavail=[0-9]+, f_files=[0-9]+, f_ffree=[0-9]+, f_fsid=\{[0-9]+, [0-9]+\}, f_namelen=[1-9][0-9]*(, f_frsize=[0-9]+)?(, f_flags=[0-9]+)?\}\) += 0' exit 0 diff --git a/tests/unix-yy-accept.awk b/tests/unix-yy-accept.awk index 7f0a9cb8..304c0229 100644 --- a/tests/unix-yy-accept.awk +++ b/tests/unix-yy-accept.awk @@ -4,7 +4,7 @@ BEGIN { addrlen = length(addr) + 3 r_i = "[1-9][0-9]*" - r_bind = "^bind\\(0, {sa_family=AF_(LOCAL|UNIX|FILE), sun_path=\"" addr "\"}, " addrlen "\\) += 0$" + r_bind = "^bind\\(0, \\{sa_family=AF_(LOCAL|UNIX|FILE), sun_path=\"" addr "\"\\}, " addrlen "\\) += 0$" } NR == 1 && /^socket\(PF_(LOCAL|UNIX|FILE), SOCK_STREAM, 0\) += 0$/ {next} @@ -13,8 +13,8 @@ NR == 2 { if (match($0, r_bind, a)) { inode_listen = a[1] r_listen = "^listen\\(0, 5\\) += 0$" - r_getsockname = "^getsockname\\(0, {sa_family=AF_(LOCAL|UNIX|FILE), sun_path=\"" addr "\"}, \\[" addrlen "\\]\\) += 0$" - r_accept = "^accept\\(0, {sa_family=AF_(LOCAL|UNIX|FILE), NULL}, \\[2\\]\\) += 1(" r_i "),\"" addr "\"\\]>" + r_getsockname = "^getsockname\\(0, \\{sa_family=AF_(LOCAL|UNIX|FILE), sun_path=\"" addr "\"\\}, \\[" addrlen "\\]\\) += 0$" + r_accept = "^accept\\(0, \\{sa_family=AF_(LOCAL|UNIX|FILE), NULL\\}, \\[2\\]\\) += 1(" r_i "),\"" addr "\"\\]>" next } } diff --git a/tests/unix-yy-connect.awk b/tests/unix-yy-connect.awk index 5610192c..bbbcff91 100644 --- a/tests/unix-yy-connect.awk +++ b/tests/unix-yy-connect.awk @@ -5,7 +5,7 @@ BEGIN { r_i = "[1-9][0-9]*" r_close_listen = "^close\\(0\\) += 0$" - r_connect = "^connect\\(1, {sa_family=AF_(LOCAL|UNIX|FILE), sun_path=\"" addr "\"}, " addrlen "\\) += 0$" + r_connect = "^connect\\(1, \\{sa_family=AF_(LOCAL|UNIX|FILE), sun_path=\"" addr "\"\\}, " addrlen "\\) += 0$" } NR == 1 && /^socket\(PF_(LOCAL|UNIX|FILE), SOCK_STREAM, 0\) += 1$/ {next}