Project

General

Profile

« Previous | Next » 

Revision 6d1a5792

Added by Pierre-Loïc Garoche about 5 years ago

Improving Zustre output check

View differences:

regression_tests/modules/compare_ref_zustre.cmake
1
# # Macros used to compile a lustre library
2
# include(CMakeParseArguments)
3
# function(Compare_ref_zustre)
4
#   set(options "")
5
#   set(oneValueArgs  REF GEN)
6

  
7
  # Projecting ref to status and tail
8
execute_process(COMMAND bash -c "cat ${REF} | grep Answer | awk '{$1=$1};1'" OUTPUT_VARIABLE REFSTATUS RESULT_VARIABLE CMD_RESULT)
9
if(CMD_RESULT)
10
  message(FATAL_ERROR "Error extracting reference status from ${REF}")
11
endif()
12
execute_process(COMMAND bash -c "tail -n +8 ${REF} > ${L}_ref_tail.xml" RESULT_VARIABLE CMD_RESULT)
13
if(CMD_RESULT)
14
  message(FATAL_ERROR "Error extracting tail from ${REF}")
15
endif()
16

  
17
# Projecting gen to status and tail
18
execute_process(COMMAND bash -c "cat ${GEN} | grep Answer | awk '{$1=$1};1'" OUTPUT_VARIABLE GENSTATUS RESULT_VARIABLE CMD_RESULT)
19
if(CMD_RESULT)
20
  message(FATAL_ERROR "Error extracting generated XML status from ${GEN}")
21
endif()
22
execute_process(COMMAND bash -c "tail -n +8 ${REF} > ${L}_gen_tail.xml" RESULT_VARIABLE CMD_RESULT)
23
if(CMD_RESULT)
24
  message(FATAL_ERROR "Error extracting tail from ${GEN}")
25
endif()
26

  
27
# Comparing status
28

  
29

  
30
if(REFSTATUS MATCHES "SAFE" AND GENSTATUS MATCHES "SAFE")
31
  message(STATUS "Coherent SAFE output")
32
elseif(REFSTATUS MATCHES "TIMEOUT" AND NOT(GENSTATUS MATCHES "TIMEOUT"))
33
  message(WARNING "Timeout status evolved to ${GENSTATUS}")
34
elseif(REFSTATUS MATCHES "CEX" AND GENSTATUS MATCHES "CEX")
35
  message(STATUS "Coherent CEX output")
36
  execute_process(COMMAND ${CMAKE_COMMAND} -E compare_files
37
    ${L}_ref_tail.xml ${L}_gen_tail.xml
38
    RESULT_VARIABLE CMD_RESULT)
39
  if(CMD_RESULT)
40
    message(FATAL_ERROR "CEXs are not identical")
41
  endif()
42
else()
43
  message(FATAL_ERROR "Status mismatch: ${REFSTATUS} (ref) vs ${GENSTATUS} (gen)") 
44
endif()
45

  
46
#endfunction(Compare_ref_zustre)
47

  
regression_tests/modules/strategies.cmake
196 196
    PROPERTIES FAIL_REGULAR_EXPRESSION "AssertionError;ERROR;Failed;Traceback"
197 197
    DEPENDS ${GEN_TESTS_PREFIX}_COMPIL_LUSTRE_HORN_${L}__${LUS_OPTS_CUT}_${GEN_CALL_ID})
198 198
  
199
  
200
  add_test(NAME ${GEN_TESTS_PREFIX}_TAIL1_ZUSTRE_${L}_${GEN_NODE}_${ZUS_OPTS_CUT}_${GEN_CALL_ID}
201
    COMMAND bash -c "tail -n +8 ${L}_${GEN_NODE}_${ZUS_OPTS_CUT}.xml > ${L}_tailed1.xml"
199
  add_test(NAME ${GEN_TESTS_PREFIX}_COMPARE_REF_ZUSTRE_${L}_${GEN_NODE}_${ZUS_OPTS_CUT}_${GEN_CALL_ID}
200
    COMMAND ${CMAKE_COMMAND} -DREF=${GEN_DST_DIR}/${L}/${L}_${GEN_NODE}_${ZUS_OPTS_CUT}.xml
201
                             -DGEN=${ZUSTRE_OUTPUT_DIR}/${L}_${GEN_NODE}_${ZUS_OPTS_CUT}.xml
202
    	    -P ${CMAKE_SOURCE_DIR}/modules/compare_ref_zustre.cmake
203

  
202 204
    WORKING_DIRECTORY ${ZUSTRE_OUTPUT_DIR}
203 205
    )
204
  SET_TESTS_PROPERTIES ( ${GEN_TESTS_PREFIX}_TAIL1_ZUSTRE_${L}_${GEN_NODE}_${ZUS_OPTS_CUT}_${GEN_CALL_ID}
205
    PROPERTIES REQUIRED_FILES  ${L}_${GEN_NODE}_${ZUS_OPTS_CUT}.xml
206
  SET_TESTS_PROPERTIES ( ${GEN_TESTS_PREFIX}_COMPARE_REF_ZUSTRE_${L}_${GEN_NODE}_${ZUS_OPTS_CUT}_${GEN_CALL_ID}
207
    PROPERTIES REQUIRED_FILES  "${L}_${GEN_NODE}_${ZUS_OPTS_CUT}.xml"
206 208
    DEPENDS ${GEN_TESTS_PREFIX}_COMPIL_ZUSTRE_${L}_${GEN_NODE}_${ZUS_OPTS_CUT}_${GEN_CALL_ID})
209

  
207 210
  
208
  add_test(NAME ${GEN_TESTS_PREFIX}_TAIL2_ZUSTRE_${L}_${GEN_NODE}_${ZUS_OPTS_CUT}_${GEN_CALL_ID}
209
    COMMAND bash -c "tail -n +8 ${L}_${GEN_NODE}_${ZUS_OPTS_CUT}.xml > ${L}_${GEN_NODE}_tailed2.xml"
210
    WORKING_DIRECTORY ${GEN_DST_DIR}/${L}/
211
    )
212
  SET_TESTS_PROPERTIES ( ${GEN_TESTS_PREFIX}_TAIL2_ZUSTRE_${L}_${GEN_NODE}_${ZUS_OPTS_CUT}_${GEN_CALL_ID}
213
    PROPERTIES REQUIRED_FILES  ${L}_${GEN_NODE}_${ZUS_OPTS_CUT}.xml
214
    DEPENDS ${GEN_TESTS_PREFIX}_TAIL1_ZUSTRE_${L}_${GEN_NODE}_${ZUS_OPTS_CUT}_${GEN_CALL_ID})
211
  # add_test(NAME ${GEN_TESTS_PREFIX}_TAILGEN_ZUSTRE_${L}_${GEN_NODE}_${ZUS_OPTS_CUT}_${GEN_CALL_ID}
212
  #   COMMAND bash -c "tail -n +8 ${L}_${GEN_NODE}_${ZUS_OPTS_CUT}.xml > ${L}_tailed1.xml; | grep Answer | awk '{$1=$1};1'"
213
  #   WORKING_DIRECTORY ${ZUSTRE_OUTPUT_DIR}
214
  #   )
215
  # SET_TESTS_PROPERTIES ( ${GEN_TESTS_PREFIX}_TAILGEN_ZUSTRE_${L}_${GEN_NODE}_${ZUS_OPTS_CUT}_${GEN_CALL_ID}
216
  #   PROPERTIES REQUIRED_FILES  ${L}_${GEN_NODE}_${ZUS_OPTS_CUT}.xml
217
  #   DEPENDS ${GEN_TESTS_PREFIX}_COMPIL_ZUSTRE_${L}_${GEN_NODE}_${ZUS_OPTS_CUT}_${GEN_CALL_ID})
215 218
  
219
  # add_test(NAME ${GEN_TESTS_PREFIX}_TAILREF_ZUSTRE_${L}_${GEN_NODE}_${ZUS_OPTS_CUT}_${GEN_CALL_ID}
220
  #   COMMAND bash -c "tail -n +8 ${L}_${GEN_NODE}_${ZUS_OPTS_CUT}.xml > ${L}_${GEN_NODE}_tailed2.xml"
221
  #   WORKING_DIRECTORY ${GEN_DST_DIR}/${L}/
222
  #   )
223
  # SET_TESTS_PROPERTIES ( ${GEN_TESTS_PREFIX}_TAILREF_ZUSTRE_${L}_${GEN_NODE}_${ZUS_OPTS_CUT}_${GEN_CALL_ID}
224
  #   PROPERTIES REQUIRED_FILES  ${L}_${GEN_NODE}_${ZUS_OPTS_CUT}.xml
225
  #   DEPENDS ${GEN_TESTS_PREFIX}_TAILGEN_ZUSTRE_${L}_${GEN_NODE}_${ZUS_OPTS_CUT}_${GEN_CALL_ID})
216 226
  
217
  add_test(NAME ${GEN_TESTS_PREFIX}_DIFF_ZUSTRE_${L}_${GEN_NODE}_${ZUS_OPTS_CUT}_${GEN_CALL_ID}
218
    COMMAND ${CMAKE_COMMAND} -E compare_files  ${L}_tailed1.xml  ../${L}_${GEN_NODE}_tailed2.xml
219
    WORKING_DIRECTORY ${ZUSTRE_OUTPUT_DIR}
220
    )
221
  SET_TESTS_PROPERTIES ( ${GEN_TESTS_PREFIX}_DIFF_ZUSTRE_${L}_${GEN_NODE}_${ZUS_OPTS_CUT}_${GEN_CALL_ID}
222
    PROPERTIES REQUIRED_FILES  ${L}_tailed1.xml
223
    DEPENDS ${GEN_TESTS_PREFIX}_TAIL2_ZUSTRE_${L}_${GEN_NODE}_${ZUS_OPTS_CUT}_${GEN_CALL_ID})	
227
  
228
  # add_test(NAME ${GEN_TESTS_PREFIX}_DIFF_ZUSTRE_${L}_${GEN_NODE}_${ZUS_OPTS_CUT}_${GEN_CALL_ID}
229
  #   COMMAND ${CMAKE_COMMAND} -E compare_files  ${L}_tailed1.xml  ../${L}_${GEN_NODE}_tailed2.xml
230
  #   WORKING_DIRECTORY ${ZUSTRE_OUTPUT_DIR}
231
  #   )
232
  # SET_TESTS_PROPERTIES ( ${GEN_TESTS_PREFIX}_DIFF_ZUSTRE_${L}_${GEN_NODE}_${ZUS_OPTS_CUT}_${GEN_CALL_ID}
233
  #   PROPERTIES REQUIRED_FILES  ${L}_tailed1.xml
234
  #   DEPENDS ${GEN_TESTS_PREFIX}_TAILREF_ZUSTRE_${L}_${GEN_NODE}_${ZUS_OPTS_CUT}_${GEN_CALL_ID})	
224 235

  
225 236
endfunction(Zustre_compile_and_compare_to_reference)
226 237

  

Also available in: Unified diff