The patch adds a procedure to download two trace data files that will be used by the CI tests. The files are obtained from a dedicated github repository. The tests cases using the trace data files will be added in following patches. Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@xxxxxxxxx> --- .github/workflows/main.yml | 8 ++++++++ CMakeLists.txt | 3 ++- build/cmake_clean.sh | 1 + tests/CMakeLists.txt | 6 +++++- tests/get_test_data.sh | 21 +++++++++++++++++++++ 5 files changed, 37 insertions(+), 2 deletions(-) create mode 100755 tests/get_test_data.sh diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a35f003..2cce624 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -35,6 +35,7 @@ jobs: make sudo make install sudo make install_libs + - name: Create Build Environment # Some projects don't allow in-source building, so create a separate build directory # We'll use this as our working directory for all subsequent commands @@ -61,3 +62,10 @@ jobs: shell: bash # Execute tests defined by the CMake configuration. run: ctest -C $BUILD_TYPE + + - name: Upload Artifacts + if: ${{ always() }} + uses: actions/upload-artifact@v2 + with: + name: artifacts-download + path: ${{runner.workspace}}/build/Testing/ diff --git a/CMakeLists.txt b/CMakeLists.txt index e013916..26fb7ae 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -123,8 +123,9 @@ add_subdirectory(${KS_DIR}/examples) if (Boost_FOUND) + set(KS_TEST_DIR "${KS_DIR}/tests") enable_testing() - add_subdirectory(${KS_DIR}/tests) + add_subdirectory(${KS_TEST_DIR}) endif() diff --git a/build/cmake_clean.sh b/build/cmake_clean.sh index f70b545..b534014 100755 --- a/build/cmake_clean.sh +++ b/build/cmake_clean.sh @@ -9,6 +9,7 @@ rm -rf src/ rm -rf examples/ rm -rf tests/ rm -rf Testing/ +rm -f ../tests/*.dat rm -f ../lib/* rm ../kernelshark.desktop rm ../org.freedesktop.kshark-record.policy diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 17b586e..0847414 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,6 +1,5 @@ message("\n tests ...") -set(KS_TEST_DIR "${KS_DIR}/tests") set(EXECUTABLE_OUTPUT_PATH ${KS_TEST_DIR}) add_executable(kshark-tests libkshark-tests.cpp) @@ -9,6 +8,11 @@ target_compile_definitions(kshark-tests PRIVATE "BOOST_TEST_DYN_LINK=1") target_link_libraries(kshark-tests kshark-gui ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) +add_test(NAME "get_test_data" + COMMAND ${KS_TEST_DIR}/get_test_data.sh + WORKING_DIRECTORY ${KS_TEST_DIR}) + +message(STATUS "libkshark-tests") add_test(NAME "libkshark_tests" COMMAND ${KS_TEST_DIR}/kshark-tests --log_format=HRF WORKING_DIRECTORY ${KS_TEST_DIR}) diff --git a/tests/get_test_data.sh b/tests/get_test_data.sh new file mode 100755 index 0000000..b935d11 --- /dev/null +++ b/tests/get_test_data.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +TEST_DIR=`dirname $0` +TEST_DATA_DIR=kernel-shark_testdata +TEST_DATA_REPO=https://github.com/yordan-karadzhov/${TEST_DATA_DIR}.git + +rm -fv ${TEST_DIR}/*.dat + +if [ -d "${TEST_DATA_DIR}" ]; then + rm -rf ${TEST_DATA_DIR} +fi + +git clone ${TEST_DATA_REPO} + +if [ ! -d "${TEST_DATA_DIR}" ]; then + exit false +fi + +rm -f ${TEST_DATA_DIR}/LICENSE +cp -v ${TEST_DATA_DIR}/* ${TEST_DIR}/ +rm -rf ${TEST_DATA_DIR} -- 2.25.1