s3:torture: relax TRANS2 midmight time checking
authorStefan Metzmacher <metze@samba.org>
Wed, 7 Sep 2011 08:32:53 +0000 (10:32 +0200)
committerStefan Metzmacher <metze@samba.org>
Wed, 7 Sep 2011 08:38:02 +0000 (10:38 +0200)
It's possible that the test runs on a full hour, e.g. Tue Sep  6 03:00:00 2011.

So better check that the a_time is different from the current time.

metze

source3/torture/torture.c

index 888bcb1c863cec5f9044b9f87927c927f359dc70..f07026d17ac94a7d7337830e6745b8a83d1fe949 100644 (file)
@@ -3323,18 +3323,20 @@ static bool run_trans2test(int dummy)
                printf("ERROR: qpathinfo failed (%s)\n", nt_errstr(status));
                correct = False;
        } else {
+               time_t t = time(NULL);
+
                if (c_time != m_time) {
                        printf("create time=%s", ctime(&c_time));
                        printf("modify time=%s", ctime(&m_time));
                        printf("This system appears to have sticky create times\n");
                }
-               if (a_time % (60*60) == 0) {
+               if ((abs(a_time - t) > 60) && (a_time % (60*60) == 0)) {
                        printf("access time=%s", ctime(&a_time));
                        printf("This system appears to set a midnight access time\n");
                        correct = False;
                }
 
-               if (abs(m_time - time(NULL)) > 60*60*24*7) {
+               if (abs(m_time - t) > 60*60*24*7) {
                        printf("ERROR: totally incorrect times - maybe word reversed? mtime=%s", ctime(&m_time));
                        correct = False;
                }