summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-10-19 06:30:52 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:01:54 -0500
commitc5465ae50fa133d3f354f6e12a2123f09131a2e6 (patch)
tree1a0bdd934bb926f888e0dd8eb3ad3d29b8efe7af
parent53e30b391d6f6704d365bbf956a2aa2ef8451000 (diff)
downloadsamba-c5465ae50fa133d3f354f6e12a2123f09131a2e6.tar.gz
samba-c5465ae50fa133d3f354f6e12a2123f09131a2e6.tar.bz2
samba-c5465ae50fa133d3f354f6e12a2123f09131a2e6.zip
r3053: make the maxfid test use subdirectories, so it doesn't create 64k
files in one directory (running the test was very slow) and can clean up after itself easily. (This used to be commit 6dea60e3b9a1d2557e8a5be505a5052dc9847a8f)
-rw-r--r--source4/torture/torture.c52
1 files changed, 46 insertions, 6 deletions
diff --git a/source4/torture/torture.c b/source4/torture/torture.c
index 8f282caf5d..5992bfc633 100644
--- a/source4/torture/torture.c
+++ b/source4/torture/torture.c
@@ -986,10 +986,10 @@ test how many open files this server supports on the one socket
*/
static BOOL run_maxfidtest(struct smbcli_state *cli, int dummy)
{
-#define MAXFID_TEMPLATE "\\maxfid.%d.%d"
+#define MAXFID_TEMPLATE "\\maxfid\\fid%d\\maxfid.%d.%d"
char *fname;
int fnums[0x11000], i;
- int retries=4;
+ int retries=4, maxfid;
BOOL correct = True;
if (retries <= 0) {
@@ -997,10 +997,30 @@ static BOOL run_maxfidtest(struct smbcli_state *cli, int dummy)
return False;
}
+ if (smbcli_deltree(cli->tree, "\\maxfid") == -1) {
+ printf("Failed to deltree \\maxfid - %s\n",
+ smbcli_errstr(cli->tree));
+ return False;
+ }
+ if (NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, "\\maxfid"))) {
+ printf("Failed to mkdir \\maxfid, error=%s\n",
+ smbcli_errstr(cli->tree));
+ return False;
+ }
+
printf("Testing maximum number of open files\n");
for (i=0; i<0x11000; i++) {
- asprintf(&fname, MAXFID_TEMPLATE, i,(int)getpid());
+ if (i % 1000 == 0) {
+ asprintf(&fname, "\\maxfid\\fid%d", i/1000);
+ if (NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, fname))) {
+ printf("Failed to mkdir %s, error=%s\n",
+ fname, smbcli_errstr(cli->tree));
+ return False;
+ }
+ free(fname);
+ }
+ asprintf(&fname, MAXFID_TEMPLATE, i/1000, i,(int)getpid());
if ((fnums[i] = smbcli_open(cli->tree, fname,
O_RDWR|O_CREAT|O_TRUNC, DENY_NONE)) ==
-1) {
@@ -1015,9 +1035,11 @@ static BOOL run_maxfidtest(struct smbcli_state *cli, int dummy)
printf("%6d\n", i);
i--;
+ maxfid = i;
+
printf("cleaning up\n");
- for (;i>=0;i--) {
- asprintf(&fname, MAXFID_TEMPLATE, i,(int)getpid());
+ for (i=0;i<maxfid/2;i++) {
+ asprintf(&fname, MAXFID_TEMPLATE, i/1000, i,(int)getpid());
if (NT_STATUS_IS_ERR(smbcli_close(cli->tree, fnums[i]))) {
printf("Close of fnum %d failed - %s\n", fnums[i], smbcli_errstr(cli->tree));
}
@@ -1027,10 +1049,28 @@ static BOOL run_maxfidtest(struct smbcli_state *cli, int dummy)
correct = False;
}
free(fname);
- printf("%6d\r", i);
+
+ asprintf(&fname, MAXFID_TEMPLATE, (maxfid-i)/1000, maxfid-i,(int)getpid());
+ if (NT_STATUS_IS_ERR(smbcli_close(cli->tree, fnums[maxfid-i]))) {
+ printf("Close of fnum %d failed - %s\n", fnums[maxfid-i], smbcli_errstr(cli->tree));
+ }
+ if (NT_STATUS_IS_ERR(smbcli_unlink(cli->tree, fname))) {
+ printf("unlink of %s failed (%s)\n",
+ fname, smbcli_errstr(cli->tree));
+ correct = False;
+ }
+ free(fname);
+
+ printf("%6d %6d\r", i, maxfid-i);
}
printf("%6d\n", 0);
+ if (smbcli_deltree(cli->tree, "\\maxfid") == -1) {
+ printf("Failed to deltree \\maxfid - %s\n",
+ smbcli_errstr(cli->tree));
+ return False;
+ }
+
printf("maxfid test finished\n");
if (!torture_close_connection(cli)) {
correct = False;