summaryrefslogtreecommitdiff
path: root/tests/test_time.c
diff options
context:
space:
mode:
authorTilghman Lesher <tilghman@meg.abyt.es>2010-03-16 19:34:01 +0000
committerTilghman Lesher <tilghman@meg.abyt.es>2010-03-16 19:34:01 +0000
commit385a40226a899f61ab363c4c267253dd2ae5bb33 (patch)
tree999ff06c1d84d02b22accde1ebfbb2a7138836ba /tests/test_time.c
parent4acc1689c1f8d23abbe4b34832e1b5eb845cfc8b (diff)
Fix test_time on Mac OS X (and other platforms without inotify)
Reviewboard: https://reviewboard.asterisk.org/r/554/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@252846 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'tests/test_time.c')
-rw-r--r--tests/test_time.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/tests/test_time.c b/tests/test_time.c
index b4933e89b..41161310f 100644
--- a/tests/test_time.c
+++ b/tests/test_time.c
@@ -90,19 +90,26 @@ AST_TEST_DEFINE(test_timezone_watch)
int system_res;
snprintf(syscmd, sizeof(syscmd), "%s " TZDIR "/%s %s", type == 0 ? "cp" : "ln -sf", zones[i], tzfile);
if ((system_res = system(syscmd))) {
- ast_log(LOG_WARNING, "system() returned non-zero: %d\n", system_res);
+ ast_log(LOG_WARNING, "system(%s) returned non-zero: %d\n", syscmd, system_res);
}
+ ast_localtime_wakeup_monitor();
ast_localtime(&tv, &atm[i], tzfile);
if (i != 0) {
if (atm[i].tm_hour == atm[i - 1].tm_hour) {
res = AST_TEST_FAIL;
- ast_test_status_update(test, "Failed %s test\n", type == 0 ? "deletion" : "symlink");
+ ast_test_status_update(test, "Failed %s test: %d(%s) = %d(%s)\n", type == 0 ? "deletion" : "symlink", atm[i].tm_hour, zones[i], atm[i-1].tm_hour, zones[i-1]);
}
}
+
+ /* stat(2) only has resolution to 1 second - must wait, or the mtime is the same */
+ usleep(1100000);
}
}
snprintf(syscmd, sizeof(syscmd), "rm -rf %s", tmpdir);
+ if (system(syscmd)) {
+ ast_log(LOG_WARNING, "system(%s) returned non-zero.\n", syscmd);
+ }
/* Restore SIGCHLD handler */
ast_unreplace_sigchld();