Skip to content

Commit

Permalink
ci: move test CMake to seperate directory
Browse files Browse the repository at this point in the history
  • Loading branch information
headblockhead committed Nov 17, 2024
1 parent d337192 commit 85ecc1d
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 48 deletions.
51 changes: 3 additions & 48 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,51 +27,6 @@ add_library(squirrel STATIC
target_include_directories(squirrel PUBLIC include)
set_target_properties(squirrel PROPERTIES PUBLIC_HEADER include/squirrel.h)

include(CTest)
enable_testing()

add_executable(keyboard_press_release tests/keyboard_press_release.c)
target_link_libraries(keyboard_press_release squirrel)
add_test(NAME keyboard_press_release COMMAND keyboard_press_release)

add_executable(keyboard_modifier_press_release tests/keyboard_modifier_press_release.c)
target_link_libraries(keyboard_modifier_press_release squirrel)
add_test(NAME keyboard_modifier_press_release COMMAND keyboard_modifier_press_release)

add_executable(quantum_passthrough_press_release tests/quantum_passthrough_press_release.c)
target_link_libraries(quantum_passthrough_press_release squirrel)
add_test(NAME quantum_passthrough_press_release COMMAND quantum_passthrough_press_release)

add_executable(keyboard_get_keycodes tests/keyboard_get_keycodes.c)
target_link_libraries(keyboard_get_keycodes squirrel)
add_test(NAME keyboard_get_keycodes COMMAND keyboard_get_keycodes)

add_executable(consumer_press_release tests/consumer_press_release.c)
target_link_libraries(consumer_press_release squirrel)
add_test(NAME consumer_press_release COMMAND consumer_press_release)

add_executable(key tests/key.c)
target_link_libraries(key squirrel)
add_test(NAME key COMMAND key)

add_executable(layer_press_release tests/layer_press_release.c)
target_link_libraries(layer_press_release squirrel)
add_test(NAME layer_press_release COMMAND layer_press_release)

add_executable(consumer_activate_deactivate_get_consumer_code tests/consumer_activate_deactivate_get_consumer_code.c)
target_link_libraries(consumer_activate_deactivate_get_consumer_code squirrel)
add_test(NAME consumer_activate_deactivate_get_consumer_code COMMAND consumer_activate_deactivate_get_consumer_code)

add_executable(keyboard_activate_deactivate_keycode tests/keyboard_activate_deactivate_keycode.c)
target_link_libraries(keyboard_activate_deactivate_keycode squirrel)
add_test(NAME keyboard_activate_deactivate_keycode COMMAND keyboard_activate_deactivate_keycode)

add_executable(keyboard_activate_deactivate_get_modifier tests/keyboard_activate_deactivate_get_modifier.c)
target_link_libraries(keyboard_activate_deactivate_get_modifier squirrel)
add_test(NAME keyboard_activate_deactivate_get_modifier COMMAND keyboard_activate_deactivate_get_modifier)

add_executable(keymap tests/keymap.c)
target_link_libraries(keymap squirrel)
target_compile_definitions(keymap PRIVATE SQUIRREL_KEYCOUNT=2)
add_test(NAME keymap COMMAND keymap)

if (BUILD_TESTING)
add_subdirectory(tests)
endif()
1 change: 1 addition & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
runHook postCheck
'';
};
packages.default = packages.squirrel;
checks.squirrel = packages.squirrel.overrideAttrs (oldAttrs: {
doCheck = true;
});
Expand Down
56 changes: 56 additions & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
add_compile_options(-O3)
include(CTest)
enable_testing()

list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMakeModules")
if(CMAKE_COMPILER_IS_GNUCXX)
include(CodeCoverage)
APPEND_COVERAGE_COMPILER_FLAGS()
setup_target_for_coverage_gcovr_html(squirrel squirrel_test coverage)
list(APPEND GCOVR_EXCLUDES "tests/")
endif()

add_executable(keyboard_press_release tests/keyboard_press_release.c)
target_link_libraries(keyboard_press_release squirrel)
add_test(NAME keyboard_press_release COMMAND keyboard_press_release)

add_executable(keyboard_modifier_press_release tests/keyboard_modifier_press_release.c)
target_link_libraries(keyboard_modifier_press_release squirrel)
add_test(NAME keyboard_modifier_press_release COMMAND keyboard_modifier_press_release)

add_executable(quantum_passthrough_press_release tests/quantum_passthrough_press_release.c)
target_link_libraries(quantum_passthrough_press_release squirrel)
add_test(NAME quantum_passthrough_press_release COMMAND quantum_passthrough_press_release)

add_executable(keyboard_get_keycodes tests/keyboard_get_keycodes.c)
target_link_libraries(keyboard_get_keycodes squirrel)
add_test(NAME keyboard_get_keycodes COMMAND keyboard_get_keycodes)

add_executable(consumer_press_release tests/consumer_press_release.c)
target_link_libraries(consumer_press_release squirrel)
add_test(NAME consumer_press_release COMMAND consumer_press_release)

add_executable(key tests/key.c)
target_link_libraries(key squirrel)
add_test(NAME key COMMAND key)

add_executable(layer_press_release tests/layer_press_release.c)
target_link_libraries(layer_press_release squirrel)
add_test(NAME layer_press_release COMMAND layer_press_release)

add_executable(consumer_activate_deactivate_get_consumer_code tests/consumer_activate_deactivate_get_consumer_code.c)
target_link_libraries(consumer_activate_deactivate_get_consumer_code squirrel)
add_test(NAME consumer_activate_deactivate_get_consumer_code COMMAND consumer_activate_deactivate_get_consumer_code)

add_executable(keyboard_activate_deactivate_keycode tests/keyboard_activate_deactivate_keycode.c)
target_link_libraries(keyboard_activate_deactivate_keycode squirrel)
add_test(NAME keyboard_activate_deactivate_keycode COMMAND keyboard_activate_deactivate_keycode)

add_executable(keyboard_activate_deactivate_get_modifier tests/keyboard_activate_deactivate_get_modifier.c)
target_link_libraries(keyboard_activate_deactivate_get_modifier squirrel)
add_test(NAME keyboard_activate_deactivate_get_modifier COMMAND keyboard_activate_deactivate_get_modifier)

add_executable(keymap tests/keymap.c)
target_link_libraries(keymap squirrel)
target_compile_definitions(keymap PRIVATE SQUIRREL_KEYCOUNT=2)
add_test(NAME keymap COMMAND keymap)

0 comments on commit 85ecc1d

Please sign in to comment.