diff options
author | Stefan Metzmacher <metze@samba.org> | 2008-02-24 00:13:36 +0100 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2008-02-25 07:39:23 +0100 |
commit | a622f80c658bb1d0639e9ebe3a2be7093f15ffc6 (patch) | |
tree | 39589568351eaf5be8a30673acd7a5a63c23bf83 /source4 | |
parent | bd95d6d5dbd27e2b904f7907ef39766159d0afcf (diff) | |
download | samba-a622f80c658bb1d0639e9ebe3a2be7093f15ffc6.tar.gz samba-a622f80c658bb1d0639e9ebe3a2be7093f15ffc6.tar.bz2 samba-a622f80c658bb1d0639e9ebe3a2be7093f15ffc6.zip |
BASE-DEFER_OPEN: add torture:sharedelays option to run this test faster
metze
(This used to be commit 877cc375d0523cb31324a5d611e73d666e7a9a78)
Diffstat (limited to 'source4')
-rw-r--r-- | source4/torture/basic/base.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/source4/torture/basic/base.c b/source4/torture/basic/base.c index aa729ec0df..42d7ddaaa1 100644 --- a/source4/torture/basic/base.c +++ b/source4/torture/basic/base.c @@ -633,6 +633,13 @@ static bool run_deferopen(struct torture_context *tctx, struct smbcli_state *cli int retries=4; int i = 0; bool correct = true; + int nsec; + int msec; + double sec; + + nsec = torture_setting_int(tctx, "sharedelay", 1000000); + msec = nsec / 1000; + sec = ((double)nsec) / ((double) 1000000); if (retries <= 0) { torture_comment(tctx, "failed to connect\n"); @@ -657,9 +664,10 @@ static bool run_deferopen(struct torture_context *tctx, struct smbcli_state *cli } if (NT_STATUS_EQUAL(smbcli_nt_error(cli->tree),NT_STATUS_SHARING_VIOLATION)) { double e = timeval_elapsed(&tv); - if (e < 0.5 || e > 1.5) { - torture_comment(tctx,"Timing incorrect %.2f violation\n", - e); + if (e < (0.5 * sec) || e > (1.5 * sec)) { + torture_comment(tctx,"Timing incorrect %.2f violation 1 sec == %.2f\n", + e, sec); + return false; } } } while (NT_STATUS_EQUAL(smbcli_nt_error(cli->tree),NT_STATUS_SHARING_VIOLATION)); @@ -671,13 +679,13 @@ static bool run_deferopen(struct torture_context *tctx, struct smbcli_state *cli torture_comment(tctx, "pid %u open %d\n", (unsigned)getpid(), i); - sleep(10); + msleep(10 * msec); i++; if (NT_STATUS_IS_ERR(smbcli_close(cli->tree, fnum))) { torture_comment(tctx,"Failed to close %s, error=%s\n", fname, smbcli_errstr(cli->tree)); return false; } - sleep(2); + msleep(2 * msec); } if (NT_STATUS_IS_ERR(smbcli_unlink(cli->tree, fname))) { |