From 10b96e3ffe1ccec4e6866b61ddd93e04a7863bbf Mon Sep 17 00:00:00 2001 From: Richard Sharpe Date: Thu, 14 Feb 2013 16:04:24 -0800 Subject: [PATCH] Fix the maxfids test so that it does not fork lots of processes and so that it works for all cases of maxfids. Signed-off-by: Richard Sharpe Reviewed-by: Jeremy Allison Autobuild-User(master): Jeremy Allison Autobuild-Date(master): Fri Feb 15 07:09:59 CET 2013 on sn-devel-104 --- source4/torture/basic/base.c | 2 +- source4/torture/basic/misc.c | 22 ++++------------------ 2 files changed, 5 insertions(+), 19 deletions(-) diff --git a/source4/torture/basic/base.c b/source4/torture/basic/base.c index 56461005e80..5fba9b08127 100644 --- a/source4/torture/basic/base.c +++ b/source4/torture/basic/base.c @@ -1938,7 +1938,7 @@ NTSTATUS torture_base_init(void) torture_suite_add_smb_multi_test(suite, "bench-torture", run_torture); torture_suite_add_1smb_test(suite, "scan-pipe_number", run_pipe_number); torture_suite_add_1smb_test(suite, "scan-ioctl", torture_ioctl_test); - torture_suite_add_smb_multi_test(suite, "scan-maxfid", run_maxfidtest); + torture_suite_add_1smb_test(suite, "scan-maxfid", torture_maxfid_test); suite->description = talloc_strdup(suite, "Basic SMB tests (imported from the original smbtorture)"); diff --git a/source4/torture/basic/misc.c b/source4/torture/basic/misc.c index 213d9239509..721727ba177 100644 --- a/source4/torture/basic/misc.c +++ b/source4/torture/basic/misc.c @@ -295,7 +295,7 @@ bool torture_holdopen(struct torture_context *tctx, /* test how many open files this server supports on the one socket */ -bool run_maxfidtest(struct torture_context *tctx, struct smbcli_state *cli, int dummy) +bool torture_maxfid_test(struct torture_context *tctx, struct smbcli_state *cli) { #define MAXFID_TEMPLATE "\\maxfid\\fid%d\\maxfid.%d.%d" char *fname; @@ -347,12 +347,11 @@ bool run_maxfidtest(struct torture_context *tctx, struct smbcli_state *cli, int } } torture_comment(tctx, "%6d\n", i); - i--; maxfid = i; torture_comment(tctx, "cleaning up\n"); - for (i=0;itree, fnums[i]))) { torture_comment(tctx, "Close of fnum %d failed - %s\n", fnums[i], smbcli_errstr(cli->tree)); @@ -364,19 +363,8 @@ bool run_maxfidtest(struct torture_context *tctx, struct smbcli_state *cli, int } free(fname); - asprintf(&fname, MAXFID_TEMPLATE, (maxfid-i)/1000, maxfid-i,(int)getpid()); - if (NT_STATUS_IS_ERR(smbcli_close(cli->tree, fnums[maxfid-i]))) { - torture_comment(tctx, "Close of fnum %d failed - %s\n", fnums[maxfid-i], smbcli_errstr(cli->tree)); - } - if (NT_STATUS_IS_ERR(smbcli_unlink(cli->tree, fname))) { - torture_comment(tctx, "unlink of %s failed (%s)\n", - fname, smbcli_errstr(cli->tree)); - correct = false; - } - free(fname); - if (torture_setting_bool(tctx, "progress", true)) { - torture_comment(tctx, "%6d %6d\r", i, maxfid-i); + torture_comment(tctx, "%6d\r", i); fflush(stdout); } } @@ -389,9 +377,7 @@ bool run_maxfidtest(struct torture_context *tctx, struct smbcli_state *cli, int } torture_comment(tctx, "maxfid test finished\n"); - if (!torture_close_connection(cli)) { - correct = false; - } + return correct; #undef MAXFID_TEMPLATE } -- 2.11.4.GIT