COMPARE_WRITE_TIME_CMP(given,correct,!=)
#define COMPARE_WRITE_TIME_GREATER(given,correct) \
COMPARE_WRITE_TIME_CMP(given,correct,<=)
-#define COMPARE_WRITE_TIME_LESS(given,correct) \
- COMPARE_WRITE_TIME_CMP(given,correct,>=)
#define COMPARE_ACCESS_TIME_CMP(given, correct, cmp) do { \
COMPARE_TIME_CMP(given, access_time, correct, access_time, cmp); \
} while (0)
#define COMPARE_ACCESS_TIME_EQUAL(given,correct) \
COMPARE_ACCESS_TIME_CMP(given,correct,!=)
+#define COMPARE_ACCESS_TIME_GREATER(given,correct) \
+ COMPARE_ACCESS_TIME_CMP(given,correct,<=)
#define COMPARE_CHANGE_TIME_CMP(given, correct, cmp) do { \
COMPARE_TIME_CMP(given, change_time, correct, change_time, cmp); \
} while (0)
#define COMPARE_CHANGE_TIME_EQUAL(given,correct) \
COMPARE_CHANGE_TIME_CMP(given,correct,!=)
+#define COMPARE_CHANGE_TIME_GREATER(given,correct) \
+ COMPARE_CHANGE_TIME_CMP(given,correct,<=)
#define COMPARE_CREATE_TIME_CMP(given, correct, cmp) do { \
COMPARE_TIME_CMP(given, create_time, correct, create_time, cmp); \
COMPARE_CREATE_TIME_CMP(given,correct,!=)
#define COMPARE_ALL_TIMES_EQUAL(given,correct) do { \
- COMPARE_ACCESS_TIME_EQUAL(given,correct); \
COMPARE_WRITE_TIME_EQUAL(given,correct); \
COMPARE_CHANGE_TIME_EQUAL(given,correct); \
+ COMPARE_ACCESS_TIME_EQUAL(given,correct); \
COMPARE_CREATE_TIME_EQUAL(given,correct); \
} while (0)
#define COMPARE_TIMES_AFTER_WRITE(given,correct) do { \
- COMPARE_ACCESS_TIME_GREATER(given,correct); \
COMPARE_WRITE_TIME_GREATER(given,correct); \
COMPARE_CHANGE_TIME_GREATER(given,correct); \
+ COMPARE_ACCESS_TIME_EQUAL(given,correct); \
COMPARE_CREATE_TIME_EQUAL(given,correct); \
+ COMPARE_TIME_CMP(given, change_time, given, write_time, !=); \
+} while (0)
+
+#define COMPARE_TIMES_AFTER_CLOSE(given,correct) do { \
+ COMPARE_WRITE_TIME_GREATER(given,correct); \
+ COMPARE_CHANGE_TIME_GREATER(given,correct); \
+ COMPARE_ACCESS_TIME_GREATER(given,correct); \
+ COMPARE_CREATE_TIME_EQUAL(given,correct); \
+ COMPARE_TIME_CMP(given, change_time, given, write_time, !=); \
+ COMPARE_TIME_CMP(given, access_time, given, write_time, !=); \
} while (0)
#define GET_INFO_FILE(tree, finfo) do { \
double msec = 1000 * sec;
double nsec = 1000 * msec;
double expected_delay = used_delay / nsec;
- double min_delay = expected_delay * 0.1;
+ double min_delay = expected_delay * 0.01;
double max_delay = 5 * expected_delay;
bool ret = true;
bool ok;
torture_assert(tctx, ok, "get_basic_info_cb: finfoT");
COMPARE_WRITE_TIME_EQUAL(finfoT, finfo0);
- /*
- * make sure the write time is updated 2 seconds later
- * calcuated from the first write
- * (but expect upto 5 seconds extra time for a busy server)
- */
torture_comment(tctx, "Do a write on the file handle\n");
before_write = timeval_current();
ok = write_data_cb(private_data);
torture_assert(tctx, (delayS <= max_delay),
"Server didn't update write_time!");
- COMPARE_WRITE_TIME_GREATER(finfoT, finfo0);
+ COMPARE_TIMES_AFTER_WRITE(finfoT, finfo0);
break;
}
ok = get_basic_info_cb(private_data, &finfo1);
torture_assert(tctx, ok, "get_basic_info_cb: finfo1");
- COMPARE_WRITE_TIME_GREATER(finfo1, finfo0);
+ COMPARE_TIMES_AFTER_WRITE(finfo1, finfo0);
/*
* Make sure the time doesn't change during the next 5 seconds
test_durable_open_delaywrite1_write_data,
&state);
torture_assert(tctx, ok, "test_delay_writetime");
+goto close_handles;
goto done;
/*
* make sure the write time is updated 2 seconds later
smb_msleep(0.1 * msec);
//smb_msleep(1 * msec);
}
+close_handles:
GET_INFO_BOTH(finfo3, c2finfo3);
//COMPARE_WRITE_TIME_EQUAL(finfo3, finfo2);
finfoCL.basic_info.out.write_time = cl.out.write_time;
finfoCL.basic_info.out.change_time = cl.out.change_time;
finfoCL.basic_info.out.attrib = cl.out.file_attr;
- COMPARE_WRITE_TIME_GREATER(finfoCL, finfo3);
+ //COMPARE_WRITE_TIME_GREATER(finfoCL, finfo3);
+ //COMPARE_TIMES_AFTER_CLOSE(finfoCL, finfo3);
+
+ GET_INFO_FILE(tree2, c2finfo3);
+ COMPARE_ALL_TIMES_EQUAL(c2finfo3, finfoCL);
ZERO_STRUCT(cl2);
cl2.in.file.handle = *h2;
c2finfoCL.basic_info.out.write_time = cl2.out.write_time;
c2finfoCL.basic_info.out.change_time = cl2.out.change_time;
c2finfoCL.basic_info.out.attrib = cl2.out.file_attr;
- COMPARE_WRITE_TIME_EQUAL(c2finfoCL, finfoCL);
+ COMPARE_ALL_TIMES_EQUAL(c2finfoCL, finfoCL);
//struct {
// /* static body buffer 60 (0x3C) bytes */
// /* uint16_t buffer_code; 0x3C */