Project

General

Profile

Statistics
| Branch: | Tag: | Revision:

lustrec-tests / regression_tests / lustre_files / success / kind_fmcad08 / large / src / CEX / CMakeLists.txt @ 2d6a9bb3

History | View | Annotate | Download (6.8 KB)

1
cmake_minimum_required(VERSION 2.8.4)
2
include(FindUnixCommands)
3

    
4

    
5
if(ZUSTRE_COMPILER)
6
  message(STATUS "Found zustre: ${ZUSTRE_COMPILER} ")
7
else(ZUSTRE_COMPILER)
8
  message(FATAL_ERROR "zustre not found")
9
endif(ZUSTRE_COMPILER)
10

    
11

    
12

    
13

    
14
#first combination :no option
15
set(ZUSTRE_OPTIONS_OPT "--timeout" "60" "--xml" )
16
#take all lustre files
17
  set(GLOBAL_LUSTRE_FILES "")
18
  LUSTREFILES(LFILES ${CMAKE_CURRENT_SOURCE_DIR} )
19
  list(APPEND GLOBAL_LUSTRE_FILES ${LFILES})
20
  FOREACH(lfile ${LFILES})
21
	  get_filename_component(L ${lfile} NAME_WE)
22
	  set(LUSTRE_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/${L}")
23
	  file(COPY ${lfile}  ${L}.lusi DESTINATION  ${LUSTRE_OUTPUT_DIR})
24
	if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${L}.xml)
25
		file(COPY ${L}.xml   DESTINATION  ${LUSTRE_OUTPUT_DIR})
26
	else()
27
		message("generate ${L}.xml for reference\n")
28
		Zustre_Compile(LUS_FILE ${lfile}
29
					NODE "top"
30
					OPTS ${ZUSTRE_OPTIONS_OPT})
31
		set(ZUS_OPTS_CUT ${ZUSTRE_OPTS_POSTFIX_${L}})
32
		execute_process(RESULT_VARIABLE res 
33
					OUTPUT_VARIABLE ${L}_output
34
					COMMAND  ${ZUSTRE_COMPILER} ${ZUSTRE_ARGS_${L}_top_${ZUS_OPTS_CUT}} 
35
					WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
36
		if(${res} STREQUAL "0")
37
			if( ${${L}_output} MATCHES "<Answer>CEX</Answer>")
38
				message("${L} CEX")
39
				file(WRITE ${CMAKE_CURRENT_SOURCE_DIR}/${L}.xml ${${L}_output})
40
				file(COPY ${L}.xml   DESTINATION  ${LUSTRE_OUTPUT_DIR})
41
			else()
42
				message("${L} is not CEX\n ${${L}_output}")
43
			endif()
44
		else()
45
			message("${L} Error")
46
		endif()
47
	endif()
48
	  
49
  ENDFOREACH()
50

    
51

    
52

    
53

    
54
FOREACH(lus_file ${GLOBAL_LUSTRE_FILES})
55
	get_filename_component(L ${lus_file} NAME_WE)
56
	set(ZUSTRE_NODE_OPT  "top")
57

    
58
	Lustre_Compile(LUS_FILE ${lus_file}
59
					NODE ""
60
					OPTS "-horn")
61
					
62
	set(LUS_OPTS_CUT ${LUSTRE_OPTS_POSTFIX_${L}})
63
	add_test(NAME Kind_fmcad08_large_CEX_COMPIL_LUSTRE_${L}_${ZUSTRE_NODE_OPT}_${ZUS_OPTS_CUT}
64
			COMMAND  ${LUSTRE_COMPILER} ${LUSTREC_ARGS_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT}} 
65
	)
66

    
67
	Zustre_Compile(LUS_FILE ${lus_file}
68
					NODE ${ZUSTRE_NODE_OPT}
69
					OPTS ${ZUSTRE_OPTIONS_OPT})
70
	set(ZUS_OPTS_CUT ${ZUSTRE_OPTS_POSTFIX_${L}})
71
	
72
	set(ZUSTRE_ARGS_TEMP "${ZUSTRE_ARGS_${L}_${ZUSTRE_NODE_OPT}_${ZUS_OPTS_CUT}}" "> ${L}_${ZUSTRE_NODE_OPT}_${ZUS_OPTS_CUT}.xml")
73
    JOIN("${ZUSTRE_ARGS_TEMP}" " " ZUSTRE_ARGS)
74
    
75
	add_test(NAME Kind_fmcad08_large_CEX_COMPIL_ZUSTRE_${L}_${ZUSTRE_NODE_OPT}_${ZUS_OPTS_CUT}
76
			COMMAND bash -c "${ZUSTRE_COMPILER} ${ZUSTRE_ARGS}"
77
			WORKING_DIRECTORY ${ZUSTRE_OUTPUT_DIR_${L}_${ZUSTRE_NODE_OPT}_${ZUS_OPTS_CUT}}
78
	)
79
	SET_TESTS_PROPERTIES (  Kind_fmcad08_large_CEX_COMPIL_ZUSTRE_${L}_${ZUSTRE_NODE_OPT}_${ZUS_OPTS_CUT}
80
			PROPERTIES FAIL_REGULAR_EXPRESSION "AssertionError;ERROR;Failed"
81
					DEPENDS Kind_fmcad08_large_CEX_COMPIL_LUSTRE_${L}_${ZUSTRE_NODE_OPT}_${ZUS_OPTS_CUT})
82
			
83
			
84
	add_test(NAME Kind_fmcad08_large_CEX_TAIL1_ZUSTRE_${L}_${ZUSTRE_NODE_OPT}_${ZUS_OPTS_CUT}
85
			COMMAND bash -c "tail -n +8 ${L}_${ZUSTRE_NODE_OPT}_${ZUS_OPTS_CUT}.xml > ${L}_tailed1.xml"
86
			WORKING_DIRECTORY ${ZUSTRE_OUTPUT_DIR_${L}_${ZUSTRE_NODE_OPT}_${ZUS_OPTS_CUT}}
87
			#DEPENDS Kind_fmcad08_large_CEX_COMPIL_ZUSTRE_${L}_${ZUSTRE_NODE_OPT}_${ZUS_OPTS_CUT}
88
	)
89
	
90
	add_test(NAME Kind_fmcad08_large_CEX_TAIL2_ZUSTRE_${L}_${ZUSTRE_NODE_OPT}_${ZUS_OPTS_CUT}
91
			COMMAND bash -c "tail -n +8 ${L}.xml > ${L}_tailed2.xml"
92
			WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${L}/
93
	)
94
					
95
	add_test(NAME Kind_fmcad08_large_CEX_DIFF_ZUSTRE_${L}_${ZUSTRE_NODE_OPT}_${ZUS_OPTS_CUT}
96
			COMMAND bash -c "diff  ${L}_tailed1.xml  ../${L}_tailed2.xml"
97
			WORKING_DIRECTORY ${ZUSTRE_OUTPUT_DIR_${L}_${ZUSTRE_NODE_OPT}_${ZUS_OPTS_CUT}}
98
	)
99
	SET_TESTS_PROPERTIES ( Kind_fmcad08_large_CEX_DIFF_ZUSTRE_${L}_${ZUSTRE_NODE_OPT}_${ZUS_OPTS_CUT}
100
	 PROPERTIES REQUIRED_FILES  ${L}_tailed1.xml
101
				DEPENDS Kind_fmcad08_large_CEX_TAIL1_ZUSTRE_${L}_${ZUSTRE_NODE_OPT}_${ZUS_OPTS_CUT} )	
102

    
103
	
104
	if(EXISTS ${CMAKE_BINARY_DIR}/modules/XPathParser_lusi.class)
105
		add_test(NAME Kind_fmcad08_large_CEX_XPathParser_lusi_ZUSTRE_${L}_${ZUSTRE_NODE_OPT}_${ZUS_OPTS_CUT}
106
			COMMAND ${JAVA_RUNTIME} -cp ${CMAKE_BINARY_DIR}/modules/ XPathParser_lusi ${ZUSTRE_NODE_OPT} ../${L}.lusi ${L}_${ZUSTRE_NODE_OPT}_${ZUS_OPTS_CUT}.xml
107
			WORKING_DIRECTORY ${ZUSTRE_OUTPUT_DIR_${L}_${ZUSTRE_NODE_OPT}_${ZUS_OPTS_CUT}}
108
		)
109
		SET_TESTS_PROPERTIES ( Kind_fmcad08_large_CEX_XPathParser_lusi_ZUSTRE_${L}_${ZUSTRE_NODE_OPT}_${ZUS_OPTS_CUT}
110
		 PROPERTIES REQUIRED_FILES  ${CMAKE_CURRENT_BINARY_DIR}/${L}/${L}.lusi 
111
					DEPENDS Kind_fmcad08_large_CEX_COMPIL_ZUSTRE_${L}_${ZUSTRE_NODE_OPT}_${ZUS_OPTS_CUT} )	
112
		
113
		set(LUSTRE_NODE_OPT "top")
114
		# First command generate C files from Lustre file
115
		Lustre_Compile(LUS_FILE ${lus_file}
116
						NODE ${LUSTRE_NODE_OPT}
117
						OPTS ""
118
						DIR ${ZUSTRE_OUTPUT_DIR_${L}_${ZUSTRE_NODE_OPT}_${ZUS_OPTS_CUT}})
119
						
120
		set(LUS_OPTS_CUT ${LUSTRE_OPTS_POSTFIX_${L}})
121
		add_test(NAME Kind_fmcad08_large_CEX_COMPIL_LUSTRE_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT}
122
				COMMAND  ${LUSTRE_COMPILER} ${LUSTREC_ARGS_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT}} 
123
				WORKING_DIRECTORY ${ZUSTRE_OUTPUT_DIR_${L}_${ZUSTRE_NODE_OPT}_${ZUS_OPTS_CUT}}
124
		)
125

    
126
		 #********************* make -f ${L}.makefile ***************************
127
		 add_test(NAME Kind_fmcad08_large_CEX_MAKE_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT}
128
				COMMAND  make -f ${L}.makefile
129
				WORKING_DIRECTORY ${ZUSTRE_OUTPUT_DIR_${L}_${ZUSTRE_NODE_OPT}_${ZUS_OPTS_CUT}}
130
		)
131
		SET_TESTS_PROPERTIES ( Kind_fmcad08_large_CEX_MAKE_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT}
132
		 PROPERTIES DEPENDS Kind_fmcad08_large_CEX_COMPIL_LUSTRE_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT}
133
					REQUIRED_FILES ${L}.makefile
134
					)
135
		 
136
		 #************** execute C binary **********************************
137
		
138
		if (BASH)
139
			add_test(
140
				NAME Kind_fmcad08_large_CEX_BIN_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT} 
141
				COMMAND ${BASH} -c "./${L}_${LUSTRE_NODE_OPT} < input_values > ${L}_${LUSTRE_NODE_OPT}_outputs"
142
				WORKING_DIRECTORY ${ZUSTRE_OUTPUT_DIR_${L}_${ZUSTRE_NODE_OPT}_${ZUS_OPTS_CUT}}
143
			)
144
			SET_TESTS_PROPERTIES ( Kind_fmcad08_large_CEX_BIN_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT}
145
				PROPERTIES REQUIRED_FILES ${L}_${LUSTRE_NODE_OPT}
146
					DEPENDS Kind_fmcad08_large_CEX_MAKE_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT})
147
		else()
148
			message(FATAL_ERROR "Unknown shell command for ${CMAKE_HOST_SYSTEM_NAME}")
149
		endif()
150

    
151
		 #************** execute C binary **********************************
152
		 add_test(NAME Kind_fmcad08_large_CEX_COMPARE_OUTPUTS_OF LUSTREC_ZUSTRE_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT}
153
				COMMAND ${CMAKE_COMMAND} -E compare_files ${L}_${LUSTRE_NODE_OPT}_outputs xml_output_values
154
				WORKING_DIRECTORY ${ZUSTRE_OUTPUT_DIR_${L}_${ZUSTRE_NODE_OPT}_${ZUS_OPTS_CUT}}
155
		)
156
		SET_TESTS_PROPERTIES ( Kind_fmcad08_large_CEX_COMPARE_OUTPUTS_OF LUSTREC_ZUSTRE_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT}
157
		 PROPERTIES REQUIRED_FILES ${L}_${LUSTRE_NODE_OPT}_outputs
158
					DEPENDS Kind_fmcad08_large_CEX_BIN_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT} )
159
		
160
	endif()
161
	
162
ENDFOREACH()
163

    
164