From 8773e743c518578584d07d35ffdafdd598af88b0 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 16 Oct 2006 13:06:41 +0000 Subject: r19339: Merge my 4.0-unittest branch. This adds an API for more fine-grained output in the testsuite rather than just True or False for a set of tests. The aim is to use this for: * known failure lists (run all tests and detect tests that started working or started failing). This would allow us to get rid of the RPC-SAMBA3-* tests * nicer torture output * simplification of the testsuite system * compatibility with other unit testing systems * easier usage of smbtorture (being able to run one test and automatically set up the environment for that) This is still a work-in-progress; expect more updates over the next couple of days. (This used to be commit 0eb6097305776325c75081356309115f445a7218) --- source4/torture/basic/dir.c | 56 +++++++++++++-------------------------------- 1 file changed, 16 insertions(+), 40 deletions(-) (limited to 'source4/torture/basic/dir.c') diff --git a/source4/torture/basic/dir.c b/source4/torture/basic/dir.c index 01d25e5d4a..c86f134c32 100644 --- a/source4/torture/basic/dir.c +++ b/source4/torture/basic/dir.c @@ -34,22 +34,16 @@ static void list_fn(struct clilist_file_info *finfo, const char *name, void *sta /* test directory listing speed */ -BOOL torture_dirtest1(struct torture_context *torture) +BOOL torture_dirtest1(struct torture_context *tctx, + struct smbcli_state *cli) { int i; - struct smbcli_state *cli; int fnum; BOOL correct = True; extern int torture_numops; struct timeval tv; - printf("starting dirtest1\n"); - - if (!torture_open_connection(&cli, 0)) { - return False; - } - - printf("Creating %d random filenames\n", torture_numops); + torture_comment(tctx, "Creating %d random filenames\n", torture_numops); srandom(0); tv = timeval_current(); @@ -66,11 +60,11 @@ BOOL torture_dirtest1(struct torture_context *torture) free(fname); } - printf("Matched %d\n", smbcli_list(cli->tree, "a*.*", 0, list_fn, NULL)); - printf("Matched %d\n", smbcli_list(cli->tree, "b*.*", 0, list_fn, NULL)); - printf("Matched %d\n", smbcli_list(cli->tree, "xyzabc", 0, list_fn, NULL)); + torture_comment(tctx, "Matched %d\n", smbcli_list(cli->tree, "a*.*", 0, list_fn, NULL)); + torture_comment(tctx, "Matched %d\n", smbcli_list(cli->tree, "b*.*", 0, list_fn, NULL)); + torture_comment(tctx, "Matched %d\n", smbcli_list(cli->tree, "xyzabc", 0, list_fn, NULL)); - printf("dirtest core %g seconds\n", timeval_elapsed(&tv)); + torture_comment(tctx, "dirtest core %g seconds\n", timeval_elapsed(&tv)); srandom(0); for (i=0;itree, "\\LISTDIR\\*", FILE_ATTRIBUTE_DIRECTORY, list_fn, NULL); - printf("num_seen = %d\n", num_seen ); + torture_comment(tctx, "num_seen = %d\n", num_seen ); /* We should see (torture_entries) each of files & directories + . and .. */ if (num_seen != (2*torture_entries)+2) { correct = False; @@ -152,7 +134,7 @@ BOOL torture_dirtest2(struct torture_context *torture) * relevant entries. */ num_seen = smbcli_list_old(cli->tree, "\\LISTDIR\\*", (FILE_ATTRIBUTE_DIRECTORY<<8)|FILE_ATTRIBUTE_DIRECTORY, list_fn, NULL); - printf("num_seen = %d\n", num_seen ); + torture_comment(tctx, "num_seen = %d\n", num_seen ); if (num_seen != torture_entries+2) { correct = False; fprintf(stderr,"(%s) entry count mismatch, should be %d, was %d\n", @@ -160,7 +142,7 @@ BOOL torture_dirtest2(struct torture_context *torture) } num_seen = smbcli_list_old(cli->tree, "\\LISTDIR\\*", (FILE_ATTRIBUTE_ARCHIVE<<8)|FILE_ATTRIBUTE_DIRECTORY, list_fn, NULL); - printf("num_seen = %d\n", num_seen ); + torture_comment(tctx, "num_seen = %d\n", num_seen ); if (num_seen != torture_entries) { correct = False; fprintf(stderr,"(%s) entry count mismatch, should be %d, was %d\n", @@ -175,16 +157,10 @@ BOOL torture_dirtest2(struct torture_context *torture) } #if 0 - printf("Matched %d\n", smbcli_list(cli->tree, "a*.*", 0, list_fn, NULL)); - printf("Matched %d\n", smbcli_list(cli->tree, "b*.*", 0, list_fn, NULL)); - printf("Matched %d\n", smbcli_list(cli->tree, "xyzabc", 0, list_fn, NULL)); + torture_comment(tctx, "Matched %d\n", smbcli_list(cli->tree, "a*.*", 0, list_fn, NULL)); + torture_comment(tctx, "Matched %d\n", smbcli_list(cli->tree, "b*.*", 0, list_fn, NULL)); + torture_comment(tctx, "Matched %d\n", smbcli_list(cli->tree, "xyzabc", 0, list_fn, NULL)); #endif - if (!torture_close_connection(cli)) { - correct = False; - } - - printf("finished dirtest1\n"); - return correct; } -- cgit