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 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /cmake/Modules/FindStatTest.cmake (Version 11.3.0) and /cmake/Modules/FindStatTest.cmake (Version 10.1.p1)


  1 # Copied from Geant4 installation, need patch  << 
  2 # - Find StatTest                                   1 # - Find StatTest
  3 # This module tries to find the StatTest appli      2 # This module tries to find the StatTest application
  4 # Once done this will define                        3 # Once done this will define
  5 #                                              <<   4 # 
  6 # STATTEST_FOUND    - Application found             5 # STATTEST_FOUND    - Application found
  7 # STATTEST_APP      - Application                   6 # STATTEST_APP      - Application
  8 #   STATTEST_CMD      - Command line to run th <<   7 # STATTEST_CMD      - Command line to run the application
  9 #   STATTEST_ADD_TEST - Helper function to def <<   8 # STATTEST_ADD_TEST - Helper function to define a ctest using
 10 #                     StatTest (Only if we are      9 #                     StatTest (Only if we are using for G4 testing)
 11 #                                                  10 #
 12 # Variables used by this module, which can cha <<  11 # Variables used by this module, which can change the default behaviour 
 13 # and need to be set before calling find_packa     12 # and need to be set before calling find_package
 14 #                                                  13 #
 15 # STATTEST_ROOT_DIR Root directory to StatTest     14 # STATTEST_ROOT_DIR Root directory to StatTest package
 16 #                                                  15 #
 17                                                    16 
 18 if(NOT GEANT4_ENABLE_TESTING)                  << 
 19     #No meaning for this if not testing        << 
 20     SET(STATTEST_FOUND FALSE)                  << 
 21     return()                                   << 
 22 endif()                                        << 
 23                                                << 
 24 #Search application                                17 #Search application
 25 #Note that the second suggested path is G4 spe <<  18 #Note that the second suggested path is G4 specific... 
 26 find_path(STATTEST_APP_DIR                         19 find_path(STATTEST_APP_DIR
 27     NAMES StatTestVersion.py                       20     NAMES StatTestVersion.py
 28     PATHS ${STATTEST_ROOT_DIR} ${PROJECT_SOURC <<  21     PATHS ${STATTEST_ROOT_DIR} ${CMAKE_SOURCE_DIR}/verification/StatTest
 29     NO_DEFAULT_PATH                                22     NO_DEFAULT_PATH
 30     )                                              23     )
 31                                                    24 
 32 #If we didn't find it there, fall back to some     25 #If we didn't find it there, fall back to some standard search paths
 33 find_path(STATTEST_APP_DIR NAMES StatTestVersi <<  26 find_path(STATTEST_APP_DIR NAMES StatTest/StatTestVersion.py)
 34                                                    27 
 35 ####                                               28 ####
 36 #### Run-time dependencies...                      29 #### Run-time dependencies...
 37 ####                                               30 ####
 38 # - Check if ROOT is available                     31 # - Check if ROOT is available
 39 find_package(ROOT QUIET)                           32 find_package(ROOT QUIET)
 40 if(NOT ROOT_FOUND)                                 33 if(NOT ROOT_FOUND)
 41   MESSAGE(STATUS "StatTest: ROOT package not f     34   MESSAGE(STATUS "StatTest: ROOT package not found --> StatTest package disabled")
 42   set(STATTEST_FOUND FALSE)                    << 
 43   set(_root_isok FALSE)                            35   set(_root_isok FALSE)
 44 else()                                             36 else()
 45   set(_root_isok TRUE)                             37   set(_root_isok TRUE)
 46   # - Check if python interpreter is correct v << 
 47   # (the one compatible with root)             << 
 48   find_package(Python ${ROOT_PYTHONVER} QUIET  << 
 49   if(NOT Python_Interpreter_FOUND)             << 
 50      MESSAGE(STATUS "StatTest: Python interpre << 
 51      set(STATTEST_FOUND FALSE)                 << 
 52      set(_python_isok FALSE)                   << 
 53   else()                                       << 
 54      set(STATTEST_FOUND TRUE)                  << 
 55      set(_python_isok TRUE)                    << 
 56   endif()                                      << 
 57 endif()                                            38 endif()
 58                                                    39 
                                                   >>  40 # - Check if python interpreter is correct version 
                                                   >>  41 # (the one compatible with root)
                                                   >>  42 find_package(PythonInterp ${ROOT_PYTHONVER} QUIET)
                                                   >>  43 if(NOT PYTHONINTERP_FOUND)
                                                   >>  44   MESSAGE(STATUS "StatTest: Python interpreter of version ${ROOT_PYTHONVER} not found --> StatTest package disabled")
                                                   >>  45   set(_python_isok FALSE)
                                                   >>  46 else()
                                                   >>  47   set(_python_isok TRUE)
                                                   >>  48 endif()
                                                   >>  49 
                                                   >>  50 
 59 include(FindPackageHandleStandardArgs)             51 include(FindPackageHandleStandardArgs)
 60 find_package_handle_standard_args(                 52 find_package_handle_standard_args(
 61     StatTest                                   <<  53   StatTest
 62     DEFAULT_MSG                                <<  54   DEFAULT_MSG
 63     STATTEST_APP_DIR                           <<  55   STATTEST_APP_DIR
 64     _root_isok                                 <<  56   _root_isok
 65     _python_isok                               <<  57   _python_isok
 66   )                                                58   )
 67                                                    59 
 68                                                << 
 69 if(STATTEST_FOUND)                                 60 if(STATTEST_FOUND)
 70   set(STATTEST_APP ${STATTEST_APP_DIR}/runtest     61   set(STATTEST_APP ${STATTEST_APP_DIR}/runtests.py)
 71   set(STATTEST_CMD ${PYTHON_EXECUTABLE} ${STAT     62   set(STATTEST_CMD ${PYTHON_EXECUTABLE} ${STATTEST_APP})
 72                                                    63 
 73   # Let's create a function that helps in buil <<  64   if(GEANT4_ENABLE_TESTING)
 74   # regression testing                         <<  65     # Let's create a function that helps in building tests for 
 75   # function STATTEST_ADD_TEST(<name>          <<  66     # regression testing
 76   #                            G4TEST testname <<  67     # function STATTEST_ADD_TEST(<name> 
 77   #                            CONFIG conffile <<  68     #                            G4TEST testname
 78   #                            INPUT inputfile <<  69     #                            CONFIG conffile
 79   #              [DEBUG]                       <<  70     #                            INPUT inputfile
 80   #          [TEXT]  #Input is text file inste <<  71     #                            [DEBUG]
 81   #                            [REFERENCE refe <<  72     #                            [REFERENCE reference]
 82   #                            [LABELS label1  <<  73     #                            [LABELS label1 label2 ...]
 83   #                            [IMG filename]) <<  74     #                            [IMG filename])
 84   function(STATTEST_ADD_TEST stattest)         <<  75     function(STATTEST_ADD_TEST stattest)
 85         CMAKE_PARSE_ARGUMENTS(ARG "DEBUG;TEXT" <<  76       CMAKE_PARSE_ARGUMENTS(ARG "DEBUG" 
 86         "CONFIG;INPUT;REFERENCE;G4TEST;IMG"        77         "CONFIG;INPUT;REFERENCE;G4TEST;IMG"
 87         "LABELS" ${ARGN}                           78         "LABELS" ${ARGN}
 88     )                                          <<  79         )
 89     #check mandatory arguments                 << 
 90     list(LENGTH ARG_CONFIG _len)               << 
 91     if(_len LESS 1)                            << 
 92         message(FATAL_ERROR "STATTEST_ADD_TEST << 
 93     endif()                                    << 
 94                                                    80 
 95     list(LENGTH ARG_INPUT _len)                <<  81       #check mandatory arguments
 96     if(_len LESS 1)                            <<  82       list(LENGTH ARG_CONFIG _len)
                                                   >>  83       if(_len LESS 1)
                                                   >>  84         message(FATAL_ERROR "STATTEST_ADD_TEST: conffile is mandatory")
                                                   >>  85       endif()
                                                   >>  86       
                                                   >>  87       list(LENGTH ARG_INPUT _len)
                                                   >>  88       if(_len LESS 1)
 97         message(FATAL_ERROR "STATTEST_ADD_TEST     89         message(FATAL_ERROR "STATTEST_ADD_TEST: inputfile is mandatory")
 98     endif()                                    <<  90       endif()
 99                                                <<  91       
100     list(LENGTH ARG_G4TEST _len)               <<  92       list(LENGTH ARG_G4TEST _len)
101     if(_len LESS 1)                            <<  93       if(_len LESS 1)
102         message(FATAL_ERROR "STATTEST_ADD_TEST     94         message(FATAL_ERROR "STATTEST_ADD_TEST: testname is mandatory")
103     endif()                                    <<  95       endif()
104                                                    96 
105     #Set basic command line                    <<  97       #Set basic command line
106     if(ARG_IMG)                                <<  98       if(ARG_IMG)
107         set(_command ${STATTEST_CMD} -g ${ARG_     99         set(_command ${STATTEST_CMD} -g ${ARG_IMG})
108     else()                                     << 100       else()
109         set(_command ${STATTEST_CMD})             101         set(_command ${STATTEST_CMD})
110     endif()                                    << 102       endif() 
111                                                   103 
112     if(ARG_TEXT)                               << 104       #Mandatory parameters
113       set(_command ${_command} "-T")           << 105       set(_command ${_command} ${ARG_CONFIG} ${ARG_INPUT})
114     endif()                                    << 106       if(ARG_REFERENCE)
115                                                << 
116     #Mandatory parameters                      << 
117     set(_command ${_command} ${ARG_CONFIG} ${A << 
118     if(ARG_REFERENCE)                          << 
119         set(_command ${_command} ${ARG_REFEREN    107         set(_command ${_command} ${ARG_REFERENCE})
120     endif()                                    << 108       endif()
121                                                   109 
122     if(ARG_LABELS)                             << 110       if(ARG_LABELS)
123         set(_labels ${ARG_LABELS})                111         set(_labels ${ARG_LABELS})
124     else()                                     << 112       else()
125         set(_labels "")                           113         set(_labels "")
126     endif()                                    << 114       endif()
127                                                << 
128     include(G4CTest)                           << 
129                                                   115 
130      #Now build G4 test                        << 116       include(Geant4CTest)
131     GEANT4_ADD_TEST(${stattest}                << 117     
                                                   >> 118       #Now build G4 test
                                                   >> 119       GEANT4_ADD_TEST(${stattest} 
132         COMMAND ${_command}                       120         COMMAND ${_command}
133         DEPENDS ${ARG_G4TEST}                     121         DEPENDS ${ARG_G4TEST}
134         LABELS ${_labels}                         122         LABELS ${_labels}
135         )                                         123         )
136   endfunction()                                << 124     endfunction()
                                                   >> 125   endif(GEANT4_ENABLE_TESTING)
137 endif(STATTEST_FOUND)                             126 endif(STATTEST_FOUND)
138                                                   127 
139 mark_as_advanced(STATTEST_APP_DIR)                128 mark_as_advanced(STATTEST_APP_DIR)