mirror of https://github.com/encounter/SDL.git
test: Add a mode to skip tests that involve arbitrary delays
This can be used as a quick acceptance test for CI workflows. Signed-off-by: Simon McVittie <smcv@collabora.com>
This commit is contained in:
parent
7d2808e30b
commit
40bef98f8b
|
@ -709,6 +709,12 @@ main(int argc, char *argv[])
|
||||||
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
||||||
|
|
||||||
RunBasicTest();
|
RunBasicTest();
|
||||||
|
|
||||||
|
if (SDL_getenv("SDL_TESTS_QUICK") != NULL) {
|
||||||
|
SDL_Log("Not running slower tests");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
RunEpicTest();
|
RunEpicTest();
|
||||||
/* This test is really slow, so don't run it by default */
|
/* This test is really slow, so don't run it by default */
|
||||||
#if 0
|
#if 0
|
||||||
|
|
|
@ -58,6 +58,12 @@ main(int argc, char *argv[])
|
||||||
/* Set the error value for the main thread */
|
/* Set the error value for the main thread */
|
||||||
SDL_SetError("No worries");
|
SDL_SetError("No worries");
|
||||||
|
|
||||||
|
if (SDL_getenv("SDL_TESTS_QUICK") != NULL) {
|
||||||
|
SDL_Log("Not running slower tests");
|
||||||
|
SDL_Quit();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
alive = 1;
|
alive = 1;
|
||||||
thread = SDL_CreateThread(ThreadFunc, NULL, "#1");
|
thread = SDL_CreateThread(ThreadFunc, NULL, "#1");
|
||||||
if (thread == NULL) {
|
if (thread == NULL) {
|
||||||
|
|
|
@ -19,6 +19,7 @@ static int total_channels;
|
||||||
static int active_channel;
|
static int active_channel;
|
||||||
|
|
||||||
#define SAMPLE_RATE_HZ 48000
|
#define SAMPLE_RATE_HZ 48000
|
||||||
|
#define QUICK_TEST_TIME_MSEC 100
|
||||||
#define CHANNEL_TEST_TIME_SEC 5
|
#define CHANNEL_TEST_TIME_SEC 5
|
||||||
#define MAX_AMPLITUDE SDL_MAX_SINT16
|
#define MAX_AMPLITUDE SDL_MAX_SINT16
|
||||||
|
|
||||||
|
@ -188,7 +189,11 @@ main(int argc, char *argv[])
|
||||||
SDL_Log("Playing %d Hz test tone on channel: %s\n", sine_freq, get_channel_name(j, total_channels));
|
SDL_Log("Playing %d Hz test tone on channel: %s\n", sine_freq, get_channel_name(j, total_channels));
|
||||||
|
|
||||||
/* fill_buffer() will increment the active channel */
|
/* fill_buffer() will increment the active channel */
|
||||||
SDL_Delay(CHANNEL_TEST_TIME_SEC * 1000);
|
if (SDL_getenv("SDL_TESTS_QUICK") != NULL) {
|
||||||
|
SDL_Delay(QUICK_TEST_TIME_MSEC);
|
||||||
|
} else {
|
||||||
|
SDL_Delay(CHANNEL_TEST_TIME_SEC * 1000);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_CloseAudioDevice(dev);
|
SDL_CloseAudioDevice(dev);
|
||||||
|
|
|
@ -91,6 +91,12 @@ main(int argc, char *argv[])
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (SDL_getenv("SDL_TESTS_QUICK") != NULL) {
|
||||||
|
SDL_Log("Not running slower tests");
|
||||||
|
SDL_Quit();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
while (argv[arg] && *argv[arg] == '-') {
|
while (argv[arg] && *argv[arg] == '-') {
|
||||||
if (SDL_strcmp(argv[arg], "--prio") == 0) {
|
if (SDL_strcmp(argv[arg], "--prio") == 0) {
|
||||||
testprio = 1;
|
testprio = 1;
|
||||||
|
|
|
@ -54,6 +54,12 @@ main(int argc, char *argv[])
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (SDL_getenv("SDL_TESTS_QUICK") != NULL) {
|
||||||
|
SDL_Log("Not running slower tests");
|
||||||
|
SDL_Quit();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* Verify SDL_GetTicks* acts monotonically increasing, and not erratic. */
|
/* Verify SDL_GetTicks* acts monotonically increasing, and not erratic. */
|
||||||
SDL_Log("Sanity-checking GetTicks\n");
|
SDL_Log("Sanity-checking GetTicks\n");
|
||||||
for (i = 0; i < 1000; ++i) {
|
for (i = 0; i < 1000; ++i) {
|
||||||
|
|
Loading…
Reference in New Issue