From ce31a1d51f2cef8867bd5574e86df27633787628 Mon Sep 17 00:00:00 2001 From: Martijn van Beurden Date: Mon, 10 Jan 2022 19:35:39 +0100 Subject: [CMake] Enable testing through busybox With this commit, it is possible to run the full test suite on Windows machines when busybox-w32 is installed. This program is available through chocolatey with 'choco install busybox' CMake tests for availability of busybox and use if available. As chocolatey is the preferred method of fetching software for Github actions, this commit paves the way for running the full test suite on Windows for CI --- test/CMakeLists.txt | 54 +++++++++++++++++++++++++++++------------------------ test/common.sh.in | 3 +++ 2 files changed, 33 insertions(+), 24 deletions(-) (limited to 'test') diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 945684c7..5935c5d5 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -3,23 +3,29 @@ if(WIN32) endif() if(NOT UNIX) - add_test(NAME libFLAC - COMMAND $ - WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) - if(BUILD_CXXLIBS) - add_test(NAME libFLAC++ - COMMAND $ + find_program(BUSYBOX_EXE busybox) + if(NOT BUSYBOX_EXE) + message(STATUS "Could NOT find busybox, only basic tests are enabled") + add_test(NAME libFLAC + COMMAND $ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) + if(BUILD_CXXLIBS) + add_test(NAME libFLAC++ + COMMAND $ + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) + endif() + if(BUILD_PROGRAMS) + add_test(NAME flac_help + COMMAND $ --help + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) + add_test(NAME metaflac_help + COMMAND $ --help + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) + endif() + return() + else() + set(BUSYBOX_CMD "sh") endif() - if(BUILD_PROGRAMS) - add_test(NAME flac_help - COMMAND $ --help - WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) - add_test(NAME metaflac_help - COMMAND $ --help - WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) - endif() - return() endif() set(top_srcdir "${PROJECT_SOURCE_DIR}") @@ -29,38 +35,38 @@ configure_file(common.sh.in common.sh @ONLY) set(ALL_TESTS libFLAC grabbag flac metaflac replaygain seeking streams compression) add_test(NAME libFLAC - COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/test_libFLAC.sh" + COMMAND ${BUSYBOX_EXE} ${BUSYBOX_CMD} "${CMAKE_CURRENT_SOURCE_DIR}/test_libFLAC.sh" WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") if(BUILD_CXXLIBS) add_test(NAME libFLAC++ - COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/test_libFLAC++.sh" + COMMAND ${BUSYBOX_EXE} ${BUSYBOX_CMD} "${CMAKE_CURRENT_SOURCE_DIR}/test_libFLAC++.sh" WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") list(APPEND ALL_TESTS libFLAC++) endif() file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/cuesheets") add_test(NAME grabbag - COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/test_grabbag.sh" + COMMAND ${BUSYBOX_EXE} ${BUSYBOX_CMD} "${CMAKE_CURRENT_SOURCE_DIR}/test_grabbag.sh" WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") add_test(NAME flac - COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/test_flac.sh" + COMMAND ${BUSYBOX_EXE} ${BUSYBOX_CMD} "${CMAKE_CURRENT_SOURCE_DIR}/test_flac.sh" WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/metaflac-test-files") add_test(NAME metaflac - COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/test_metaflac.sh" + COMMAND ${BUSYBOX_EXE} ${BUSYBOX_CMD} "${CMAKE_CURRENT_SOURCE_DIR}/test_metaflac.sh" WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") add_test(NAME replaygain - COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/test_replaygain.sh" + COMMAND ${BUSYBOX_EXE} ${BUSYBOX_CMD} "${CMAKE_CURRENT_SOURCE_DIR}/test_replaygain.sh" WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") add_test(NAME seeking - COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/test_seeking.sh" + COMMAND ${BUSYBOX_EXE} ${BUSYBOX_CMD} "${CMAKE_CURRENT_SOURCE_DIR}/test_seeking.sh" WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") add_test(NAME streams - COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/test_streams.sh" + COMMAND ${BUSYBOX_EXE} ${BUSYBOX_CMD} "${CMAKE_CURRENT_SOURCE_DIR}/test_streams.sh" WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") # increase this if standard 1500 seconds are not enough # set_tests_properties(streams PROPERTIES TIMEOUT 1500) add_test(NAME compression - COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/test_compression.sh" + COMMAND ${BUSYBOX_EXE} ${BUSYBOX_CMD} "${CMAKE_CURRENT_SOURCE_DIR}/test_compression.sh" WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") set_property(TEST ${ALL_TESTS} APPEND PROPERTY ENVIRONMENT ECHO_C=\\c) diff --git a/test/common.sh.in b/test/common.sh.in index 0884bbc5..3184cc30 100644 --- a/test/common.sh.in +++ b/test/common.sh.in @@ -43,6 +43,9 @@ LD_LIBRARY_PATH=../src/share/utf8/.libs:$LD_LIBRARY_PATH export LD_LIBRARY_PATH +PATH=`pwd`/../objs/$CMAKE_CONFIG_TYPE:$PATH +PATH=`pwd`/../objs:$PATH + EXE=@EXEEXT@ # Needed for building out-of-tree where source files are in the $top_srcdir tree -- cgit v1.2.1