diff --git a/.github/workflows/root-ci.yml b/.github/workflows/root-ci.yml index 41054f41444e7..5424b8cf5ef77 100644 --- a/.github/workflows/root-ci.yml +++ b/.github/workflows/root-ci.yml @@ -442,6 +442,11 @@ jobs: CONTAINER_IMAGE: "registry.cern.ch/root-ci/${{ matrix.image }}:buildready" #KEEP IN SYNC WITH ABOVE CONTAINER_OPTIONS: "--security-opt label=disable --rm ${{ matrix.property == 'gpu' && '--device nvidia.com/gpu=all' || '' }}" #KEEP IN SYNC WITH ABOVE + env: + BUILD_DIR: /github/home/ROOT-CI/build + INSTALL_DIR: /github/home/ROOT-CI/install + POST_INSTALL_DIR: /github/home/ROOT-CI/PostInstall + steps: - name: Configure large ccache if: ${{ matrix.is_special }} @@ -586,6 +591,18 @@ jobs: run: | ccache -s || true + - name: Install + run: "cmake --install ${{ env.BUILD_DIR }} --prefix ${{ env.INSTALL_DIR }}" + + - name: Build post-install test project + run: | + cmake -S test/PostInstall/ -B ${{ env.POST_INSTALL_DIR }} -DCMAKE_PREFIX_PATH=${{ env.INSTALL_DIR }}; + cmake --build ${{ env.POST_INSTALL_DIR }}; + + - name: CTest in post-install test project + working-directory: ${{ env.POST_INSTALL_DIR }} + run: ctest -j $(nproc) + event_file: # For any event that is not a PR, the CI will always run. In PRs, the CI # can be skipped if the tag [skip-ci] or [skip ci] is written in the title. diff --git a/test/PostInstall/CMakeLists.txt b/test/PostInstall/CMakeLists.txt new file mode 100644 index 0000000000000..50a98b1ff5722 --- /dev/null +++ b/test/PostInstall/CMakeLists.txt @@ -0,0 +1,21 @@ +cmake_minimum_required(VERSION 3.20 FATAL_ERROR) + +project(PostInstall) + +find_package(ROOT REQUIRED) + +add_executable(readHSimple readHSimple.cxx) +target_link_libraries(readHSimple PUBLIC ROOT::Hist ROOT::RIO) + +include(CTest) + +if(BUILD_TESTING) + add_test(NAME run-hsimple + COMMAND ${ROOT_BINDIR}/root.exe -b -q -l -e ".x ${CMAKE_SOURCE_DIR}/../../tutorials/hsimple.C" -e "return" + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) + add_test(NAME read-hsimple + COMMAND $ + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) + set_tests_properties(run-hsimple PROPERTIES FIXTURES_SETUP HSIMPLE) + set_tests_properties(read-hsimple PROPERTIES FIXTURES_REQUIRED HSIMPLE) +endif() diff --git a/test/PostInstall/readHSimple.cxx b/test/PostInstall/readHSimple.cxx new file mode 100644 index 0000000000000..8ddb6e8ed8068 --- /dev/null +++ b/test/PostInstall/readHSimple.cxx @@ -0,0 +1,19 @@ +#include +#include + +int main() +{ + TFile file("hsimple.root", "READ"); + if (!file.IsOpen()) + return 1; + + TH1 *histo = file.Get("hpx"); + if (!histo) + return 2; + + if (histo->GetEntries() != 25000) + return 3; + histo->Print(); + + return 0; +}