From fb66b3b6e6f7de7ffbbf2ae3537be7a115597b39 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Wed, 24 May 2000 05:40:03 +0000 Subject: torture test: same cli_state: open file rw/denynone, open *same* file r/denynone. write to file (fd1) read from file (fd2). compare. repeat. two cli_states: open file rw/denynone (cli1), open *same* file r/denynone (cli2). write to file (fd1) read from file (fd2). compare. repeat. (This used to be commit 0a993f37830938a8d4262c6b7913af502bbf015f) --- source3/utils/torture.c | 91 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) (limited to 'source3') diff --git a/source3/utils/torture.c b/source3/utils/torture.c index e74106609d..8f22c011e1 100644 --- a/source3/utils/torture.c +++ b/source3/utils/torture.c @@ -270,6 +270,95 @@ static void run_torture(int dummy) close_connection(&cli); } +static BOOL rw_torture2(struct cli_state *c1, struct cli_state *c2) +{ + char *lockfname = "\\torture.lck"; + int fnum1; + int fnum2; + int i; + char buf[131072]; + char buf_rd[131072]; + + if (!cli_unlink(c1, lockfname)) { + printf("unlink failed (%s)\n", cli_errstr(c1)); + } + + fnum1 = cli_open(c1, lockfname, O_RDWR | O_CREAT | O_EXCL, + DENY_NONE); + if (fnum1 == -1) { + printf("first open read/write of %s failed (%s)\n", + lockfname, cli_errstr(c1)); + return False; + } + fnum2 = cli_open(c2, lockfname, O_RDONLY, + DENY_NONE); + if (fnum2 == -1) { + printf("second open read-only of %s failed (%s)\n", + lockfname, cli_errstr(c2)); + cli_close(c1, fnum1); + return False; + } + + for (i=0;i