]> granicus.if.org Git - strace/commitdiff
tests: portability fixes
authorDmitry V. Levin <ldv@altlinux.org>
Tue, 13 Jan 2015 00:06:09 +0000 (00:06 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Tue, 13 Jan 2015 00:33:56 +0000 (00:33 +0000)
* 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.

13 files changed:
tests/caps.awk
tests/getdents.awk
tests/net-fd.test
tests/net-yy-accept.awk
tests/net-yy-connect.awk
tests/net.test
tests/sigaction.awk
tests/stat.test
tests/stat32-v.test
tests/stat64-v.test
tests/statfs.test
tests/unix-yy-accept.awk
tests/unix-yy-connect.awk

index 9f99280053ffaf6dd4911d2b0e8ea65de5afb8a8..3db69c53f592b63f52e3b00ad8ad71bae7077acf 100644 (file)
@@ -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}
index 9e7b968247799671767a94a00f4c571d2dc2a2db..686d578b0840e0093ee5c4372e6386fb5044e4a2 100644 (file)
@@ -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}
index 8bbf7e73d918a213ffb975bdae69b3330b4eef0c..4c24efdaad46eabf541a81bc268739061bdf6bfe 100755 (executable)
@@ -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"
        }
index b3743ef2aa64a73dc9b4f5fd47eabefd5cee98c5..354327723039a9b9f31630d3147577e0ccb1d746 100644 (file)
@@ -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<TCP:\\[(" r_i ")\\]>, {sa_family=AF_INET, sin_port=htons\\(0\\), sin_addr=inet_addr\\(\"" r_localhost "\"\\)}, " r_i "\\) += 0$"
-  r_getsockname = "^getsockname\\(0<TCP:\\[" r_localhost ":(" r_port ")\\]>, {sa_family=AF_INET, sin_port=htons\\((" r_port ")\\), sin_addr=inet_addr\\(\"" r_localhost "\"\\)}, \\[" r_i "\\]\\) += 0$"
+  r_bind = "^bind\\(0<TCP:\\[(" r_i ")\\]>, \\{sa_family=AF_INET, sin_port=htons\\(0\\), sin_addr=inet_addr\\(\"" r_localhost "\"\\)\\}, " r_i "\\) += 0$"
+  r_getsockname = "^getsockname\\(0<TCP:\\[" r_localhost ":(" r_port ")\\]>, \\{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<TCP:\\[" r_localhost ":" port_l "\\]>, {sa_family=AF_INET, sin_port=htons\\((" r_port ")\\), sin_addr=inet_addr\\(\"" r_localhost "\"\\)}, \\[" r_i "\\]\\) += 1<TCP:\\[" r_localhost ":" port_l "->" r_localhost ":(" r_port ")\\]>$"
+    r_accept = "^accept\\(0<TCP:\\[" r_localhost ":" port_l "\\]>, \\{sa_family=AF_INET, sin_port=htons\\((" r_port ")\\), sin_addr=inet_addr\\(\"" r_localhost "\"\\)\\}, \\[" r_i "\\]\\) += 1<TCP:\\[" r_localhost ":" port_l "->" r_localhost ":(" r_port ")\\]>$"
     r_close0 = "^close\\(0<TCP:\\[" r_localhost ":" port_l "\\]>) += 0$"
     next
   }
index 81ef47e6f105dc09f73028bb59b4127abbe0f15b..67613666d03f9a501cfb76cbcabdaab17a7fb2b3 100644 (file)
@@ -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<TCP:\\[" r_i "\\]>, {sa_family=AF_INET, sin_port=htons\\((" r_port ")\\), sin_addr=inet_addr\\(\"" r_localhost "\"\\)}, " r_i ") += 0$"
+  r_connect = "^connect\\(0<TCP:\\[" r_i "\\]>, \\{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}
index a794466379d54a7f7921743c6a81a7f0672ee7c1..c0072713b3fabcb88788815e37bf45fc2b7ed9e7 100755 (executable)
@@ -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"
        }
index 08f49c3ab3c092e079c535f5fbc504a989252b83..01133d29e8e020b17485827bb7b2bb0b16d00664 100644 (file)
@@ -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}
index b913c17ae2d5d93200a6016670707f3ae3bc5068..ef57396e4328feebb6fe9b202286f8b9aa91cd0d 100755 (executable)
@@ -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'
index 8c5f479d019398ce9ff20404ba70cce1a1c590fa..7f8cb4a4b8da0c540fab91c1d6960dfb3c787f33 100755 (executable)
@@ -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'
index c7ebf49cf9dfd2b24ae886abcae9fe575639bf84..49153861a16936041117113fed3bea525c99d879 100755 (executable)
@@ -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'
index 9c95989e2c79cccfaf054556872d9bd57f977c77..5b8cc972a7d410142c45a872656c9b15b83b37ac 100755 (executable)
@@ -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
index 7f0a9cb82b848a3740cb6c70fb588f8131ec0730..304c022901103b2983382c6bcb03d3433c31500b 100644 (file)
@@ -4,7 +4,7 @@ BEGIN {
 
   addrlen = length(addr) + 3
   r_i = "[1-9][0-9]*"
-  r_bind = "^bind\\(0<UNIX:\\[(" r_i ")\\]>, {sa_family=AF_(LOCAL|UNIX|FILE), sun_path=\"" addr "\"}, " addrlen "\\) += 0$"
+  r_bind = "^bind\\(0<UNIX:\\[(" r_i ")\\]>, \\{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<UNIX:\\[" inode_listen ",\"" addr "\"\\]>, 5\\) += 0$"
-    r_getsockname = "^getsockname\\(0<UNIX:\\[" inode_listen ",\"" addr "\"\\]>, {sa_family=AF_(LOCAL|UNIX|FILE), sun_path=\"" addr "\"}, \\[" addrlen "\\]\\) += 0$"
-    r_accept = "^accept\\(0<UNIX:\\[" inode_listen ",\"" addr "\"\\]>, {sa_family=AF_(LOCAL|UNIX|FILE), NULL}, \\[2\\]\\) += 1<UNIX:\\[(" r_i ")->(" r_i "),\"" addr "\"\\]>"
+    r_getsockname = "^getsockname\\(0<UNIX:\\[" inode_listen ",\"" addr "\"\\]>, \\{sa_family=AF_(LOCAL|UNIX|FILE), sun_path=\"" addr "\"\\}, \\[" addrlen "\\]\\) += 0$"
+    r_accept = "^accept\\(0<UNIX:\\[" inode_listen ",\"" addr "\"\\]>, \\{sa_family=AF_(LOCAL|UNIX|FILE), NULL\\}, \\[2\\]\\) += 1<UNIX:\\[(" r_i ")->(" r_i "),\"" addr "\"\\]>"
     next
   }
 }
index 5610192cffd1308e9feb23d87d77fd38e09e3c5e..bbbcff910e576284d0a227d3000e408b3dd1a4fa 100644 (file)
@@ -5,7 +5,7 @@ BEGIN {
 
   r_i = "[1-9][0-9]*"
   r_close_listen = "^close\\(0<UNIX:[" r_i ",\"" addr "\"]>\\) += 0$"
-  r_connect = "^connect\\(1<UNIX:\\[(" r_i ")\\]>, {sa_family=AF_(LOCAL|UNIX|FILE), sun_path=\"" addr "\"}, " addrlen "\\) += 0$"
+  r_connect = "^connect\\(1<UNIX:\\[(" r_i ")\\]>, \\{sa_family=AF_(LOCAL|UNIX|FILE), sun_path=\"" addr "\"\\}, " addrlen "\\) += 0$"
 }
 
 NR == 1 && /^socket\(PF_(LOCAL|UNIX|FILE), SOCK_STREAM, 0\) += 1$/ {next}