Project

General

Profile

Download (1.71 KB) Statistics
| Branch: | Tag: | Revision:
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

    
(6-6/10)