6 # testgeo.sh [Geometry ...]
8 # Default geometries defined in DEFAULT_GEOMETRIES below.
10 # Copied from larcore/Geometry/test/testgeo.csh .
13 DEFAULT_GEOMETRIES=( 'dunefd' )
14 INCLUDE_FILES=( 'geometry_dune.fcl' )
17 ################################################################################
18 function TestGeometry() {
21 echo "Testing geometry for ${Geometry}"
23 local ConfigFile="test_${Geometry}_geometry.fcl"
25 # preamble and prologue
26 cat <<-EOC > "$ConfigFile"
28 # Test for ${Geometry} geometry
31 # this item will be included by geotest.fcl: we need a temporary fake one
37 # add include files as needed
39 for IncludeFile in "${INCLUDE_FILES[@]}" ; do
40 echo "#include \"${IncludeFile}\"" >> "$ConfigFile"
43 # overriding the original template file
44 cat <<-EOC >> "$ConfigFile"
46 # geotest.fcl is provided by larcore (larcore/Geometry/test)
47 #include "geotest.fcl"
49 services.user.Geometry: @local::${Geometry}_geo
50 services.user.ExptGeoHelperInterface: @local::dune_geometry_helper
53 local LogFile="${ConfigFile%.fcl}.log"
55 lar -c "$ConfigFile" 2>&1 | tee "$LogFile"
58 echo "Test completed with exit code ${res}, log file: ${LogFile}"
59 if [[ $res == 0 ]]; then
60 rm -f "$ConfigFile" *.root
67 ################################################################################
69 if [[ $# -gt 0 ]]; then
72 Geometries=( "${DEFAULT_GEOMETRIES[@]}" )
75 declare -i nTests=0 nErrors=0
76 for Geometry in "${Geometries[@]}" ; do
78 TestGeometry "$Geometry"
80 [[ $res != 0 ]] && let ++nErrors
83 if [[ $nErrors == 0 ]]; then
84 echo "All ${nTests} tests successfully completed."
86 echo "${nErrors} tests out of ${nTests} failed."