[CRIU] [RFC PATCHv2 25/32] zdtm: lib: export some internals of libzdtmtst

Ivan Shapovalov intelfx at intelfx.name
Sat Mar 12 00:42:24 PST 2016


Signed-off-by: Ivan Shapovalov <intelfx at intelfx.name>
---
 test/zdtm/lib/parseargs.c        |  6 +++---
 test/zdtm/lib/test.c             |  6 +++++-
 test/zdtm/lib/zdtmtst.h          |  3 +++
 test/zdtm/lib/zdtmtst_internal.h | 12 ++++++++++++
 4 files changed, 23 insertions(+), 4 deletions(-)
 create mode 100644 test/zdtm/lib/zdtmtst_internal.h

diff --git a/test/zdtm/lib/parseargs.c b/test/zdtm/lib/parseargs.c
index 7e411f6..71b3593 100644
--- a/test/zdtm/lib/parseargs.c
+++ b/test/zdtm/lib/parseargs.c
@@ -6,7 +6,7 @@
 
 #include "zdtmtst.h"
 
-static struct long_opt *opt_head;
+struct long_opt *opt_head;
 
 static int help;
 TEST_OPTION(help, bool, "print help message and exit", 0);
@@ -88,7 +88,7 @@ int parse_opt_string(char *param, void *arg)
 	return 0;
 }
 
-static void printopt(const struct long_opt *opt)
+void print_opt(const struct long_opt *opt)
 {
 	const char *obracket = "", *cbracket = "";
 
@@ -108,7 +108,7 @@ static void helpexit(void)
 	fputs("Usage:\n", stderr);
 
 	for (opt = opt_head; opt; opt = opt->next)
-		printopt(opt);
+		print_opt(opt);
 
 	exit(1);
 }
diff --git a/test/zdtm/lib/test.c b/test/zdtm/lib/test.c
index 62608e8..82b04df 100644
--- a/test/zdtm/lib/test.c
+++ b/test/zdtm/lib/test.c
@@ -32,7 +32,7 @@ TEST_OPTION(outfile, string, "output file", 1);
 char *pidfile;
 TEST_OPTION(pidfile, string, "file to store pid", 1);
 
-static pid_t master_pid = 0;
+pid_t master_pid = 0;
 
 int test_fork_id(int id)
 {
@@ -261,3 +261,7 @@ void test_waitsig(void)
 {
 	futex_wait_while(&sig_received, 0);
 }
+
+void test_report(int ok)
+{
+}
diff --git a/test/zdtm/lib/zdtmtst.h b/test/zdtm/lib/zdtmtst.h
index c49d5a1..506b2f4 100644
--- a/test/zdtm/lib/zdtmtst.h
+++ b/test/zdtm/lib/zdtmtst.h
@@ -38,6 +38,8 @@ extern void test_msg(const char *format, ...);
 extern int test_go(void);
 /* sleep until SIGTERM is delivered */
 extern void test_waitsig(void);
+/* report the test result (apart from logging PASS or FAIL) */
+extern void test_report(int result);
 
 #include <stdint.h>
 
@@ -67,6 +69,7 @@ struct long_opt {
 };
 
 extern void __push_opt(struct long_opt *opt);
+extern void print_opt(const struct long_opt *opt);
 
 #define TEST_OPTION(name, type, doc, is_required)				\
 	param_check_##type(name, &(name));					\
diff --git a/test/zdtm/lib/zdtmtst_internal.h b/test/zdtm/lib/zdtmtst_internal.h
new file mode 100644
index 0000000..c0c90fc
--- /dev/null
+++ b/test/zdtm/lib/zdtmtst_internal.h
@@ -0,0 +1,12 @@
+#ifndef _ZDTMTST_INTERNAL_H_
+#define _ZDTMTST_INTERNAL_H_
+
+#include <sys/types.h>
+
+/* current options array */
+extern struct long_opt *opt_head;
+
+/* our main pid, i. e. right after forking in test_init() */
+extern pid_t master_pid;
+
+#endif /* _ZDTMTST_INTERNAL_H_ */
-- 
2.7.2



More information about the CRIU mailing list