Torture test added to run_opentest() to ensure we don't regress on
authorJeremy Allison <jra@samba.org>
Wed, 23 Feb 2011 00:40:23 +0000 (16:40 -0800)
committerJeremy Allison <jra@samba.org>
Wed, 23 Feb 2011 02:00:53 +0000 (03:00 +0100)
the previous change.

Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Wed Feb 23 03:00:53 CET 2011 on sn-devel-104

source3/torture/torture.c

index 893497ebbee3bee5684ce4fa5d5f4192181124f9..2670485bcca7597e761c42c0dd5be1f13f026879 100644 (file)
@@ -4440,6 +4440,7 @@ static bool run_opentest(int dummy)
        SMB_OFF_T fsize;
        bool correct = True;
        char *tmp_path;
+       NTSTATUS status;
 
        printf("starting open test\n");
 
@@ -4779,6 +4780,31 @@ static bool run_opentest(int dummy)
 
        cli_unlink(cli1, fname, aSYSTEM | aHIDDEN);
 
+       printf("TEST #8 testing open without WRITE_ATTRIBUTES, updating close write time.\n");
+       status = cli_ntcreate(cli1, fname, 0, FILE_WRITE_DATA, FILE_ATTRIBUTE_NORMAL,
+                               FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
+                               FILE_OVERWRITE_IF, 0, 0, &fnum1);
+       if (!NT_STATUS_IS_OK(status)) {
+               printf("TEST #8 open of %s failed (%s)\n", fname, nt_errstr(status));
+               correct = false;
+               goto out;
+       }
+
+       /* Write to ensure we have to update the file time. */
+       if (cli_write(cli1, fnum1, 0, "TEST DATA\n", 0, 10) != 10) {
+               printf("TEST #8 cli_write failed: %s\n", cli_errstr(cli1));
+               correct = false;
+               goto out;
+       }
+
+        status = cli_close(cli1, fnum1);
+        if (!NT_STATUS_IS_OK(status)) {
+                printf("TEST #8 close of %s failed (%s)\n", fname, nt_errstr(status));
+               correct = false;
+        }
+
+  out:
+
        if (!torture_close_connection(cli1)) {
                correct = False;
        }