summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2010-02-01 18:49:50 -0800
committerJeremy Allison <jra@samba.org>2010-02-01 18:49:50 -0800
commita35be8c0c2d804638d9eda5afb6c96ef2f090549 (patch)
tree9dede8d261baa2809262c9390197177a27eabbed /source3
parent4e08d0d0d60be0fc4a080cd616ecb36253e490db (diff)
downloadsamba-a35be8c0c2d804638d9eda5afb6c96ef2f090549.tar.gz
samba-a35be8c0c2d804638d9eda5afb6c96ef2f090549.tar.bz2
samba-a35be8c0c2d804638d9eda5afb6c96ef2f090549.zip
Torture test for bug 7084 - Create time on directories not stored properly in an EA in new create time code.
Ensure new files in a directory don't reset the create time. Jeremy.
Diffstat (limited to 'source3')
-rwxr-xr-xsource3/script/tests/test_smbtorture_s3.sh2
-rw-r--r--source3/torture/torture.c87
2 files changed, 88 insertions, 1 deletions
diff --git a/source3/script/tests/test_smbtorture_s3.sh b/source3/script/tests/test_smbtorture_s3.sh
index 1cbfc23554..3e0e3de911 100755
--- a/source3/script/tests/test_smbtorture_s3.sh
+++ b/source3/script/tests/test_smbtorture_s3.sh
@@ -28,7 +28,7 @@ tests="FDPASS LOCK1 LOCK2 LOCK3 LOCK4 LOCK5 LOCK6 LOCK7 LOCK9"
#tests="$tests UNLINK BROWSE ATTR TRANS2 MAXFID TORTURE "
tests="$tests UNLINK BROWSE ATTR TRANS2 TORTURE "
tests="$tests OPLOCK1 OPLOCK2 OPLOCK3 STREAMERROR"
-tests="$tests DIR DIR1 TCON TCONDEV RW1 RW2 RW3"
+tests="$tests DIR DIR1 DIR-CREATETIME TCON TCONDEV RW1 RW2 RW3"
tests="$tests OPEN XCOPY RENAME DELETE PROPERTIES W2K"
tests="$tests TCON2 IOCTL CHKPATH FDSESS LOCAL-SUBSTITUTE CHAIN1"
tests="$tests GETADDRINFO POSIX UID-REGRESSION-TEST SHORTNAME-TEST"
diff --git a/source3/torture/torture.c b/source3/torture/torture.c
index 758bb60beb..07cf5f9bc3 100644
--- a/source3/torture/torture.c
+++ b/source3/torture/torture.c
@@ -6340,6 +6340,92 @@ static bool run_tldap(int dummy)
return true;
}
+/* Torture test to ensure no regression of :
+https://bugzilla.samba.org/show_bug.cgi?id=7084
+*/
+
+static bool run_dir_createtime(int dummy)
+{
+ struct cli_state *cli;
+ const char *dname = "\\testdir";
+ const char *fname = "\\testdir\\testfile";
+ NTSTATUS status;
+ struct timespec create_time;
+ struct timespec create_time1;
+ uint16_t fnum;
+ bool ret = false;
+
+ if (!torture_open_connection(&cli, 0)) {
+ return false;
+ }
+
+ cli_unlink(cli, fname, aSYSTEM | aHIDDEN);
+ cli_rmdir(cli, dname);
+
+ status = cli_mkdir(cli, dname);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("mkdir failed: %s\n", nt_errstr(status));
+ goto out;
+ }
+
+ if (!cli_qpathinfo2(cli,
+ dname,
+ &create_time,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL)) {
+ status = cli_nt_error(cli);
+ printf("cli_qpathinfo2 returned %s\n",
+ nt_errstr(status));
+ goto out;
+ }
+
+ /* Sleep 3 seconds, then create a file. */
+ sleep(3);
+
+ status = cli_open(cli, fname, O_RDWR | O_CREAT | O_EXCL,
+ DENY_NONE, &fnum);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("cli_open failed: %s\n", nt_errstr(status));
+ goto out;
+ }
+
+ if (!cli_qpathinfo2(cli,
+ dname,
+ &create_time1,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL)) {
+ status = cli_nt_error(cli);
+ printf("cli_qpathinfo2 (2) returned %s\n",
+ nt_errstr(status));
+ goto out;
+ }
+
+ if (timespec_compare(&create_time1, &create_time)) {
+ printf("run_dir_createtime: create time was updated (error)\n");
+ } else {
+ printf("run_dir_createtime: create time was not updated (correct)\n");
+ ret = true;
+ }
+
+ out:
+
+ cli_unlink(cli, fname, aSYSTEM | aHIDDEN);
+ cli_rmdir(cli, dname);
+ if (!torture_close_connection(cli)) {
+ ret = false;
+ }
+ return ret;
+}
+
+
static bool run_streamerror(int dummy)
{
struct cli_state *cli;
@@ -7195,6 +7281,7 @@ static struct {
{"OPLOCK3", run_oplock3, 0},
{"DIR", run_dirtest, 0},
{"DIR1", run_dirtest1, 0},
+ {"DIR-CREATETIME", run_dir_createtime, 0},
{"DENY1", torture_denytest1, 0},
{"DENY2", torture_denytest2, 0},
{"TCON", run_tcon_test, 0},