mirror of
https://github.com/gnif/LookingGlass.git
synced 2026-08-02 05:12:02 +00:00
[client] tests: replace test defines with the unified ENABLE_TEST define
This commit is contained in:
3
.github/workflows/build.yml
vendored
3
.github/workflows/build.yml
vendored
@@ -262,8 +262,7 @@ jobs:
|
||||
cmake -S client -B client/build-client-tests \
|
||||
-DOPTIMIZE_FOR_NATIVE=OFF \
|
||||
-DENABLE_LIBDECOR=OFF \
|
||||
-DENABLE_TEST_TRANSPORT=ON \
|
||||
-DENABLE_RENDER_TESTS=ON
|
||||
-DENABLE_TESTS=ON
|
||||
|
||||
- name: Build
|
||||
run: cmake --build client/build-client-tests --parallel
|
||||
|
||||
@@ -34,25 +34,14 @@ add_feature_info(ENABLE_OPENGL ENABLE_OPENGL "Legacy OpenGL renderer.")
|
||||
option(ENABLE_EGL "Enable the EGL renderer" ON)
|
||||
add_feature_info(ENABLE_EGL ENABLE_EGL "EGL renderer.")
|
||||
|
||||
option(ENABLE_TEST_TRANSPORT "Enable the test transport" OFF)
|
||||
add_feature_info(ENABLE_TEST_TRANSPORT ENABLE_TEST_TRANSPORT
|
||||
"Synthetic frames for graphics-pipeline validation.")
|
||||
if(ENABLE_TEST_TRANSPORT)
|
||||
add_definitions(-D ENABLE_TEST_TRANSPORT)
|
||||
option(ENABLE_TESTS "Build all client tests and test support" OFF)
|
||||
add_feature_info(ENABLE_TESTS ENABLE_TESTS
|
||||
"Client unit and integration tests with synthetic transport support.")
|
||||
if(ENABLE_TESTS)
|
||||
if(NOT ENABLE_EGL)
|
||||
message(FATAL_ERROR "ENABLE_TESTS requires ENABLE_EGL")
|
||||
endif()
|
||||
|
||||
option(ENABLE_RENDER_TESTS "Build framebuffer rendering integration tests" OFF)
|
||||
add_feature_info(ENABLE_RENDER_TESTS ENABLE_RENDER_TESTS
|
||||
"Pixel-accurate EGL rendering tests using the test transport.")
|
||||
option(ENABLE_TRANSPORT_TESTS "Build transport integration tests"
|
||||
${ENABLE_RENDER_TESTS})
|
||||
add_feature_info(ENABLE_TRANSPORT_TESTS ENABLE_TRANSPORT_TESTS
|
||||
"Transport lifecycle and protocol integration tests.")
|
||||
if(ENABLE_RENDER_TESTS AND NOT ENABLE_TEST_TRANSPORT)
|
||||
message(FATAL_ERROR "ENABLE_RENDER_TESTS requires ENABLE_TEST_TRANSPORT")
|
||||
endif()
|
||||
if(ENABLE_RENDER_TESTS AND NOT ENABLE_EGL)
|
||||
message(FATAL_ERROR "ENABLE_RENDER_TESTS requires ENABLE_EGL")
|
||||
add_definitions(-D ENABLE_TESTS)
|
||||
endif()
|
||||
|
||||
option(ENABLE_BACKTRACE "Enable backtrace support on crash" ON)
|
||||
@@ -249,7 +238,7 @@ target_link_libraries(looking-glass-client
|
||||
cimgui
|
||||
)
|
||||
|
||||
if(ENABLE_RENDER_TESTS OR ENABLE_TRANSPORT_TESTS)
|
||||
if(ENABLE_TESTS)
|
||||
include(CTest)
|
||||
enable_testing()
|
||||
add_subdirectory(tests)
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
#include "render_queue.h"
|
||||
#include "evdev.h"
|
||||
|
||||
#ifdef ENABLE_TEST_TRANSPORT
|
||||
#ifdef ENABLE_TESTS
|
||||
#include "interface/test_capture.h"
|
||||
_Static_assert((int)LG_CAPTURE_RGBA8 == (int)LG_TEST_CAPTURE_RGBA8,
|
||||
"capture format mismatch");
|
||||
@@ -99,7 +99,7 @@ struct CursorState g_cursor;
|
||||
// this structure is initialized in config.c
|
||||
struct AppParams g_params = { 0 };
|
||||
|
||||
#ifdef ENABLE_TEST_TRANSPORT
|
||||
#ifdef ENABLE_TESTS
|
||||
static struct
|
||||
{
|
||||
const char * path;
|
||||
@@ -205,7 +205,7 @@ static void preSwapCallback(void * udata)
|
||||
ringbuffer_push(g_state.renderDuration,
|
||||
&(float) {(nanotime() - *renderStart) * 1e-6f});
|
||||
|
||||
#ifdef ENABLE_TEST_TRANSPORT
|
||||
#ifdef ENABLE_TESTS
|
||||
if (!l_testCapture.enabled || l_testCapture.complete)
|
||||
return;
|
||||
|
||||
@@ -713,7 +713,7 @@ int main_frameThread(void * unused)
|
||||
|
||||
g_state.formatValid = true;
|
||||
formatVersion = format->version;
|
||||
#ifdef ENABLE_TEST_TRANSPORT
|
||||
#ifdef ENABLE_TESTS
|
||||
atomic_store_explicit(&l_testFrameType, format->type,
|
||||
memory_order_release);
|
||||
#endif
|
||||
@@ -803,7 +803,7 @@ int main_frameThread(void * unused)
|
||||
g_state.lastFrameTimeValid = true;
|
||||
|
||||
atomic_fetch_add_explicit(&g_state.frameCount, 1, memory_order_relaxed);
|
||||
#ifdef ENABLE_TEST_TRANSPORT
|
||||
#ifdef ENABLE_TESTS
|
||||
atomic_store_explicit(&l_testFrameSerial, frame.serial,
|
||||
memory_order_release);
|
||||
#endif
|
||||
@@ -1211,7 +1211,7 @@ static int transportSessionProbe(void * opaque)
|
||||
|
||||
static int lg_run(void)
|
||||
{
|
||||
#ifdef ENABLE_TEST_TRANSPORT
|
||||
#ifdef ENABLE_TESTS
|
||||
memset(&l_testCapture, 0, sizeof(l_testCapture));
|
||||
atomic_store_explicit(&l_testFrameSerial, 0, memory_order_relaxed);
|
||||
atomic_store_explicit(&l_testFrameType, FRAME_TYPE_INVALID,
|
||||
|
||||
@@ -17,7 +17,6 @@ set_tests_properties(font-tests PROPERTIES
|
||||
TIMEOUT 10
|
||||
)
|
||||
|
||||
if(ENABLE_TRANSPORT_TESTS)
|
||||
add_executable(lgmp-transport-tests
|
||||
lgmp_transport_test.c
|
||||
)
|
||||
@@ -33,9 +32,7 @@ if(ENABLE_TRANSPORT_TESTS)
|
||||
set_tests_properties(lgmp-transport-tests PROPERTIES
|
||||
TIMEOUT 10
|
||||
)
|
||||
endif()
|
||||
|
||||
if(ENABLE_RENDER_TESTS)
|
||||
find_package(GTest REQUIRED)
|
||||
find_program(WESTON_EXECUTABLE NAMES weston)
|
||||
if(NOT WESTON_EXECUTABLE)
|
||||
@@ -77,4 +74,3 @@ if(ENABLE_RENDER_TESTS)
|
||||
set_tests_properties(render-tests PROPERTIES
|
||||
TIMEOUT 120
|
||||
)
|
||||
endif()
|
||||
|
||||
@@ -22,14 +22,13 @@ luminance, MaxCLL, and MaxFALL in the client log.
|
||||
|
||||
```sh
|
||||
cmake -S client -B client/build \
|
||||
-DENABLE_TEST_TRANSPORT=ON \
|
||||
-DENABLE_RENDER_TESTS=ON
|
||||
-DENABLE_TESTS=ON
|
||||
cmake --build client/build
|
||||
ctest --test-dir client/build --output-on-failure \
|
||||
-R render-tests
|
||||
```
|
||||
|
||||
GoogleTest and Weston are required when `ENABLE_RENDER_TESTS` is enabled.
|
||||
GoogleTest and Weston are required when `ENABLE_TESTS` is enabled.
|
||||
Failed cases retain their capture and client log under `/tmp` and print the
|
||||
artifact paths.
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ endfunction()
|
||||
|
||||
# Add/remove transports here!
|
||||
add_transport(LGMP)
|
||||
if(ENABLE_TEST_TRANSPORT)
|
||||
if(ENABLE_TESTS)
|
||||
add_transport(Test)
|
||||
endif()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user