[PATCH] Add some tests for option
Fei Jie
feij.fnst at cn.fujitsu.com
Wed Dec 16 09:23:54 UTC 2015
tests: add tests from option-F_001.test to option-F_006.test
*tests/option-F_001.c: New file.
*tests/option-F_001.test: Likewise.
*tests/option-F_001.expected: Likewise.
*tests/option-F_002.c: Likewise.
*tests/option-F_002.test: Likewise.
*tests/option-F_002.expected: Likewise.
*tests/option-F_003.test: Likewise.
*tests/option-F_003.expected: Likewise.
*tests/option-F_004.test: Likewise.
*tests/option-F_004.expected: Likewise.
*tests/option-F_005.test: Likewise.
*tests/option-F_005.expected: Likewise.
*tests/option-F_006.test: Likewise.
*tests/option-F_006.expected: Likewise.
* tests/Makefile.am (check_PROGRAMS): Add option-F_001 and option-F_002.
(TESTS): Add from option-F_001.test to option-F_006.test.
* tests/.gitignore: Add option-F_001 and option-F_002.
---
tests/.gitignore | 2 ++
tests/Makefile.am | 10 +++++++++-
tests/option-F_001.c | 22 ++++++++++++++++++++++
tests/option-F_001.expected | 2 ++
tests/option-F_001.test | 9 +++++++++
tests/option-F_002.c | 22 ++++++++++++++++++++++
tests/option-F_002.expected | 2 ++
tests/option-F_002.test | 9 +++++++++
tests/option-F_003.expected | 1 +
tests/option-F_003.test | 10 ++++++++++
tests/option-F_004.expected | 2 ++
tests/option-F_004.test | 9 +++++++++
tests/option-F_005.expected | 2 ++
tests/option-F_005.test | 9 +++++++++
tests/option-F_006.expected | 1 +
tests/option-F_006.test | 10 ++++++++++
16 files changed, 121 insertions(+), 1 deletion(-)
create mode 100644 tests/option-F_001.c
create mode 100644 tests/option-F_001.expected
create mode 100755 tests/option-F_001.test
create mode 100644 tests/option-F_002.c
create mode 100644 tests/option-F_002.expected
create mode 100755 tests/option-F_002.test
create mode 100644 tests/option-F_003.expected
create mode 100755 tests/option-F_003.test
create mode 100644 tests/option-F_004.expected
create mode 100755 tests/option-F_004.test
create mode 100644 tests/option-F_005.expected
create mode 100755 tests/option-F_005.test
create mode 100644 tests/option-F_006.expected
create mode 100755 tests/option-F_006.test
diff --git a/tests/.gitignore b/tests/.gitignore
index 5c5c572..4f059f6 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -89,6 +89,8 @@ xattr
xet_robust_list
xetitimer
xettimeofday
+option-F_001
+option-F_002
*.log
*.log.*
*.o
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 9ccd395..2599008 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -102,6 +102,8 @@ check_PROGRAMS = \
xet_robust_list \
xetitimer \
xettimeofday \
+ option-F_001 \
+ option-F_002 \
# end of check_PROGRAMS
clock_xettime_LDADD = -lrt
@@ -219,7 +221,13 @@ TESTS = \
detach-stopped.test \
detach-running.test \
restart_syscall.test \
- strace-k.test
+ strace-k.test \
+ option-F_001.test \
+ option-F_002.test \
+ option-F_003.test \
+ option-F_004.test \
+ option-F_005.test \
+ option-F_006.test
net-fd.log: net.log
diff --git a/tests/option-F_001.c b/tests/option-F_001.c
new file mode 100644
index 0000000..b507f5b
--- /dev/null
+++ b/tests/option-F_001.c
@@ -0,0 +1,22 @@
+#include <stdlib.h>
+#include <unistd.h>
+#include <stdio.h>
+
+#define MAGIC_STRING "CT&^%@"
+
+main()
+{
+ int pid = fork();
+ if (pid == -1) {
+ printf("fork failed\n");
+ exit(1);
+ }
+
+ if(pid){
+ printf("father" MAGIC_STRING "\n");
+ }else{
+ printf("child" MAGIC_STRING "\n" );
+ }
+ return 0;
+}
+
diff --git a/tests/option-F_001.expected b/tests/option-F_001.expected
new file mode 100644
index 0000000..002d33c
--- /dev/null
+++ b/tests/option-F_001.expected
@@ -0,0 +1,2 @@
+[0-9]* +write\(1, \"fatherCT&\^%@\\n\",.*
+[0-9]* +write\(1, \"childCT&\^%@\\n\",.*
diff --git a/tests/option-F_001.test b/tests/option-F_001.test
new file mode 100755
index 0000000..7938b9d
--- /dev/null
+++ b/tests/option-F_001.test
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+. "${srcdir=.}/init.sh"
+
+run_prog
+run_strace -F -f $args
+match_grep
+
+exit 0
diff --git a/tests/option-F_002.c b/tests/option-F_002.c
new file mode 100644
index 0000000..7b55d2a
--- /dev/null
+++ b/tests/option-F_002.c
@@ -0,0 +1,22 @@
+#include <stdlib.h>
+#include <unistd.h>
+#include <stdio.h>
+
+#define MAGIC_STRING "CT&^%@"
+
+main()
+{
+ int pid = vfork();
+ if (pid == -1) {
+ printf("fork failed\n");
+ exit(1);
+ }
+
+ if(pid){
+ printf("father" MAGIC_STRING "\n");
+ }else{
+ execlp("/bin/echo", "echo", "child" MAGIC_STRING, NULL);
+ }
+ return 0;
+}
+
diff --git a/tests/option-F_002.expected b/tests/option-F_002.expected
new file mode 100644
index 0000000..002d33c
--- /dev/null
+++ b/tests/option-F_002.expected
@@ -0,0 +1,2 @@
+[0-9]* +write\(1, \"fatherCT&\^%@\\n\",.*
+[0-9]* +write\(1, \"childCT&\^%@\\n\",.*
diff --git a/tests/option-F_002.test b/tests/option-F_002.test
new file mode 100755
index 0000000..7938b9d
--- /dev/null
+++ b/tests/option-F_002.test
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+. "${srcdir=.}/init.sh"
+
+run_prog
+run_strace -F -f $args
+match_grep
+
+exit 0
diff --git a/tests/option-F_003.expected b/tests/option-F_003.expected
new file mode 100644
index 0000000..5022237
--- /dev/null
+++ b/tests/option-F_003.expected
@@ -0,0 +1 @@
+[0-9]* +write\(1, \"CT&\^%@\\n\", 7\) += 7
diff --git a/tests/option-F_003.test b/tests/option-F_003.test
new file mode 100755
index 0000000..7d3752e
--- /dev/null
+++ b/tests/option-F_003.test
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+. "${srcdir=.}/init.sh"
+
+MAGIC_STRING="CT&^%@"
+
+run_strace -F echo "$MAGIC_STRING"
+match_grep
+
+exit 0
diff --git a/tests/option-F_004.expected b/tests/option-F_004.expected
new file mode 100644
index 0000000..002d33c
--- /dev/null
+++ b/tests/option-F_004.expected
@@ -0,0 +1,2 @@
+[0-9]* +write\(1, \"fatherCT&\^%@\\n\",.*
+[0-9]* +write\(1, \"childCT&\^%@\\n\",.*
diff --git a/tests/option-F_004.test b/tests/option-F_004.test
new file mode 100755
index 0000000..d583fad
--- /dev/null
+++ b/tests/option-F_004.test
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+. "${srcdir=.}/init.sh"
+
+run_prog ./option-F_001
+run_strace -F $args
+match_grep
+
+exit 0
diff --git a/tests/option-F_005.expected b/tests/option-F_005.expected
new file mode 100644
index 0000000..002d33c
--- /dev/null
+++ b/tests/option-F_005.expected
@@ -0,0 +1,2 @@
+[0-9]* +write\(1, \"fatherCT&\^%@\\n\",.*
+[0-9]* +write\(1, \"childCT&\^%@\\n\",.*
diff --git a/tests/option-F_005.test b/tests/option-F_005.test
new file mode 100755
index 0000000..dcc9168
--- /dev/null
+++ b/tests/option-F_005.test
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+. "${srcdir=.}/init.sh"
+
+run_prog ./option-F_002
+run_strace -F $args
+match_grep
+
+exit 0
diff --git a/tests/option-F_006.expected b/tests/option-F_006.expected
new file mode 100644
index 0000000..5022237
--- /dev/null
+++ b/tests/option-F_006.expected
@@ -0,0 +1 @@
+[0-9]* +write\(1, \"CT&\^%@\\n\", 7\) += 7
diff --git a/tests/option-F_006.test b/tests/option-F_006.test
new file mode 100755
index 0000000..7d3752e
--- /dev/null
+++ b/tests/option-F_006.test
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+. "${srcdir=.}/init.sh"
+
+MAGIC_STRING="CT&^%@"
+
+run_strace -F echo "$MAGIC_STRING"
+match_grep
+
+exit 0
--
1.8.3.1
More information about the Strace-devel
mailing list