mirror of
https://github.com/dankamongmen/notcurses
synced 2025-03-09 09:09:03 -04:00
CMake: improvements to testing usability
Replace USE_TESTS with BUILD_TESTING variable already exported by CTest. Use the CMake 3.17 CMAKE_CTEST_ARGUMENTS to pass "-V" to ctest. #651
This commit is contained in:
parent
0766007a77
commit
89ffb6658e
@ -12,6 +12,7 @@ set(CMAKE_CXX_VISIBILITY_PRESET hidden)
|
|||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
|
|
||||||
###################### USER-SELECTABLE OPTIONS ###########################
|
###################### USER-SELECTABLE OPTIONS ###########################
|
||||||
|
# BUILD_TESTING is defined by CTest
|
||||||
option(DFSG_BUILD "DFSG build (no non-free media/code)" OFF)
|
option(DFSG_BUILD "DFSG build (no non-free media/code)" OFF)
|
||||||
option(USE_COVERAGE "Assess code coverage with llvm-cov/lcov" OFF)
|
option(USE_COVERAGE "Assess code coverage with llvm-cov/lcov" OFF)
|
||||||
option(USE_DOXYGEN "Build HTML cross reference with doxygen" OFF)
|
option(USE_DOXYGEN "Build HTML cross reference with doxygen" OFF)
|
||||||
@ -22,7 +23,6 @@ option(USE_QRCODEGEN "Disable libqrcodegen QR code support" ON)
|
|||||||
option(USE_RUST "Build Rust wrappers (experimental)" OFF)
|
option(USE_RUST "Build Rust wrappers (experimental)" OFF)
|
||||||
option(USE_SIXEL "Build Sixel support" OFF)
|
option(USE_SIXEL "Build Sixel support" OFF)
|
||||||
option(USE_STATIC "Build static libraries (in addition to shared)" ON)
|
option(USE_STATIC "Build static libraries (in addition to shared)" ON)
|
||||||
option(USE_TESTS "Build doctest unit tests" ON)
|
|
||||||
set(USE_MULTIMEDIA "ffmpeg" CACHE STRING "Multimedia engine, one of 'ffmpeg', 'oiio', or 'none'")
|
set(USE_MULTIMEDIA "ffmpeg" CACHE STRING "Multimedia engine, one of 'ffmpeg', 'oiio', or 'none'")
|
||||||
set_property(CACHE USE_MULTIMEDIA PROPERTY STRINGS ffmpeg oiio none)
|
set_property(CACHE USE_MULTIMEDIA PROPERTY STRINGS ffmpeg oiio none)
|
||||||
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS Debug Release MinSizeRel RelWithDebInfo Coverage)
|
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS Debug Release MinSizeRel RelWithDebInfo Coverage)
|
||||||
@ -84,7 +84,7 @@ if(NOT "${HAVE_QRCODEGEN_H}")
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
find_library(LIBRT rt)
|
find_library(LIBRT rt)
|
||||||
if(${USE_TESTS})
|
if(${BUILD_TESTING})
|
||||||
find_package(doctest 2.3.5 REQUIRED)
|
find_package(doctest 2.3.5 REQUIRED)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -526,10 +526,8 @@ target_compile_definitions(notcurses-view
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Testing
|
# Testing
|
||||||
if(${USE_TESTS})
|
include(CTest)
|
||||||
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
|
if(${BUILD_TESTING})
|
||||||
include(CTest)
|
|
||||||
endif()
|
|
||||||
file(GLOB TESTSRCS CONFIGURE_DEPENDS tests/*.cpp)
|
file(GLOB TESTSRCS CONFIGURE_DEPENDS tests/*.cpp)
|
||||||
add_executable(notcurses-tester ${TESTSRCS})
|
add_executable(notcurses-tester ${TESTSRCS})
|
||||||
target_include_directories(notcurses-tester
|
target_include_directories(notcurses-tester
|
||||||
@ -543,7 +541,8 @@ target_link_libraries(notcurses-tester
|
|||||||
notcurses++
|
notcurses++
|
||||||
"${TERMINFO_LIBRARIES}"
|
"${TERMINFO_LIBRARIES}"
|
||||||
)
|
)
|
||||||
|
# sadly, this doesn't take effect until CMake 3.17...
|
||||||
|
set(CMAKE_CTEST_ARGUMENTS "-V")
|
||||||
enable_testing()
|
enable_testing()
|
||||||
add_test(
|
add_test(
|
||||||
NAME notcurses-tester
|
NAME notcurses-tester
|
||||||
@ -688,7 +687,7 @@ install(PROGRAMS src/pydemo/notcurses-pydemo DESTINATION bin)
|
|||||||
install(TARGETS notcurses-demo DESTINATION bin)
|
install(TARGETS notcurses-demo DESTINATION bin)
|
||||||
install(TARGETS notcurses-input DESTINATION bin)
|
install(TARGETS notcurses-input DESTINATION bin)
|
||||||
install(TARGETS notcurses-ncreel DESTINATION bin)
|
install(TARGETS notcurses-ncreel DESTINATION bin)
|
||||||
if(${USE_TESTS})
|
if(${BUILD_TESTING})
|
||||||
install(TARGETS notcurses-tester DESTINATION bin)
|
install(TARGETS notcurses-tester DESTINATION bin)
|
||||||
endif()
|
endif()
|
||||||
install(TARGETS notcurses-tetris DESTINATION bin)
|
install(TARGETS notcurses-tetris DESTINATION bin)
|
||||||
|
12
README.md
12
README.md
@ -131,9 +131,13 @@ or `none`. Without a multimedia engine, Notcurses will be unable to decode
|
|||||||
images and videos.
|
images and videos.
|
||||||
|
|
||||||
Run unit tests with `make test` following a successful build. If you have unit
|
Run unit tests with `make test` following a successful build. If you have unit
|
||||||
test failures, *please* file a bug including the output of `./notcurses-tester
|
test failures, *please* file a bug including the output of
|
||||||
> log 2>&1` (`make test` also runs `notcurses-tester`, but hides important
|
|
||||||
output). Install with `make install` following a successful build.
|
`./notcurses-tester -p ../data`
|
||||||
|
|
||||||
|
(`make test` also runs `notcurses-tester`, but hides important output).
|
||||||
|
|
||||||
|
Install with `make install` following a successful build.
|
||||||
|
|
||||||
To watch the bitchin' demo, run `./notcurses-demo -p ../data`. More details can
|
To watch the bitchin' demo, run `./notcurses-demo -p ../data`. More details can
|
||||||
be found on the `notcurses-demo(1)` man page.
|
be found on the `notcurses-demo(1)` man page.
|
||||||
@ -144,12 +148,12 @@ To set the C compiler, export `CC`. To set the C++ compiler, export `CXX`. The
|
|||||||
`CMAKE_BUILD_TYPE` CMake variable can be defined to any of its standard values,
|
`CMAKE_BUILD_TYPE` CMake variable can be defined to any of its standard values,
|
||||||
but must be `Debug` for use of `USE_COVERAGE`.
|
but must be `Debug` for use of `USE_COVERAGE`.
|
||||||
|
|
||||||
|
* `BUILD_TESTING`: build `notcurses-tester` using doctest
|
||||||
* `DFSG_BUILD`: leave out all content considered non-free under the Debian Free
|
* `DFSG_BUILD`: leave out all content considered non-free under the Debian Free
|
||||||
Software Guidelines.
|
Software Guidelines.
|
||||||
* `USE_MULTIMEDIA`: `ffmpeg` for FFmpeg, `oiio` for OpenImageIO, `none` for none.
|
* `USE_MULTIMEDIA`: `ffmpeg` for FFmpeg, `oiio` for OpenImageIO, `none` for none.
|
||||||
* `USE_QRCODEGEN`: build qrcode support via libqrcodegen
|
* `USE_QRCODEGEN`: build qrcode support via libqrcodegen
|
||||||
* `USE_SIXEL`: build Sixel support via libsixel
|
* `USE_SIXEL`: build Sixel support via libsixel
|
||||||
* `USE_TESTS`: build `notcurses-tester` using doctest
|
|
||||||
* `USE_PANDOC`: build man pages with pandoc
|
* `USE_PANDOC`: build man pages with pandoc
|
||||||
* `USE_DOXYGEN`: build interlinked HTML documentation with Doxygen
|
* `USE_DOXYGEN`: build interlinked HTML documentation with Doxygen
|
||||||
* `USE_PYTHON`: build the Python wrappers
|
* `USE_PYTHON`: build the Python wrappers
|
||||||
|
@ -330,7 +330,6 @@ TEST_CASE("Metric") {
|
|||||||
uintmax_t val = 9027854993;
|
uintmax_t val = 9027854993;
|
||||||
uintmax_t decimal = GIG;
|
uintmax_t decimal = GIG;
|
||||||
REQUIRE(qprefix(val, decimal, buf, 0));
|
REQUIRE(qprefix(val, decimal, buf, 0));
|
||||||
fprintf(stderr, "%s %s\n", gold, buf);
|
|
||||||
CHECK(!strcmp(buf, gold));
|
CHECK(!strcmp(buf, gold));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -176,7 +176,6 @@ TEST_CASE("Rotate") {
|
|||||||
for(int i = 0 ; i < height * width / 2 ; ++i){
|
for(int i = 0 ; i < height * width / 2 ; ++i){
|
||||||
if(rgbaret[i] & CELL_BG_MASK){
|
if(rgbaret[i] & CELL_BG_MASK){
|
||||||
CHECK(rgbaret[i] == htonl(rgba[i]));
|
CHECK(rgbaret[i] == htonl(rgba[i]));
|
||||||
fprintf(stderr, "%08x %08x\n", rgbaret[i], htonl(rgba[i]));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
free(rgbaret);
|
free(rgbaret);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user