summaryrefslogtreecommitdiff
path: root/source4/torture/local/torture.c
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2006-06-26 19:30:00 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:09:32 -0500
commit6b749f225e8d1c910820a6576952f130e72bab84 (patch)
tree1e25d021b072638ff2528f42f08e553a534ed018 /source4/torture/local/torture.c
parent993012bd2adaaa81d06341cdc36fccc919b0a91b (diff)
downloadsamba-6b749f225e8d1c910820a6576952f130e72bab84.tar.gz
samba-6b749f225e8d1c910820a6576952f130e72bab84.tar.bz2
samba-6b749f225e8d1c910820a6576952f130e72bab84.zip
r16526: Add torture_setup_server() with test.
(This used to be commit 6a1ed8ad756b97f61d4af9df2c7a7d889a2d09ef)
Diffstat (limited to 'source4/torture/local/torture.c')
-rw-r--r--source4/torture/local/torture.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/source4/torture/local/torture.c b/source4/torture/local/torture.c
index ed601b663f..76581540a1 100644
--- a/source4/torture/local/torture.c
+++ b/source4/torture/local/torture.c
@@ -22,6 +22,7 @@
#include "includes.h"
#include "torture/torture.h"
+#include "system/wait.h"
#include "torture/util.h"
static BOOL test_tempdir(struct torture_context *torture,
@@ -38,12 +39,42 @@ static BOOL test_tempdir(struct torture_context *torture,
return True;
}
+static BOOL test_setup_server(struct torture_context *torture,
+ const void *_data)
+{
+ pid_t pid;
+
+ torture_assert_ntstatus_ok(torture, torture_setup_server(torture,
+ "./script/tests/mktestsetup.sh",
+ "./bin/smbd", &pid),
+ "starting smbd failed");
+
+ torture_assert(torture, pid > 0, "Pid invalid");
+
+ torture_comment(torture, "Created smbd with pid %d", pid);
+
+ kill(pid, SIGINT);
+
+ waitpid(pid, NULL, 0);
+
+ torture_assert_ntstatus_equal(torture, torture_setup_server(torture,
+ "./invalid-script",
+ "./bin/smbd", &pid),
+ NT_STATUS_UNSUCCESSFUL,
+ "invalid script specified");
+
+ torture_assert(torture, pid == -1, "Pid not -1 after failure");
+
+ return True;
+}
+
struct torture_suite *torture_local_torture(TALLOC_CTX *mem_ctx)
{
struct torture_suite *suite = torture_suite_create(mem_ctx,
"LOCAL-TORTURE");
torture_suite_add_simple_tcase(suite, "tempdir", test_tempdir, NULL);
+ torture_suite_add_simple_tcase(suite, "setup server", test_setup_server, NULL);
return suite;
}