diff --git a/client/tests/CMakeLists.txt b/client/tests/CMakeLists.txt index 01d873b7..dc012f16 100644 --- a/client/tests/CMakeLists.txt +++ b/client/tests/CMakeLists.txt @@ -950,7 +950,10 @@ add_executable(frame-timing-tests target_compile_definitions(frame-timing-tests PRIVATE CIMGUI_DEFINE_ENUMS_AND_STRUCTS=1 ) -target_compile_options(frame-timing-tests PRIVATE -O1) +target_compile_options(frame-timing-tests PRIVATE + -O1 + "$<$:-fwhole-program>" +) target_include_directories(frame-timing-tests PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../src" "${PROJECT_TOP}/repos/gui/cimgui" diff --git a/client/tests/audio_test.c b/client/tests/audio_test.c index 08d93af8..09380403 100644 --- a/client/tests/audio_test.c +++ b/client/tests/audio_test.c @@ -421,7 +421,7 @@ static void setStatus(struct Provider * p, bool available, p->status(p->statusOpaque, &status); } -static bool near(float a, float expected) +static bool isNear(float a, float expected) { return fabsf(a - expected) < 0.000001f; } @@ -476,9 +476,9 @@ static void testConvert(void) float out[4]; const uint8_t u8[] = { 0, 128, 255 }; CHECK(audioConvertToFloat(out, u8, ARRAY_LENGTH(u8), LG_AUDIO_FMT_U8)); - CHECK(near(out[0], -1.0f)); - CHECK(near(out[1], 0.0f)); - CHECK(near(out[2], 127.0f / 128.0f)); + CHECK(isNear(out[0], -1.0f)); + CHECK(isNear(out[1], 0.0f)); + CHECK(isNear(out[2], 127.0f / 128.0f)); const uint8_t s16[] = { @@ -488,10 +488,10 @@ static void testConvert(void) 0xff, 0x7f, }; CHECK(audioConvertToFloat(out, s16, 4, LG_AUDIO_FMT_S16_LE)); - CHECK(near(out[0], -1.0f)); - CHECK(near(out[1], -1.0f / 32768.0f)); - CHECK(near(out[2], 0.0f)); - CHECK(near(out[3], 32767.0f / 32768.0f)); + CHECK(isNear(out[0], -1.0f)); + CHECK(isNear(out[1], -1.0f / 32768.0f)); + CHECK(isNear(out[2], 0.0f)); + CHECK(isNear(out[3], 32767.0f / 32768.0f)); const uint8_t s24[] = { @@ -499,8 +499,8 @@ static void testConvert(void) 0xff, 0xff, 0x7f, }; CHECK(audioConvertToFloat(out, s24, 2, LG_AUDIO_FMT_S24_LE)); - CHECK(near(out[0], -1.0f)); - CHECK(near(out[1], 8388607.0f / 8388608.0f)); + CHECK(isNear(out[0], -1.0f)); + CHECK(isNear(out[1], 8388607.0f / 8388608.0f)); const uint8_t s32[] = { @@ -508,8 +508,8 @@ static void testConvert(void) 0xff, 0xff, 0xff, 0x7f, }; CHECK(audioConvertToFloat(out, s32, 2, LG_AUDIO_FMT_S32_LE)); - CHECK(near(out[0], -1.0f)); - CHECK(near(out[1], 1.0f)); + CHECK(isNear(out[0], -1.0f)); + CHECK(isNear(out[1], 1.0f)); const uint8_t f32le[] = { @@ -517,12 +517,12 @@ static void testConvert(void) 0x00, 0x00, 0x40, 0x3f, }; CHECK(audioConvertToFloat(out, f32le, 2, LG_AUDIO_FMT_F32_LE)); - CHECK(near(out[0], -0.25f)); - CHECK(near(out[1], 0.75f)); + CHECK(isNear(out[0], -0.25f)); + CHECK(isNear(out[1], 0.75f)); const float f32ne[] = { -0.25f, 0.75f }; CHECK(audioConvertToFloat(out, f32ne, 2, LG_AUDIO_FMT_F32_NE)); - CHECK(near(out[0], -0.25f)); - CHECK(near(out[1], 0.75f)); + CHECK(isNear(out[0], -0.25f)); + CHECK(isNear(out[1], 0.75f)); const uint8_t f64le[] = { @@ -530,8 +530,8 @@ static void testConvert(void) 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x3f, }; CHECK(audioConvertToFloat(out, f64le, 2, LG_AUDIO_FMT_F64_LE)); - CHECK(near(out[0], -0.5f)); - CHECK(near(out[1], 0.125f)); + CHECK(isNear(out[0], -0.5f)); + CHECK(isNear(out[1], 0.125f)); CHECK(!audioConvertToFloat(NULL, f32ne, 2, LG_AUDIO_FMT_F32_NE)); CHECK(!audioConvertToFloat(out, NULL, 2, LG_AUDIO_FMT_F32_NE)); CHECK(!audioConvertToFloat(out, f32ne, 2, (LG_AudioSampleFormat)-1)); diff --git a/client/tests/common_platform_test.c b/client/tests/common_platform_test.c index 0a885157..bf6389f6 100644 --- a/client/tests/common_platform_test.c +++ b/client/tests/common_platform_test.c @@ -20,6 +20,7 @@ #include "test.h" +#include "common/debug.h" #include "common/event.h" #include "common/filesystem.h" #include "common/random.h" @@ -203,6 +204,7 @@ static void testFilesystem(void) int main(void) { + debug_init(); lgTimeInit(); testEventWaits(); testManualReset(); diff --git a/client/tests/config_message_test.c b/client/tests/config_message_test.c index a2521a7e..9772d82b 100644 --- a/client/tests/config_message_test.c +++ b/client/tests/config_message_test.c @@ -356,10 +356,10 @@ static void testCfgValues(void) CHECK(!resampler->parser(resampler, "linear")); struct Option * renderer = opt("app", "renderer"); - CHECK(renderer->parser(renderer, "OpenGL")); + CHECK(renderer->parser(renderer, "EGL")); CHECK(g_params.forceRenderer); - CHECK(g_params.forceRendererIndex == 1); - checkStr(renderer->toString(renderer), "OpenGL"); + CHECK(g_params.forceRendererIndex == 0); + checkStr(renderer->toString(renderer), "EGL"); CHECK(renderer->parser(renderer, "auto")); CHECK(!g_params.forceRenderer); checkStr(renderer->toString(renderer), "auto"); @@ -406,7 +406,7 @@ static void testCfgSize(void) static void loadCfg(const char * text) { - char path[] = "/tmp/lg-config-test-XXXXXX"; + char path[] = "lg-config-test-XXXXXX"; const int fd = mkstemp(path); CHECK(fd >= 0); const size_t size = strlen(text);