git.samba.org
/
kai
/
samba-autobuild
/
.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
b58deee
)
r19352: Oops, missed a few changes...
author
Jelmer Vernooij
<jelmer@samba.org>
Mon, 16 Oct 2006 23:25:19 +0000
(23:25 +0000)
committer
Gerald (Jerry) Carter
<jerry@samba.org>
Wed, 10 Oct 2007 19:21:15 +0000
(14:21 -0500)
(This used to be commit
73f1d937808976bc0f87b6490ab72632f038ddbd
)
source4/torture/subunit.c
patch
|
blob
|
history
diff --git
a/source4/torture/subunit.c
b/source4/torture/subunit.c
index 3cad622d6fb6d9ecc0348929573ac519d4fdcf5e..2ec01218ed3099b843e9db784eb10e45e0b67ff6 100644
(file)
--- a/
source4/torture/subunit.c
+++ b/
source4/torture/subunit.c
@@
-23,40
+23,60
@@
#include "system/network.h"
#include "system/filesys.h"
#include "torture/ui.h"
#include "system/network.h"
#include "system/filesys.h"
#include "torture/ui.h"
+#include "torture/torture.h"
#include "torture/proto.h"
#include "torture/proto.h"
-NTSTATUS torture_register_subunit_testsuite(const char *path)
+struct torture_suite *torture_subunit_suite_create(TALLOC_CTX *mem_ctx,
+ const char *path)
{
{
- struct torture_suite *suite = talloc_zero(talloc_autofree_context(),
- struct torture_suite);
+ struct torture_suite *suite = talloc_zero(mem_ctx, struct torture_suite);
suite->path = talloc_strdup(suite, path);
suite->name = talloc_strdup(suite, strrchr(path, '/')?strrchr(path, '/')+1:
path);
suite->description = talloc_asprintf(suite, "Subunit test %s", suite->name);
suite->path = talloc_strdup(suite, path);
suite->name = talloc_strdup(suite, strrchr(path, '/')?strrchr(path, '/')+1:
path);
suite->description = talloc_asprintf(suite, "Subunit test %s", suite->name);
- return
torture_register_suite(suite)
;
+ return
suite
;
}
}
-int torture_subunit_load_testsuites(const char *directory)
+bool torture_subunit_load_testsuites(const char *directory, bool recursive,
+ struct torture_suite *parent)
{
DIR *dir;
struct dirent *entry;
char *filename;
{
DIR *dir;
struct dirent *entry;
char *filename;
- int success = 0;
+ bool exists;
+
+ if (parent == NULL)
+ parent = torture_root;
dir = opendir(directory);
if (dir == NULL)
dir = opendir(directory);
if (dir == NULL)
- return
-1
;
+ return
true
;
while((entry = readdir(dir))) {
while((entry = readdir(dir))) {
+ struct torture_suite *child;
if (ISDOT(entry->d_name) || ISDOTDOT(entry->d_name))
continue;
if (ISDOT(entry->d_name) || ISDOTDOT(entry->d_name))
continue;
+ if (!recursive && entry->d_type & DT_DIR)
+ continue;
+
filename = talloc_asprintf(NULL, "%s/%s", directory, entry->d_name);
filename = talloc_asprintf(NULL, "%s/%s", directory, entry->d_name);
- if (NT_STATUS_IS_OK(torture_register_subunit_testsuite(filename))) {
- success++;
+ if (entry->d_type & DT_DIR) {
+ child = torture_find_suite(parent, entry->d_name);
+ exists = (child != NULL);
+ if (child == NULL)
+ child = torture_suite_create(parent, entry->d_name);
+ torture_subunit_load_testsuites(filename, true, child);
+ } else {
+ child = torture_subunit_suite_create(parent, filename);
+ exists = false;
+ }
+
+ if (!exists) {
+ torture_suite_add_suite(parent, child);
}
talloc_free(filename);
}
talloc_free(filename);
@@
-64,7
+84,7
@@
int torture_subunit_load_testsuites(const char *directory)
closedir(dir);
closedir(dir);
- return
success
;
+ return
true
;
}
static pid_t piped_child(char* const command[], int *f_in)
}
static pid_t piped_child(char* const command[], int *f_in)
@@
-72,11
+92,7
@@
static pid_t piped_child(char* const command[], int *f_in)
pid_t pid;
int sock[2];
pid_t pid;
int sock[2];
-#ifdef HAVE_SOCKETPAIR
- if (socketpair(AF_UNIX, SOCK_STREAM, 0, sock) == -1) {
-#else
- if (pipe(sock) == -1) {
-#endif
+ if (socketpair(PF_UNIX, SOCK_STREAM, AF_LOCAL, sock) == -1) {
DEBUG(0, ("socketpair: %s", strerror(errno)));
return -1;
}
DEBUG(0, ("socketpair: %s", strerror(errno)));
return -1;
}