[PATCH 1/4] tests: add option_d_r.test

Zhou Wenjian zhouwj-fnst at cn.fujitsu.com
Wed Mar 23 08:56:36 UTC 2016


* tests/option_d_r.c: New file.
* tests/option_d_r.expected: New file.
* tests/option_d_r.test: New test.
* tests/.gitignore: Add option_d_r.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(TESTS): Add option_d_r.test.
---
 tests/.gitignore          |  1 +
 tests/Makefile.am         |  2 ++
 tests/option_d_r.c        | 39 +++++++++++++++++++++++++++++++++++++++
 tests/option_d_r.expected |  6 ++++++
 tests/option_d_r.test     | 10 ++++++++++
 5 files changed, 58 insertions(+)
 create mode 100644 tests/option_d_r.c
 create mode 100644 tests/option_d_r.expected
 create mode 100755 tests/option_d_r.test

diff --git a/tests/.gitignore b/tests/.gitignore
index 449af18..6669e2e 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -151,3 +151,4 @@ xetitimer
 xetpgid
 xetpriority
 xettimeofday
+option_d_r
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 3005382..fbfe8b9 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -199,6 +199,7 @@ check_PROGRAMS = \
 	xetpgid \
 	xetpriority \
 	xettimeofday \
+	option_d_r \
 	# end of check_PROGRAMS
 
 attach_f_p_LDADD = -lrt -lpthread $(LDADD)
@@ -378,6 +379,7 @@ TESTS = \
 	opipe.test \
 	redirect.test \
 	restart_syscall.test \
+	option_d_r.test \
 	$(LIBUNWIND_TESTS)
 
 XFAIL_TESTS_ =
diff --git a/tests/option_d_r.c b/tests/option_d_r.c
new file mode 100644
index 0000000..a69ffb0
--- /dev/null
+++ b/tests/option_d_r.c
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2016 Zhou Wenjian <zhouwj-fnst at cn.fujitsu.com>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "tests.h"
+#include <assert.h>
+#include <unistd.h>
+
+int
+main()
+{
+        int pid = fork();
+	assert(pid != -1);
+        return 0;
+}
+
diff --git a/tests/option_d_r.expected b/tests/option_d_r.expected
new file mode 100644
index 0000000..cf9b583
--- /dev/null
+++ b/tests/option_d_r.expected
@@ -0,0 +1,6 @@
+.*/strace: new tcb for pid [0-9]*, active tcbs:1
+.*/strace: pid [0-9]* has TCB_STARTUP, initializing it
+.*/strace: new tcb for pid [0-9]*, active tcbs:2
+.*/strace: dropped tcb for pid [0-9]*, 1 remain
+.*/strace: dropped tcb for pid [0-9]*, 0 remain
+^.*0.[0-9] execve.*
diff --git a/tests/option_d_r.test b/tests/option_d_r.test
new file mode 100755
index 0000000..2d97727
--- /dev/null
+++ b/tests/option_d_r.test
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+# Check option -d -r.
+
+. "${srcdir=.}/init.sh"
+
+run_prog
+$STRACE -d -f -r $args 2> $LOG
+match_grep
+exit 0
-- 
1.8.3.1







More information about the Strace-devel mailing list