Project

General

Profile

Revision fa9e78e5 regression_tests/lustre_files/success/Stateflow/CMakeLists.txt

View differences:

regression_tests/lustre_files/success/Stateflow/CMakeLists.txt
1 1
cmake_minimum_required(VERSION 2.8.4)
2

  
2
include(FindUnixCommands)
3 3

  
4 4

  
5 5

  
......
22 22
  list(APPEND GLOBAL_LUSTRE_FILES ${LFILE})
23 23
  get_filename_component(L ${LFILE} NAME_WE)
24 24
  set(LUSTRE_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/${L}")
25
  file(COPY ${LFILE} "${subdir}/input_values" "${subdir}/outputs_values" "${subdir}/${L}.smt2"  DESTINATION  ${LUSTRE_OUTPUT_DIR})
25
  file(COPY ${LFILE} "${subdir}/input_values" "${subdir}/outputs_values"   DESTINATION  ${LUSTRE_OUTPUT_DIR})
26 26
ENDFOREACH()
27 27

  
28 28
#first combination :no option
29 29
set(LUSTRE_OPTIONS_OPT "")
30
set(GENERATION_RESULTS "")
31
set(REPORT_PATH  "${CMAKE_CURRENT_BINARY_DIR}/report")
32
file(WRITE ${REPORT_PATH}  "")
30

  
33 31
FOREACH(lus_file ${GLOBAL_LUSTRE_FILES})
34 32
	get_filename_component(L ${lus_file} NAME_WE)
35 33
	set(LUSTRE_NODE_OPT  "${L}")
......
38 36
	Lustre_Compile(LUS_FILE ${lus_file}
39 37
					NODE ${LUSTRE_NODE_OPT}
40 38
					OPTS ${LUSTRE_OPTIONS_OPT})
41

  
42
	if(NOT ${LUSTRE_OUTPUT_DIR_${L}_${LUSTRE_NODE_OPT}_${LUSTRE_OPTIONS_OPT}_RESULT} STREQUAL "0" )
43
		message("****************${LUSTRE_GENERATED_FILES_${L}_${LUSTRE_NODE_OPT}_${LUSTRE_OPTIONS_OPT}}: Failed********")
44
	else(NOT ${LUSTRE_OUTPUT_DIR_${L}_${LUSTRE_NODE_OPT}_${LUSTRE_OPTIONS_OPT}_RESULT} STREQUAL "0")
45
		#second command : generate C binary from C files generated before		
46
		#third step : compare binary outputs with the reference.
47
		add_custom_command(
48
			OUTPUT ${LUSTRE_OUTPUT_DIR_${L}_${LUSTRE_NODE_OPT}_${LUSTRE_OPTIONS_OPT}}/report
49
			DEPENDS ${LUSTRE_GENERATED_FILES_${L}_${LUSTRE_NODE_OPT}_${LUSTRE_OPTIONS_OPT}}
50
			COMMAND make 
51
			ARGS  -f ${L}.makefile
52
			COMMAND ./${L}_${LUSTRE_NODE_OPT} 
53
			ARGS < ../input_values > ${L}_${LUSTRE_NODE_OPT}_outputs
54
			COMMAND diff
55
			ARGS -s ${L}_${LUSTRE_NODE_OPT}_outputs ../outputs_values > report
56
			WORKING_DIRECTORY ${LUSTRE_OUTPUT_DIR_${L}_${LUSTRE_NODE_OPT}_${LUSTRE_OPTIONS_OPT}}
57
			COMMENT " make -f ${L}.makefile \n ./${L}_${LUSTRE_NODE_OPT}  < ../input_values > ${L}_${LUSTRE_NODE_OPT}_outputs \n diff -s ${L}_${LUSTRE_NODE_OPT}_outputs ../outputs_values > report"
58
		)
59
		add_test(NAME Stateflow_${L}_${LUSTRE_NODE_OPT}_${LUSTRE_OPTIONS_OPT}
60
				WORKING_DIRECTORY ${LUSTRE_OUTPUT_DIR_${L}_${LUSTRE_NODE_OPT}_${LUSTRE_OPTIONS_OPT}}
61
				COMMAND diff -s  ${L}_${LUSTRE_NODE_OPT}_outputs ../outputs_values)
62
		set_tests_properties(Stateflow_${L}_${LUSTRE_NODE_OPT}_${LUSTRE_OPTIONS_OPT}
63
				PROPERTIES PASS_REGULAR_EXPRESSION "are identical")
64
				
65
				
66
		set(GENERATION_RESULTS ${GENERATION_RESULTS} ${LUSTRE_OUTPUT_DIR_${L}_${LUSTRE_NODE_OPT}_${LUSTRE_OPTIONS_OPT}}/report)
67
		
68
		if(EXISTS ${LUSTRE_OUTPUT_DIR_${L}_${LUSTRE_NODE_OPT}_${LUSTRE_OPTIONS_OPT}}/report )
69
			file(READ ${LUSTRE_OUTPUT_DIR_${L}_${LUSTRE_NODE_OPT}_${LUSTRE_OPTIONS_OPT}}/report REPORT)
70
			file(APPEND ${REPORT_PATH}.in  "${REPORT}")
71
			# Copy the temporary file to the final location
72
			configure_file(${REPORT_PATH}.in ${REPORT_PATH} COPYONLY)
73
		endif()
74
	endif(NOT ${LUSTRE_OUTPUT_DIR_${L}_${LUSTRE_NODE_OPT}_${LUSTRE_OPTIONS_OPT}_RESULT} STREQUAL "0")
75

  
76
ENDFOREACH()
77

  
78

  
79
add_custom_target (Stateflow_GENERATE_FILES ALL
80
	DEPENDS ${GENERATION_RESULTS})
81

  
82

  
83

  
84

  
85

  
86

  
87

  
88

  
89

  
90

  
91
#second combination :-horn
92
set(LUSTRE_OPTIONS_OPT "-horn")
93
#string(REPLACE "-" "" LUS_OPTS_CUT ${LUSTRE_OPTIONS_OPT})
94
#string(REPLACE " " "_" LUS_OPTS_CUT ${LUS_OPTS_CUT})
95
set(LUSTRE_NODE_OPT  "")
96
set(GENERATION_RESULTS "")
97
FOREACH(lus_file ${GLOBAL_LUSTRE_FILES})
98
	get_filename_component(L ${lus_file} NAME_WE)
39
					
40
	set(LUS_OPTS_CUT ${LUSTRE_OPTS_POSTFIX_${L}})
41
	add_test(NAME Stateflow_COMPIL_LUSTRE_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT}
42
			COMMAND  ${LUSTRE_COMPILER} ${LUSTREC_ARGS_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT}} 
43
			#REQUIRED_FILES ${lus_file}
44
	)
45

  
46
	 #********************* make -f ${L}.makefile ***************************
47
	 add_test(NAME Stateflow_MAKE_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT}
48
			COMMAND  make -f ${L}.makefile
49
			WORKING_DIRECTORY ${LUSTRE_OUTPUT_DIR_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT}}
50
	)
51
	SET_TESTS_PROPERTIES ( Stateflow_MAKE_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT}
52
	 PROPERTIES DEPENDS Stateflow_COMPIL_LUSTRE_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT}
53
				REQUIRED_FILES ${L}.makefile
54
				)
55
	 
56
	 #************** execute C binary **********************************
99 57
	
100
	# First command generate C files from Lustre file
101
	Lustre_Compile(LUS_FILE ${lus_file}
102
					NODE ${LUSTRE_NODE_OPT}
103
					OPTS ${LUSTRE_OPTIONS_OPT})
104

  
105
	if(NOT ${LUSTRE_OUTPUT_DIR_${L}_${LUSTRE_NODE_OPT}_${LUSTRE_OPTIONS_OPT}_RESULT} STREQUAL "0" )
106
		message("****************${LUSTRE_GENERATED_FILES_${L}_${LUSTRE_NODE_OPT}_${LUSTRE_OPTIONS_OPT}}: Failed********")
107
	else(NOT ${LUSTRE_OUTPUT_DIR_${L}_${LUSTRE_NODE_OPT}_${LUSTRE_OPTIONS_OPT}_RESULT} STREQUAL "0")
108
		#second command : generate C binary from C files generated before		
109
		#third step : compare binary outputs with the reference.
110
		add_custom_command(
111
			OUTPUT ${LUSTRE_OUTPUT_DIR_${L}_${LUSTRE_NODE_OPT}_${LUSTRE_OPTIONS_OPT}}/report
112
			DEPENDS ${LUSTRE_OUTPUT_DIR_${L}_${LUSTRE_NODE_OPT}_${LUSTRE_OPTIONS_OPT}}/${L}.smt2
113
			COMMAND diff
114
			ARGS -s ${L}.smt2 ../${L}.smt2 > report
115
			WORKING_DIRECTORY ${LUSTRE_OUTPUT_DIR_${L}_${LUSTRE_NODE_OPT}_${LUSTRE_OPTIONS_OPT}}
116
			COMMENT "diff -s ${L}.smt2 ../${L}.smt2 > report"
58
	if (BASH)
59
		add_test(
60
			NAME Stateflow_BIN_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT} 
61
			COMMAND ${BASH} -c "./${L}_${LUSTRE_NODE_OPT} < ../input_values > ${L}_${LUSTRE_NODE_OPT}_outputs"
62
			WORKING_DIRECTORY ${LUSTRE_OUTPUT_DIR_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT}}
117 63
		)
118
		add_test(NAME Stateflow_${L}_${LUSTRE_NODE_OPT}_${LUSTRE_OPTIONS_OPT}
119
				WORKING_DIRECTORY ${LUSTRE_OUTPUT_DIR_${L}_${LUSTRE_NODE_OPT}_${LUSTRE_OPTIONS_OPT}}
120
				COMMAND diff -s   ${L}.smt2 ../${L}.smt2 )
121
		set_tests_properties(Stateflow_${L}_${LUSTRE_NODE_OPT}_${LUSTRE_OPTIONS_OPT}
122
				PROPERTIES PASS_REGULAR_EXPRESSION "are identical")
64
		SET_TESTS_PROPERTIES ( Stateflow_BIN_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT}
65
			PROPERTIES REQUIRED_FILES ${L}_${LUSTRE_NODE_OPT}
66
				DEPENDS Stateflow_MAKE_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT})
67
	else()
68
		message(FATAL_ERROR "Unknown shell command for ${CMAKE_HOST_SYSTEM_NAME}")
69
	endif()
70

  
71
	 #************** execute C binary **********************************
72
	 add_test(NAME Stateflow_DIFF_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT}
73
			COMMAND ${CMAKE_COMMAND} -E compare_files ${L}_${LUSTRE_NODE_OPT}_outputs ../outputs_values 
74
			WORKING_DIRECTORY ${LUSTRE_OUTPUT_DIR_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT}}
75
	)
76
	SET_TESTS_PROPERTIES ( Stateflow_DIFF_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT}
77
	 PROPERTIES REQUIRED_FILES ${L}_${LUSTRE_NODE_OPT}_outputs
78
				DEPENDS Stateflow_BIN_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT} )
123 79
				
124
				
125
		set(GENERATION_RESULTS ${GENERATION_RESULTS} ${LUSTRE_OUTPUT_DIR_${L}_${LUSTRE_NODE_OPT}_${LUSTRE_OPTIONS_OPT}}/report)
126
		
127
		if(EXISTS ${LUSTRE_OUTPUT_DIR_${L}_${LUSTRE_NODE_OPT}_${LUSTRE_OPTIONS_OPT}}/report )
128
			file(READ ${LUSTRE_OUTPUT_DIR_${L}_${LUSTRE_NODE_OPT}_${LUSTRE_OPTIONS_OPT}}/report REPORT)
129
			file(APPEND ${REPORT_PATH}.in  "${REPORT}")
130
			# Copy the temporary file to the final location
131
			configure_file(${REPORT_PATH}.in ${REPORT_PATH} COPYONLY)
132
		endif()
133
	endif(NOT ${LUSTRE_OUTPUT_DIR_${L}_${LUSTRE_NODE_OPT}_${LUSTRE_OPTIONS_OPT}_RESULT} STREQUAL "0")
134

  
80
	
135 81
ENDFOREACH()
136 82

  
137 83

  
138
add_custom_target (Stateflow_GENERATE_FILES_horn ALL
139
	DEPENDS ${GENERATION_RESULTS})

Also available in: Unified diff