Skip to content

Commit

Permalink
Begin test infrastructure.
Browse files Browse the repository at this point in the history
  • Loading branch information
dillof committed Dec 27, 2023
1 parent 9ce9707 commit cf76572
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ enable_testing()
add_subdirectory(foundation/lib)
add_subdirectory(src)
#add_subdirectory(share)
#add_subdirectory(tests)
add_subdirectory(tests)

# write out config file
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
18 changes: 18 additions & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

set(XFAIL_TESTS
)

file(GLOB TESTS ${CMAKE_CURRENT_SOURCE_DIR}/*.test)
foreach(FULL_CASE IN LISTS TESTS)
get_filename_component(CASE ${FULL_CASE} NAME)
add_test(NAME ${CASE} COMMAND nihtest ${CASE})
set_tests_properties(${CASE} PROPERTIES SKIP_RETURN_CODE 77)
endforeach()

foreach(CASE ${XFAIL_TESTS})
set_tests_properties(${CASE} PROPERTIES WILL_FAIL TRUE)
endforeach()

add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND})

CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/nihtest.conf.in ${CMAKE_CURRENT_BINARY_DIR}/nihtest.conf)
7 changes: 7 additions & 0 deletions tests/nihtest.conf.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[settings]
features-files = @CMAKE_BINARY_DIR@/config.h
test-input-directories = @CMAKE_CURRENT_SOURCE_DIR@
program-directories = @CMAKE_CURRENT_BINARY_DIR@
@CMAKE_BINARY_DIR@/src
default-program = fast-ninja
default-working-directory = build
16 changes: 16 additions & 0 deletions tests/rule.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
arguments ..
file build.fninja <>
rule a
command = a $in $out
flags = --verbose
end-of-inline-data
file build/build.ninja {} <>
top_source_directory = ..
source_directory = ..
top_build_directory = .
build_directory = .

rule a
command = a $in $out
flags = --verbose
end-of-inline-data

0 comments on commit cf76572

Please sign in to comment.