Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/lib/librumpclient test rumpclient_vfork()
details: https://anonhg.NetBSD.org/src/rev/5a7af0110f39
branches: trunk
changeset: 762138:5a7af0110f39
user: pooka <pooka%NetBSD.org@localhost>
date: Wed Feb 16 17:57:44 2011 +0000
description:
test rumpclient_vfork()
diffstat:
tests/lib/librumpclient/h_exec.c | 24 +++++++++++++++++++-----
tests/lib/librumpclient/t_exec.sh | 32 +++++++++++++++++++++++++++++++-
2 files changed, 50 insertions(+), 6 deletions(-)
diffs (104 lines):
diff -r b8f9d1ce3f7f -r 5a7af0110f39 tests/lib/librumpclient/h_exec.c
--- a/tests/lib/librumpclient/h_exec.c Wed Feb 16 17:56:46 2011 +0000
+++ b/tests/lib/librumpclient/h_exec.c Wed Feb 16 17:57:44 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: h_exec.c,v 1.5 2011/02/16 16:02:52 pooka Exp $ */
+/* $NetBSD: h_exec.c,v 1.6 2011/02/16 17:57:44 pooka Exp $ */
/*
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
if (argc > 1) {
if (strcmp(argv[1], "_didexec") == 0) {
- daemon(0, 0); /* detach-me-notnot ergo detach */
+ rumpclient_daemon(0, 0); /* detach-me-notnot */
s2 = atoi(argv[2]);
slen = sizeof(sin);
/* see below */
@@ -90,7 +90,7 @@
err(1, "listen2");
if (argc == 1) {
- daemon(0, 0);
+ rumpclient_daemon(0, 0);
slen = sizeof(sin);
/*
* "pause()", but conveniently gets rid of this helper
@@ -105,10 +105,24 @@
}
}
- ename = __UNCONST("h_ution");
+ sprintf(buf, "%d", s2);
+
+ if (argc == 3 && strcmp(argv[2], "vfork_please") == 0) {
+ switch (rumpclient_vfork()) {
+ case 0:
+ ename = __UNCONST("fourchette");
+ break;
+ case -1:
+ err(1, "vfork");
+ default:
+ ename = __UNCONST("h_ution");
+ break;
+ }
+ } else {
+ ename = __UNCONST("h_ution");
+ }
/* omstart! */
- sprintf(buf, "%d", s2);
eargv[0] = ename;
eargv[1] = __UNCONST("_didexec");
eargv[2] = buf;
diff -r b8f9d1ce3f7f -r 5a7af0110f39 tests/lib/librumpclient/t_exec.sh
--- a/tests/lib/librumpclient/t_exec.sh Wed Feb 16 17:56:46 2011 +0000
+++ b/tests/lib/librumpclient/t_exec.sh Wed Feb 16 17:57:44 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: t_exec.sh,v 1.4 2011/02/16 16:02:52 pooka Exp $
+# $NetBSD: t_exec.sh,v 1.5 2011/02/16 17:57:44 pooka Exp $
#
# Copyright (c) 2011 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -98,10 +98,40 @@
rump.halt
}
+atf_test_case vfork cleanup
+vfork_head()
+{
+ atf_set "descr" "test rumpclient_vfork()"
+}
+
+vfork_body()
+{
+
+ atf_check -s exit:0 ${rumpsrv} ${RUMP_SERVER}
+ atf_check -s exit:0 \
+ $(atf_get_srcdir)/h_exec $(atf_get_srcdir)/h_exec vfork_please
+ atf_check -s exit:0 -o save:sstat.out rump.sockstat
+ atf_check -s exit:0 -o inline:'5\n' sed -n '$=' sstat.out
+ atf_check -s exit:0 -o match:'^root.*h_ution.*tcp.*\*\.1234' \
+ cat sstat.out
+ atf_check -s exit:0 -o match:'^root.*h_ution.*tcp.*\*\.2345' \
+ cat sstat.out
+ atf_check -s exit:0 -o match:'^root.*fourchette.*tcp.*\*\.1234' \
+ cat sstat.out
+ atf_check -s exit:0 -o match:'^root.*fourchette.*tcp.*\*\.2345' \
+ cat sstat.out
+}
+
+vfork_cleanup()
+{
+ rump.halt
+}
+
atf_init_test_cases()
{
atf_add_test_case noexec
atf_add_test_case exec
atf_add_test_case cloexec
+ atf_add_test_case vfork
}
Home |
Main Index |
Thread Index |
Old Index