From e4085f9c75afdfdb9084816798ea5d19ad679eed Mon Sep 17 00:00:00 2001 From: tilghman Date: Tue, 16 Mar 2010 19:34:01 +0000 Subject: Fix test_time on Mac OS X (and other platforms without inotify) Reviewboard: https://reviewboard.asterisk.org/r/554/ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@252846 f38db490-d61c-443f-a65b-d21fe96a405b --- tests/test_time.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'tests') 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(); -- cgit v1.2.3