Switched the test code to use bool wherever appropriate. Will try to do this for the rest of libui, and then I'll deduplicate the allocation and array code.
This commit is contained in:
parent
b9d445554a
commit
c090dacc4a
|
@ -12,24 +12,20 @@ testingSet *beforeTests = NULL;
|
||||||
testingTestInSet(beforeTests, Init)
|
testingTestInSet(beforeTests, Init)
|
||||||
{
|
{
|
||||||
uiInitError err;
|
uiInitError err;
|
||||||
int ret;
|
|
||||||
|
|
||||||
ret = uiInit(NULL, NULL);
|
if (uiInit(NULL, NULL))
|
||||||
if (ret != 0)
|
testingTErrorf(t, "uiInit() with NULL error succeeded; expected failure");
|
||||||
testingTErrorf(t, "uiInit() with NULL error succeeded with return value %d; expected failure", ret);
|
|
||||||
|
|
||||||
memset(&err, 0, sizeof (uiInitError));
|
memset(&err, 0, sizeof (uiInitError));
|
||||||
|
|
||||||
err.Size = 2;
|
err.Size = 2;
|
||||||
ret = uiInit(NULL, &err);
|
if (uiInit(NULL, &err))
|
||||||
if (ret != 0)
|
testingTErrorf(t, "uiInit() with error with invalid size succeeded; expected failure");
|
||||||
testingTErrorf(t, "uiInit() with error with invalid size succeeded with return value %d; expected failure", ret);
|
|
||||||
|
|
||||||
err.Size = sizeof (uiInitError);
|
err.Size = sizeof (uiInitError);
|
||||||
|
|
||||||
ret = uiInit(&err, &err);
|
if (uiInit(&err, &err))
|
||||||
if (ret != 0)
|
testingTErrorf(t, "uiInit() with non-NULL options succeeded; expected failure");
|
||||||
testingTErrorf(t, "uiInit() with non-NULL options succeeded with return value %d; expected failure", err);
|
|
||||||
if (strcmp(err.Message, errInvalidOptions) != 0)
|
if (strcmp(err.Message, errInvalidOptions) != 0)
|
||||||
diff(t, "uiInit() with non-NULL options returned bad error message", "%s",
|
diff(t, "uiInit() with non-NULL options returned bad error message", "%s",
|
||||||
err.Message, errInvalidOptions);
|
err.Message, errInvalidOptions);
|
||||||
|
@ -38,13 +34,11 @@ testingTestInSet(beforeTests, Init)
|
||||||
testingTest(InitAfterInitialized)
|
testingTest(InitAfterInitialized)
|
||||||
{
|
{
|
||||||
uiInitError err;
|
uiInitError err;
|
||||||
int ret;
|
|
||||||
|
|
||||||
memset(&err, 0, sizeof (uiInitError));
|
memset(&err, 0, sizeof (uiInitError));
|
||||||
err.Size = sizeof (uiInitError);
|
err.Size = sizeof (uiInitError);
|
||||||
ret = uiInit(NULL, &err);
|
if (uiInit(NULL, &err))
|
||||||
if (ret != 0)
|
testingTErrorf(t, "uiInit() after a previous successful call succeeded; expected failure");
|
||||||
testingTErrorf(t, "uiInit() after a previous successful call succeeded with return value %d; expected failure", ret);
|
|
||||||
if (strcmp(err.Message, errAlreadyInitialized) != 0)
|
if (strcmp(err.Message, errAlreadyInitialized) != 0)
|
||||||
diff(t, "uiInit() after a previous successful call returned bad error message", "%s",
|
diff(t, "uiInit() after a previous successful call returned bad error message", "%s",
|
||||||
err.Message, errAlreadyInitialized);
|
err.Message, errAlreadyInitialized);
|
||||||
|
|
|
@ -126,7 +126,7 @@ static bool testingprivTRun(testingT *t, testingprivOutbuf *parentbuf)
|
||||||
const char *status;
|
const char *status;
|
||||||
timerTime start, end;
|
timerTime start, end;
|
||||||
char timerstr[timerDurationStringLen];
|
char timerstr[timerDurationStringLen];
|
||||||
int printStatus;
|
bool printStatus;
|
||||||
|
|
||||||
if (t->opts.Verbose)
|
if (t->opts.Verbose)
|
||||||
testingprivOutbufPrintf(parentbuf, "=== RUN %s\n", t->name);
|
testingprivOutbufPrintf(parentbuf, "=== RUN %s\n", t->name);
|
||||||
|
@ -143,7 +143,7 @@ static bool testingprivTRun(testingT *t, testingprivOutbuf *parentbuf)
|
||||||
status = "PASS";
|
status = "PASS";
|
||||||
if (t->failed) {
|
if (t->failed) {
|
||||||
status = "FAIL";
|
status = "FAIL";
|
||||||
printStatus = 1; // always print status on failure
|
printStatus = true; // always print status on failure
|
||||||
} else if (t->skipped)
|
} else if (t->skipped)
|
||||||
// note that failed overrides skipped
|
// note that failed overrides skipped
|
||||||
status = "SKIP";
|
status = "SKIP";
|
||||||
|
|
|
@ -43,7 +43,7 @@ typedef struct testingSet testingSet;
|
||||||
typedef struct testingOptions testingOptions;
|
typedef struct testingOptions testingOptions;
|
||||||
|
|
||||||
struct testingOptions {
|
struct testingOptions {
|
||||||
int Verbose;
|
bool Verbose;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern void testingSetRun(testingSet *set, const struct testingOptions *options, bool *anyRun, bool *anyFailed);
|
extern void testingSetRun(testingSet *set, const struct testingOptions *options, bool *anyRun, bool *anyFailed);
|
||||||
|
|
|
@ -251,7 +251,7 @@ void testingprivOutbufAppendOutbuf(testingprivOutbuf *o, testingprivOutbuf *src)
|
||||||
{
|
{
|
||||||
char *buf;
|
char *buf;
|
||||||
size_t n;
|
size_t n;
|
||||||
int hasTrailingBlankLine;
|
bool hasTrailingBlankLine;
|
||||||
size_t trailingBlankLinePos = 0; // silence incorrect MSVC warning
|
size_t trailingBlankLinePos = 0; // silence incorrect MSVC warning
|
||||||
char *lineStart, *lineEnd;
|
char *lineStart, *lineEnd;
|
||||||
|
|
||||||
|
@ -262,9 +262,9 @@ void testingprivOutbufAppendOutbuf(testingprivOutbuf *o, testingprivOutbuf *src)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// strip trailing blank lines, if any
|
// strip trailing blank lines, if any
|
||||||
hasTrailingBlankLine = 0;
|
hasTrailingBlankLine = false;
|
||||||
if (buf[n - 1] == '\n') {
|
if (buf[n - 1] == '\n') {
|
||||||
hasTrailingBlankLine = 1;
|
hasTrailingBlankLine = true;
|
||||||
while (n > 0 && buf[n - 1] == '\n')
|
while (n > 0 && buf[n - 1] == '\n')
|
||||||
n--;
|
n--;
|
||||||
if (n == 0) {
|
if (n == 0) {
|
||||||
|
|
|
@ -31,10 +31,10 @@ static const struct timerStringPart parts[] = {
|
||||||
static int fillFracPart(char *buf, int precision, int start, uint64_t *unsec)
|
static int fillFracPart(char *buf, int precision, int start, uint64_t *unsec)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int print;
|
bool print;
|
||||||
uint64_t digit;
|
uint64_t digit;
|
||||||
|
|
||||||
print = 0;
|
print = false;
|
||||||
for (i = 0; i < precision; i++) {
|
for (i = 0; i < precision; i++) {
|
||||||
digit = *unsec % 10;
|
digit = *unsec % 10;
|
||||||
print = print || (digit != 0);
|
print = print || (digit != 0);
|
||||||
|
@ -69,7 +69,7 @@ static int fillIntPart(char *buf, int start, uint64_t unsec)
|
||||||
void timerDurationString(timerDuration d, char buf[timerDurationStringLen])
|
void timerDurationString(timerDuration d, char buf[timerDurationStringLen])
|
||||||
{
|
{
|
||||||
uint64_t unsec;
|
uint64_t unsec;
|
||||||
int neg;
|
bool neg;
|
||||||
int start;
|
int start;
|
||||||
const struct timerStringPart *p;
|
const struct timerStringPart *p;
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ void timerDurationString(timerDuration d, char buf[timerDurationStringLen])
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
unsec = (uint64_t) d;
|
unsec = (uint64_t) d;
|
||||||
neg = 0;
|
neg = false;
|
||||||
if (d < 0) {
|
if (d < 0) {
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
// TODO figure out a more explicit way to do this; until then, just go with what the standard says should happen, because it's what we want (TODO verify this)
|
// TODO figure out a more explicit way to do this; until then, just go with what the standard says should happen, because it's what we want (TODO verify this)
|
||||||
|
@ -93,7 +93,7 @@ void timerDurationString(timerDuration d, char buf[timerDurationStringLen])
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma warning(pop)
|
#pragma warning(pop)
|
||||||
#endif
|
#endif
|
||||||
neg = 1;
|
neg = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (p = parts; p->suffix != 0; p++) {
|
for (p = parts; p->suffix != 0; p++) {
|
||||||
|
@ -136,7 +136,7 @@ void timerDurationString(timerDuration d, char buf[timerDurationStringLen])
|
||||||
|
|
||||||
static void int128FromUint64(uint64_t n, timerprivInt128 *out)
|
static void int128FromUint64(uint64_t n, timerprivInt128 *out)
|
||||||
{
|
{
|
||||||
out->neg = 0;
|
out->neg = false;
|
||||||
out->high = 0;
|
out->high = 0;
|
||||||
out->low = n;
|
out->low = n;
|
||||||
}
|
}
|
||||||
|
@ -147,7 +147,7 @@ static void int128FromInt64(int64_t n, timerprivInt128 *out)
|
||||||
int128FromUint64((uint64_t) n, out);
|
int128FromUint64((uint64_t) n, out);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
out->neg = 1;
|
out->neg = true;
|
||||||
out->high = 0;
|
out->high = 0;
|
||||||
// C99 §6.2.6.2 resticts the possible signed integer representations in C to either sign-magnitude, 1's complement, or 2's complement.
|
// C99 §6.2.6.2 resticts the possible signed integer representations in C to either sign-magnitude, 1's complement, or 2's complement.
|
||||||
// Therefore, INT64_MIN will always be either -INT64_MAX or -INT64_MAX - 1, so we can safely do this to see if we need to special-case INT64_MIN as -INT64_MIN cannot be safely represented, or if we can just say -n as that can be safely represented.
|
// Therefore, INT64_MIN will always be either -INT64_MAX or -INT64_MAX - 1, so we can safely do this to see if we need to special-case INT64_MIN as -INT64_MIN cannot be safely represented, or if we can just say -n as that can be safely represented.
|
||||||
|
@ -230,13 +230,13 @@ static void int128BitSet(timerprivInt128 *x, int i)
|
||||||
|
|
||||||
static void int128MulDiv64(timerprivInt128 *x, timerprivInt128 *y, timerprivInt128 *z, timerprivInt128 *quot)
|
static void int128MulDiv64(timerprivInt128 *x, timerprivInt128 *y, timerprivInt128 *z, timerprivInt128 *quot)
|
||||||
{
|
{
|
||||||
int finalNeg;
|
bool finalNeg;
|
||||||
uint64_t x64high, x64low;
|
uint64_t x64high, x64low;
|
||||||
uint64_t y64high, y64low;
|
uint64_t y64high, y64low;
|
||||||
timerprivInt128 add, numer, rem;
|
timerprivInt128 add, numer, rem;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
finalNeg = 0;
|
finalNeg = false;
|
||||||
if (x->neg)
|
if (x->neg)
|
||||||
finalNeg = !finalNeg;
|
finalNeg = !finalNeg;
|
||||||
if (y->neg)
|
if (y->neg)
|
||||||
|
@ -248,7 +248,7 @@ static void int128MulDiv64(timerprivInt128 *x, timerprivInt128 *y, timerprivInt1
|
||||||
|
|
||||||
// first, multiply x and y into numer
|
// first, multiply x and y into numer
|
||||||
// this assumes x->high == y->high == 0
|
// this assumes x->high == y->high == 0
|
||||||
numer.neg = 0;
|
numer.neg = false;
|
||||||
// the idea is if x = (a * 2^32) + b and y = (c * 2^32) + d, we can express x * y as ((a * 2^32) + b) * ((c * 2^32) + d)...
|
// the idea is if x = (a * 2^32) + b and y = (c * 2^32) + d, we can express x * y as ((a * 2^32) + b) * ((c * 2^32) + d)...
|
||||||
x64high = (x->low >> 32) & 0xFFFFFFFF;
|
x64high = (x->low >> 32) & 0xFFFFFFFF;
|
||||||
x64low = x->low & 0xFFFFFFFF;
|
x64low = x->low & 0xFFFFFFFF;
|
||||||
|
@ -257,7 +257,7 @@ static void int128MulDiv64(timerprivInt128 *x, timerprivInt128 *y, timerprivInt1
|
||||||
// and we can expand that out to get...
|
// and we can expand that out to get...
|
||||||
numer.high = x64high * y64high; // a * c * 2^64 +
|
numer.high = x64high * y64high; // a * c * 2^64 +
|
||||||
numer.low = x64low * y64low; // b * d +
|
numer.low = x64low * y64low; // b * d +
|
||||||
add.neg = 0;
|
add.neg = false;
|
||||||
add.high = x64high * y64low; // a * d * 2^32 +
|
add.high = x64high * y64low; // a * d * 2^32 +
|
||||||
add.low = (add.high & 0xFFFFFFFF) << 32;
|
add.low = (add.high & 0xFFFFFFFF) << 32;
|
||||||
add.high >>= 32;
|
add.high >>= 32;
|
||||||
|
@ -273,7 +273,7 @@ static void int128MulDiv64(timerprivInt128 *x, timerprivInt128 *y, timerprivInt1
|
||||||
// (Apple also rejects quotients > UINT64_MAX; we won't)
|
// (Apple also rejects quotients > UINT64_MAX; we won't)
|
||||||
quot->high = 0;
|
quot->high = 0;
|
||||||
quot->low = 0;
|
quot->low = 0;
|
||||||
rem.neg = 0;
|
rem.neg = false;
|
||||||
rem.high = 0;
|
rem.high = 0;
|
||||||
rem.low = 0;
|
rem.low = 0;
|
||||||
for (i = 127; i >= 0; i--) {
|
for (i = 127; i >= 0; i--) {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
// 2 may 2019
|
// 2 may 2019
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
typedef int64_t timerDuration;
|
typedef int64_t timerDuration;
|
||||||
|
@ -32,6 +33,6 @@ typedef uint64_t timerSysError;
|
||||||
#define timerSysErrorFmtArg(x) strerror((int) x), ((int) x)
|
#define timerSysErrorFmtArg(x) strerror((int) x), ((int) x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern timerSysError timerRunWithTimeout(timerDuration d, void (*f)(void *data), void *data, int *timedOut);
|
extern timerSysError timerRunWithTimeout(timerDuration d, void (*f)(void *data), void *data, bool *timedOut);
|
||||||
|
|
||||||
extern timerSysError timerSleep(timerDuration d);
|
extern timerSysError timerSleep(timerDuration d);
|
||||||
|
|
|
@ -171,18 +171,18 @@ static void teardownNonReentrance(void)
|
||||||
mustpthread_mutex_unlock(&nonReentranceMutex);
|
mustpthread_mutex_unlock(&nonReentranceMutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
timerSysError timerRunWithTimeout(timerDuration d, void (*f)(void *data), void *data, int *timedOut)
|
timerSysError timerRunWithTimeout(timerDuration d, void (*f)(void *data), void *data, bool *timedOut)
|
||||||
{
|
{
|
||||||
sigset_t sigalrm, allsigs;
|
sigset_t sigalrm, allsigs;
|
||||||
sigset_t prevMask;
|
sigset_t prevMask;
|
||||||
volatile int restorePrevMask = 0;
|
volatile bool restorePrevMask = false;
|
||||||
struct sigaction sig;
|
struct sigaction sig;
|
||||||
volatile int restoreSignal = 0;
|
volatile bool restoreSignal = false;
|
||||||
struct itimerval duration;
|
struct itimerval duration;
|
||||||
volatile int destroyTimer = 0;
|
volatile bool destroyTimer = false;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
*timedOut = 0;
|
*timedOut = false;
|
||||||
err = setupNonReentrance();
|
err = setupNonReentrance();
|
||||||
if (err != 0)
|
if (err != 0)
|
||||||
return (timerSysError) err;
|
return (timerSysError) err;
|
||||||
|
@ -202,7 +202,7 @@ timerSysError timerRunWithTimeout(timerDuration d, void (*f)(void *data), void *
|
||||||
err = pthread_sigmask(SIG_BLOCK, &sigalrm, &prevMask);
|
err = pthread_sigmask(SIG_BLOCK, &sigalrm, &prevMask);
|
||||||
if (err != 0)
|
if (err != 0)
|
||||||
return (timerSysError) err;
|
return (timerSysError) err;
|
||||||
restorePrevMask = 1;
|
restorePrevMask = true;
|
||||||
|
|
||||||
if (setjmp(p.retpos) == 0) {
|
if (setjmp(p.retpos) == 0) {
|
||||||
sig.sa_mask = allsigs;
|
sig.sa_mask = allsigs;
|
||||||
|
@ -213,7 +213,7 @@ timerSysError timerRunWithTimeout(timerDuration d, void (*f)(void *data), void *
|
||||||
err = errno;
|
err = errno;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
restoreSignal = 1;
|
restoreSignal = true;
|
||||||
|
|
||||||
duration.it_interval.tv_sec = 0;
|
duration.it_interval.tv_sec = 0;
|
||||||
duration.it_interval.tv_usec = 0;
|
duration.it_interval.tv_usec = 0;
|
||||||
|
@ -224,7 +224,7 @@ timerSysError timerRunWithTimeout(timerDuration d, void (*f)(void *data), void *
|
||||||
err = errno;
|
err = errno;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
destroyTimer = 1;
|
destroyTimer = true;
|
||||||
|
|
||||||
// and fire away
|
// and fire away
|
||||||
err = pthread_sigmask(SIG_UNBLOCK, &sigalrm, NULL);
|
err = pthread_sigmask(SIG_UNBLOCK, &sigalrm, NULL);
|
||||||
|
@ -233,7 +233,7 @@ timerSysError timerRunWithTimeout(timerDuration d, void (*f)(void *data), void *
|
||||||
|
|
||||||
(*f)(data);
|
(*f)(data);
|
||||||
} else
|
} else
|
||||||
*timedOut = 1;
|
*timedOut = true;
|
||||||
err = 0;
|
err = 0;
|
||||||
|
|
||||||
out:
|
out:
|
||||||
|
|
|
@ -324,16 +324,16 @@ static unsigned __stdcall timerThreadProc(void *data)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
timerSysError timerRunWithTimeout(timerDuration d, void (*f)(void *data), void *data, int *timedOut)
|
timerSysError timerRunWithTimeout(timerDuration d, void (*f)(void *data), void *data, bool *timedOut)
|
||||||
{
|
{
|
||||||
struct timeoutParams *p;
|
struct timeoutParams *p;
|
||||||
int doTeardownNonReentrance = 0;
|
bool doTeardownNonReentrance = false;
|
||||||
MSG msg;
|
MSG msg;
|
||||||
volatile HANDLE timerThread = NULL;
|
volatile HANDLE timerThread = NULL;
|
||||||
LARGE_INTEGER duration;
|
LARGE_INTEGER duration;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
*timedOut = 0;
|
*timedOut = false;
|
||||||
// we use a pointer to heap memory here to avoid volatile kludges
|
// we use a pointer to heap memory here to avoid volatile kludges
|
||||||
p = (struct timeoutParams *) malloc(sizeof (struct timeoutParams));
|
p = (struct timeoutParams *) malloc(sizeof (struct timeoutParams));
|
||||||
if (p == NULL)
|
if (p == NULL)
|
||||||
|
@ -343,7 +343,7 @@ timerSysError timerRunWithTimeout(timerDuration d, void (*f)(void *data), void *
|
||||||
hr = setupNonReentrance(p);
|
hr = setupNonReentrance(p);
|
||||||
if (hr != S_OK)
|
if (hr != S_OK)
|
||||||
goto out;
|
goto out;
|
||||||
doTeardownNonReentrance = 1;
|
doTeardownNonReentrance = true;
|
||||||
|
|
||||||
// to ensure that the PostThreadMessage() above will not fail because the thread doesn't have a message queue
|
// to ensure that the PostThreadMessage() above will not fail because the thread doesn't have a message queue
|
||||||
PeekMessage(&msg, NULL, WM_USER, WM_USER, PM_NOREMOVE);
|
PeekMessage(&msg, NULL, WM_USER, WM_USER, PM_NOREMOVE);
|
||||||
|
@ -386,12 +386,11 @@ timerSysError timerRunWithTimeout(timerDuration d, void (*f)(void *data), void *
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
(*f)(data);
|
(*f)(data);
|
||||||
*timedOut = 0;
|
|
||||||
} else if (p->hr != S_OK) {
|
} else if (p->hr != S_OK) {
|
||||||
hr = p->hr;
|
hr = p->hr;
|
||||||
goto out;
|
goto out;
|
||||||
} else
|
} else
|
||||||
*timedOut = 1;
|
*timedOut = true;
|
||||||
hr = S_OK;
|
hr = S_OK;
|
||||||
|
|
||||||
out:
|
out:
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
typedef struct timerprivInt128 timerprivInt128;
|
typedef struct timerprivInt128 timerprivInt128;
|
||||||
|
|
||||||
struct timerprivInt128 {
|
struct timerprivInt128 {
|
||||||
int neg;
|
bool neg;
|
||||||
uint64_t high;
|
uint64_t high;
|
||||||
uint64_t low;
|
uint64_t low;
|
||||||
};
|
};
|
||||||
|
|
|
@ -38,11 +38,10 @@ int main(int argc, char *argv[])
|
||||||
testingOptions opts;
|
testingOptions opts;
|
||||||
bool anyRun = false, anyFailed = false;
|
bool anyRun = false, anyFailed = false;
|
||||||
uiInitError err;
|
uiInitError err;
|
||||||
int ret;
|
|
||||||
|
|
||||||
memset(&opts, 0, sizeof (testingOptions));
|
memset(&opts, 0, sizeof (testingOptions));
|
||||||
if (argc == 2 && strcmp(argv[1], "-v") == 0)
|
if (argc == 2 && strcmp(argv[1], "-v") == 0)
|
||||||
opts.Verbose = 1;
|
opts.Verbose = true;
|
||||||
else if (argc != 1) {
|
else if (argc != 1) {
|
||||||
fprintf(stderr, "usage: %s [-v]\n", argv[0]);
|
fprintf(stderr, "usage: %s [-v]\n", argv[0]);
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -51,8 +50,7 @@ int main(int argc, char *argv[])
|
||||||
runSetORingResults(beforeTests, &opts, &anyRun, &anyFailed);
|
runSetORingResults(beforeTests, &opts, &anyRun, &anyFailed);
|
||||||
memset(&err, 0, sizeof (uiInitError));
|
memset(&err, 0, sizeof (uiInitError));
|
||||||
err.Size = sizeof (uiInitError);
|
err.Size = sizeof (uiInitError);
|
||||||
ret = uiInit(NULL, &err);
|
if (!uiInit(NULL, &err)) {
|
||||||
if (ret == 0) {
|
|
||||||
fprintf(stderr, "uiInit() failed: %s; can't continue\n", err.Message);
|
fprintf(stderr, "uiInit() failed: %s; can't continue\n", err.Message);
|
||||||
printf("FAIL\n");
|
printf("FAIL\n");
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
extern void timeoutMain(void *data);
|
extern void timeoutMain(void *data);
|
||||||
#define timeout_uiMain(t, d) { \
|
#define timeout_uiMain(t, d) { \
|
||||||
timerSysError err; \
|
timerSysError err; \
|
||||||
int timedOut; \
|
bool timedOut; \
|
||||||
err = timerRunWithTimeout(d, timeoutMain, NULL, &timedOut); \
|
err = timerRunWithTimeout(d, timeoutMain, NULL, &timedOut); \
|
||||||
if (err != 0) \
|
if (err != 0) \
|
||||||
testingTErrorf(t, "error running uiMain() in timeout: " timerSysErrorFmt, timerSysErrorFmtArg(err)); \
|
testingTErrorf(t, "error running uiMain() in timeout: " timerSysErrorFmt, timerSysErrorFmtArg(err)); \
|
||||||
|
|
Loading…
Reference in New Issue