From 602420f637327e88d7fa4ca7c873157f2499da10 Mon Sep 17 00:00:00 2001 From: Placido Fernandez Declara Date: Tue, 6 Oct 2020 09:39:17 +0200 Subject: [PATCH 1/6] added test for converter script and CLIC reconstruction --- test/CMakeLists.txt | 9 +++++- test/scripts/test_clicReconstruction.sh | 40 +++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 test/scripts/test_clicReconstruction.sh diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 8e74fd63..5c33397d 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -14,4 +14,11 @@ if (BASH_PROGRAM) ENVIRONMENT GMP_tests_DIR=${CMAKE_CURRENT_SOURCE_DIR} PASS_REGULAR_EXPRESSION "INFO Application Manager Terminated successfully") -endif(BASH_PROGRAM) \ No newline at end of file + # Test clicReconstruction + add_test( test_clicReconstruction ${BASH_PROGRAM} ${CMAKE_CURRENT_SOURCE_DIR}/scripts/test_clicReconstruction.sh ) + set_tests_properties ( test_clicReconstruction + PROPERTIES + ENVIRONMENT GMP_tests_DIR=${CMAKE_CURRENT_SOURCE_DIR} + PASS_REGULAR_EXPRESSION "INFO Application Manager Terminated successfully") + +endif(BASH_PROGRAM) \ No newline at end of file diff --git a/test/scripts/test_clicReconstruction.sh b/test/scripts/test_clicReconstruction.sh new file mode 100644 index 00000000..d0d9171f --- /dev/null +++ b/test/scripts/test_clicReconstruction.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +# Clone CLICPerformance for input files +if [ ! -d CLICPerformance ]; then + git clone https://github.com/iLCSoft/CLICPerformance +fi + +cd CLICPerformance/clicConfig + +python \ + $GMP_tests_DIR/../GMPWrapper/scripts/convertMarlinSteeringToGaudi.py \ + clicReconstruction.xml \ + clicReconstruction.py + +# Generate slcio file if not present +if [ ! -f testSimulation.slcio ]; then + echo "Input file not found. Generating one..." + ddsim \ + --steeringFile clic_steer.py \ + --inputFiles ../Tests/yyxyev_000.stdhep -N 4 \ + --compactFile $ILCSOFT/lcgeo/HEAD/CLIC/compact/CLIC_o3_v14/CLIC_o3_v14.xml \ + --outputFile testSimulation.slcio +fi + + +echo "Modifying clicReconstruction.py file..." +# Replace SLCIO file path +sed -i 's|/run/simulation/with/ctest/to/create/a/file.slcio|testSimulation.slcio|g' clicReconstruction.py +# Uncomment selected optional processors +sed -i 's;EvtMax = 10,;EvtMax = 3,;' clicReconstruction.py +sed -i 's;"MaxRecordNumber", "10", END_TAG,;"MaxRecordNumber", "3", END_TAG,;' clicReconstruction.py +sed -i 's;# algList.append(OverlayFalse);algList.append(OverlayFalse);' clicReconstruction.py +sed -i 's;# algList.append(MyConformalTracking);algList.append(MyConformalTracking);' clicReconstruction.py +sed -i 's;# algList.append(ClonesAndSplitTracksFinder);algList.append(ClonesAndSplitTracksFinder);' clicReconstruction.py +sed -i 's;# algList.append(RenameCollection);algList.append(RenameCollection);' clicReconstruction.py +sed -i 's;"DD4hepXMLFile", ".*",; "DD4hepXMLFile", os.environ["ILCSOFT"]+"/lcgeo/HEAD/CLIC/compact/CLIC_o3_v14/CLIC_o3_v14.xml",;' clicReconstruction.py +# Change output level for correct test confirmation +sed -i 's;OutputLevel=WARNING; OutputLevel=DEBUG;' clicReconstruction.py + +../../../run gaudirun.py clicReconstruction.py \ No newline at end of file From 7ce339b03b02e29c02008138ef9b333df9a3c98f Mon Sep 17 00:00:00 2001 From: Placido Fernandez Declara Date: Tue, 6 Oct 2020 10:38:04 +0200 Subject: [PATCH 2/6] add test to GitHub CI --- .github/scripts/gmp_build_and_test.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/scripts/gmp_build_and_test.sh b/.github/scripts/gmp_build_and_test.sh index cb52d0f6..9f4e9a24 100755 --- a/.github/scripts/gmp_build_and_test.sh +++ b/.github/scripts/gmp_build_and_test.sh @@ -15,4 +15,6 @@ cmake \ .. && \ make -j 2 && \ make install && \ +ctest -R test_gmp1 -V ctest -R test_gmp2 -V +ctest -R test_clicReconstruction -V From d08aca98ff0e246ecf9db0f789bbe224d9769c20 Mon Sep 17 00:00:00 2001 From: Placido Fernandez Declara Date: Tue, 6 Oct 2020 15:20:14 +0200 Subject: [PATCH 3/6] run all tests with output on failer + more robust bash script --- .github/scripts/gmp_build_and_test.sh | 4 +--- test/scripts/test_clicReconstruction.sh | 2 ++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/scripts/gmp_build_and_test.sh b/.github/scripts/gmp_build_and_test.sh index 9f4e9a24..b2541fe8 100755 --- a/.github/scripts/gmp_build_and_test.sh +++ b/.github/scripts/gmp_build_and_test.sh @@ -15,6 +15,4 @@ cmake \ .. && \ make -j 2 && \ make install && \ -ctest -R test_gmp1 -V -ctest -R test_gmp2 -V -ctest -R test_clicReconstruction -V +ctest --output-on-failure diff --git a/test/scripts/test_clicReconstruction.sh b/test/scripts/test_clicReconstruction.sh index d0d9171f..6d37f1f3 100644 --- a/test/scripts/test_clicReconstruction.sh +++ b/test/scripts/test_clicReconstruction.sh @@ -1,4 +1,6 @@ #!/bin/bash +# exit if command or variable fails +set -eu # Clone CLICPerformance for input files if [ ! -d CLICPerformance ]; then From 2cba9f3c39c2ea9484c3cb7de2ad77b2dd006e2a Mon Sep 17 00:00:00 2001 From: Placido Fernandez Declara Date: Wed, 7 Oct 2020 09:10:02 +0200 Subject: [PATCH 4/6] fix muons slcio file downloading --- GMPWrapper/examples/runit.py | 2 +- README.md | 4 ++-- test/gaudi_opts/test_gmp1.py | 2 +- test/scripts/test_gmp1.sh | 11 +++++++++++ 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/GMPWrapper/examples/runit.py b/GMPWrapper/examples/runit.py index 1b239871..2d7f0652 100644 --- a/GMPWrapper/examples/runit.py +++ b/GMPWrapper/examples/runit.py @@ -7,7 +7,7 @@ read = LcioEvent() read.OutputLevel = DEBUG -read.Files = ["../test/inputFiles/my.slcio"] +read.Files = ["../test/inputFiles/muons.slcio"] algList.append(read) END_TAG = "END_TAG" diff --git a/README.md b/README.md index 77f8943c..2e6cdc1c 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ Copy file and run: ```bash mkdir ../test/inputFiles -cp /path/to/muon.slcio ../test/inputFiles/my.slcio +cp /path/to/muons.slcio ../test/inputFiles/muons.slcio ./run gaudirun.py ../GMPWrapper/examples/runit.py ``` @@ -41,7 +41,7 @@ cp /path/to/muon.slcio ../test/inputFiles/my.slcio ```bash # Check that input file exist mkdir ../test/inputFiles -cp /path/to/muon.slcio ../test/inputFiles/my.slcio +cp /path/to/muons.slcio ../test/inputFiles/muons.slcio # Display available tests ctest -N # Run tests diff --git a/test/gaudi_opts/test_gmp1.py b/test/gaudi_opts/test_gmp1.py index fbe2657f..817a368b 100644 --- a/test/gaudi_opts/test_gmp1.py +++ b/test/gaudi_opts/test_gmp1.py @@ -7,7 +7,7 @@ read = LcioEvent() read.OutputLevel = DEBUG -read.Files = ["$GMP_tests_DIR/inputFiles/my.slcio"] +read.Files = ["$GMP_tests_DIR/inputFiles/muons.slcio"] algList.append(read) END_TAG = "END_TAG" diff --git a/test/scripts/test_gmp1.sh b/test/scripts/test_gmp1.sh index dcbd7fe4..fc5f532d 100644 --- a/test/scripts/test_gmp1.sh +++ b/test/scripts/test_gmp1.sh @@ -1,2 +1,13 @@ #!/bin/bash +# set -eu + +if [ ! -d $GMP_tests_DIR/inputFiles/ ]; then + mkdir $GMP_tests_DIR/inputFiles +fi + +if [ ! -f $GMP_tests_DIR/inputFiles/muons.slcio ]; then + wget https://github.com/AIDASoft/DD4hep/raw/master/DDTest/inputFiles/muons.slcio + mv muons.slcio $GMP_tests_DIR/inputFiles/muons.slcio +fi + ../run gaudirun.py $GMP_tests_DIR/gaudi_opts/test_gmp1.py From 244a706f633c18295cc273192b9c4d62dd33d5a8 Mon Sep 17 00:00:00 2001 From: Placido Fernandez Declara Date: Wed, 7 Oct 2020 09:38:18 +0200 Subject: [PATCH 5/6] add verbose for test output --- .github/scripts/gmp_build_and_test.sh | 2 +- test/scripts/test_gmp1.sh | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/scripts/gmp_build_and_test.sh b/.github/scripts/gmp_build_and_test.sh index b2541fe8..57204832 100755 --- a/.github/scripts/gmp_build_and_test.sh +++ b/.github/scripts/gmp_build_and_test.sh @@ -15,4 +15,4 @@ cmake \ .. && \ make -j 2 && \ make install && \ -ctest --output-on-failure +ctest --verbose --output-on-failure diff --git a/test/scripts/test_gmp1.sh b/test/scripts/test_gmp1.sh index fc5f532d..8116bb8a 100644 --- a/test/scripts/test_gmp1.sh +++ b/test/scripts/test_gmp1.sh @@ -6,8 +6,7 @@ if [ ! -d $GMP_tests_DIR/inputFiles/ ]; then fi if [ ! -f $GMP_tests_DIR/inputFiles/muons.slcio ]; then - wget https://github.com/AIDASoft/DD4hep/raw/master/DDTest/inputFiles/muons.slcio - mv muons.slcio $GMP_tests_DIR/inputFiles/muons.slcio + wget https://github.com/AIDASoft/DD4hep/raw/master/DDTest/inputFiles/muons.slcio -P $GMP_tests_DIR/inputFiles/ fi ../run gaudirun.py $GMP_tests_DIR/gaudi_opts/test_gmp1.py From ffe936bede09c99ae881374b009a69b391b7327d Mon Sep 17 00:00:00 2001 From: Placido Fernandez Declara Date: Wed, 7 Oct 2020 10:05:35 +0200 Subject: [PATCH 6/6] install wget for file downloading --- .github/scripts/gmp_build_and_test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/scripts/gmp_build_and_test.sh b/.github/scripts/gmp_build_and_test.sh index 57204832..7068befa 100755 --- a/.github/scripts/gmp_build_and_test.sh +++ b/.github/scripts/gmp_build_and_test.sh @@ -1,6 +1,6 @@ #!/bin/bash -yum -y install make git +yum -y install make git wget source /cvmfs/clicdp.cern.ch/iLCSoft/lcg/97/nightly/x86_64-centos7-gcc8-opt/init_ilcsoft.sh