diff --git a/test/initmain.c b/test/initmain.c index b9bce950..a05001ac 100644 --- a/test/initmain.c +++ b/test/initmain.c @@ -59,7 +59,7 @@ testingTest(QueueMain) int flag = 0; uiQueueMain(queued, &flag); - timeout_uiMain(t, 5 * testingTimerNsecPerSec, 0); + timeout_uiMain(t, 5 * testingNsecPerSec, 0); if (flag != 1) testingTErrorf(t, "uiQueueMain didn't set flag properly: got %d, want 1", flag); } diff --git a/test/testing.c b/test/testing.c index f76a6c49..542eadb0 100644 --- a/test/testing.c +++ b/test/testing.c @@ -148,9 +148,9 @@ static void testsetRun(struct testset *set, int *anyFailed) } else if (t->skipped) // note that failed overrides skipped status = "SKIP"; - timerstr = testingTimerNsecString(testingTimerNsec(timer)); + timerstr = testingNsecString(testingTimerNsec(timer)); printf("--- %s: %s (%s)\n", status, t->name, timerstr); - testingFreeTimerNsecString(timerstr); + testingFreeNsecString(timerstr); t++; } testingFreeTimer(timer); @@ -306,7 +306,7 @@ static void fillIntPart(char *s, int *start, uint64_t unsec) } } -char *testingTimerNsecString(int64_t nsec) +char *testingNsecString(int64_t nsec) { uint64_t unsec; int neg; @@ -366,7 +366,7 @@ char *testingTimerNsecString(int64_t nsec) return s; } -void testingFreeTimerNsecString(char *s) +void testingFreeNsecString(char *s) { free(s); } diff --git a/test/testing.h b/test/testing.h index a135368e..c575dcd3 100644 --- a/test/testing.h +++ b/test/testing.h @@ -66,8 +66,8 @@ extern void testingTDefer(testingT *t, void (*f)(testingT *t, void *data), void typedef struct testingTimer testingTimer; -#define testingTimerNsecPerUsec ((int64_t) 1000) -#define testingTimerNsecPerSec ((int64_t) 1000000000) +#define testingNsecPerUsec ((int64_t) 1000) +#define testingNsecPerSec ((int64_t) 1000000000) extern testingTimer *testingNewTimer(void); extern void testingFreeTimer(testingTimer *t); @@ -75,8 +75,8 @@ extern void testingTimerStart(testingTimer *t); extern void testingTimerEnd(testingTimer *t); extern int64_t testingTimerNsec(testingTimer *t); -extern char *testingTimerNsecString(int64_t nsec); -extern void testingFreeTimerNsecString(char *s); +extern char *testingNsecString(int64_t nsec); +extern void testingFreeNsecString(char *s); extern void testingRunWithTimeout(testingT *t, int64_t timeout, void (*f)(testingT *t, void *data), void *data, const char *comment, int failNowOnError); diff --git a/test/testing_darwinunix.c b/test/testing_darwinunix.c index e7e41940..f004ed0a 100644 --- a/test/testing_darwinunix.c +++ b/test/testing_darwinunix.c @@ -21,13 +21,13 @@ void testingRunWithTimeout(testingT *t, int64_t timeout, void (*f)(testingT *t, struct itimerval timer, prevtimer; int setitimerError = 0; - timeoutstr = testingTimerNsecString(timeout); + timeoutstr = testingNsecString(timeout); prevsig = signal(SIGALRM, onTimeout); timer.it_interval.tv_sec = 0; timer.it_interval.tv_usec = 0; - timer.it_value.tv_sec = timeout / testingTimerNsecPerSec; - timer.it_value.tv_usec = (timeout % testingTimerNsecPerSec) / testingTimerNsecPerUsec; + timer.it_value.tv_sec = timeout / testingNsecPerSec; + timer.it_value.tv_usec = (timeout % testingNsecPerSec) / testingNsecPerUsec; if (setitimer(ITIMER_REAL, &timer, &prevtimer) != 0) { setitimerError = errno; testingTErrorf(t, "error applying %s timeout: %s", comment, strerror(setitimerError)); @@ -44,7 +44,7 @@ out: if (setitimerError == 0) setitimer(ITIMER_REAL, &prevtimer, NULL); signal(SIGALRM, prevsig); - testingFreeTimerNsecString(timeoutstr); + testingFreeNsecString(timeoutstr); if (failNowOnError) testingTFailNow(t); } diff --git a/test/testing_unix.c b/test/testing_unix.c index 85956b60..9cdd8c46 100644 --- a/test/testing_unix.c +++ b/test/testing_unix.c @@ -47,12 +47,12 @@ int64_t testingTimerNsec(testingTimer *t) sec = c / CLOCKS_PER_SEC; sec64 = (int64_t) sec; - sec64 *= testingTimerNsecPerSec; + sec64 *= testingNsecPerSec; subsec = c % CLOCKS_PER_SEC; subsecf = (double) subsec; subsecf /= CLOCKS_PER_SEC; - subsecf *= testingTimerNsecPerSec; + subsecf *= testingNsecPerSec; subsec64 = (int64_t) subsecf; return sec64 + subsec64; diff --git a/test/testing_windows.c b/test/testing_windows.c index cce9803f..009b32e3 100644 --- a/test/testing_windows.c +++ b/test/testing_windows.c @@ -55,12 +55,12 @@ int64_t testingTimerNsec(testingTimer *t) c = t->end.QuadPart - t->start.QuadPart; sec = c / qpf.QuadPart; - sec *= testingTimerNsecPerSec; + sec *= testingNsecPerSec; subsec = c % qpf.QuadPart; subsecf = (double) subsec; subsecf /= qpf.QuadPart; - subsecf *= testingTimerNsecPerSec; + subsecf *= testingNsecPerSec; subsec = (int64_t) subsecf; return sec + subsec;