Project

General

Profile

Statistics
| Branch: | Tag: | Revision:

lustrec-tests / regression_tests / lustre_files / success / safety / CMakeLists.txt @ 47714cf4

History | View | Annotate | Download (5.2 KB)

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

    
4
set(GLOBAL_LUSTRE_FILES "")
5
LUSTREFILES(LFILES ${CMAKE_CURRENT_SOURCE_DIR} )
6
list(APPEND GLOBAL_LUSTRE_FILES ${LFILES})
7
FOREACH(lfile ${LFILES})
8
	get_filename_component(L ${lfile} NAME_WE)
9
	set(LUSTRE_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/${L}")
10
	file(COPY ${lfile}   DESTINATION  ${LUSTRE_OUTPUT_DIR})
11
	if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${L}.lusi)
12
		file(COPY  ${L}.lusi DESTINATION  ${LUSTRE_OUTPUT_DIR})
13
	else()
14
		message("generate ${L}.lusi \n")
15
		Lustre_Compile(LUS_FILE ${lfile}
16
				NODE ""
17
				OPTS "-lusi")				
18
		set(LUS_OPTS_CUT ${LUSTRE_OPTS_POSTFIX_${L}})
19
		execute_process(RESULT_VARIABLE res 
20
					COMMAND ${LUSTRE_COMPILER} ${LUSTREC_ARGS_${L}__${LUS_OPTS_CUT}} 
21
					WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
22
		if(${res} STREQUAL "0")
23
			file(COPY  ${L}.lusi DESTINATION  ${LUSTRE_OUTPUT_DIR})
24
		else()
25
			message("${L}.lusi Error")
26
		endif()
27
	endif()
28
	if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${L}_input_values)
29
		file(COPY  ${L}_input_values DESTINATION  ${LUSTRE_OUTPUT_DIR})
30
	elseif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${L}.lusi)
31
		message("generate input_values \n")
32
		execute_process(RESULT_VARIABLE res 
33
					COMMAND ${JAVA_RUNTIME} -cp ${CMAKE_BINARY_DIR}/modules/ Generate_inputs_lusi top ${L}.lusi 1
34
					WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
35
		if(${res} STREQUAL "0")
36
			file(COPY  ${L}_input_values DESTINATION  ${LUSTRE_OUTPUT_DIR})
37
		else()
38
			message("${L}_input_values Error")
39
		endif()
40
	endif()
41
	if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${L}_output_values)
42
		file(COPY  ${L}_output_values DESTINATION  ${LUSTRE_OUTPUT_DIR})
43
	elseif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${L}_input_values)
44
		message("generate output_values for reference \n")
45
		set(LUSTRE_NODE_OPT  "${L}")
46
		
47
		Lustre_Compile(LUS_FILE ${lfile}
48
						NODE ${LUSTRE_NODE_OPT} 
49
						OPTS ""
50
						DIR ${CMAKE_CURRENT_SOURCE_DIR})
51
						
52
		set(LUS_OPTS_CUT ${LUSTRE_OPTS_POSTFIX_${L}})
53
		
54
		execute_process(
55
					COMMAND ${LUSTRE_COMPILER} ${LUSTREC_ARGS_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT}} 
56
					WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})			
57
		execute_process(
58
					COMMAND  make -f ${L}.makefile
59
					WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})	
60
		execute_process(RESULT_VARIABLE res 
61
					COMMAND ${BASH} -c "./${L}_${LUSTRE_NODE_OPT} < ${L}_input_values > ${L}_output_values"
62
					WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})	
63
		file(REMOVE ${L}_${LUSTRE_NODE_OPT} io_frontend.o ${L}.c ${L}.h ${L}.lusic ${L}.makefile ${L}.o ${L}_alloc.h ${L}_main.c ${L}_main.o )
64
		if(${res} STREQUAL "0")
65
			file(COPY  ${L}_output_values DESTINATION  ${LUSTRE_OUTPUT_DIR})
66
		else()
67
			message("${L} output_values Error")
68
		endif()
69
	endif()
70
ENDFOREACH()
71

    
72

    
73
FOREACH(lus_file ${GLOBAL_LUSTRE_FILES})
74
	get_filename_component(L ${lus_file} NAME_WE)
75
	set(LUSTRE_NODE_OPT  "${L}")
76

    
77

    
78
	#first combination :mpfr
79
	set(LUSTRE_OPTIONS_OPT "-mpfr" "100")
80
	set(EPSILON "0.0001")
81
	
82
	# First command generate C files from Lustre file
83
	Lustre_Compile(LUS_FILE ${lus_file}
84
					NODE ${LUSTRE_NODE_OPT}
85
					OPTS ${LUSTRE_OPTIONS_OPT}
86
					CALL_ID "2")
87
					
88
	set(LUS_OPTS_CUT_2 "${LUSTRE_OPTS_POSTFIX_${L}_2}")
89
	add_test(NAME safety_plane_archi_COMPIL_LUSTRE_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT_2}
90
			COMMAND  ${LUSTRE_COMPILER} ${LUSTREC_ARGS_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT_2}} 
91
	)
92

    
93
	 #********************* make -f ${L}.makefile ***************************
94
	 add_test(NAME safety_plane_archi_MAKE_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT_2}
95
			COMMAND  make -f ${L}.makefile
96
			WORKING_DIRECTORY ${LUSTRE_OUTPUT_DIR_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT_2}}
97
	)
98
	SET_TESTS_PROPERTIES ( safety_plane_archi_MAKE_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT_2}
99
	 PROPERTIES DEPENDS safety_plane_archi_COMPIL_LUSTRE_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT_2}
100
				REQUIRED_FILES ${L}.makefile
101
				)
102
	 
103
	 #************** execute C binary **********************************
104
	
105
	if (BASH)
106
		add_test(
107
			NAME safety_plane_archi_BIN_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT_2} 
108
			COMMAND ${BASH} -c "./${L}_${LUSTRE_NODE_OPT} < ../${L}_input_values > ${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT_2}_outputs"
109
			WORKING_DIRECTORY ${LUSTRE_OUTPUT_DIR_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT_2}}
110
		)
111
		SET_TESTS_PROPERTIES ( safety_plane_archi_BIN_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT_2}
112
			PROPERTIES REQUIRED_FILES ${L}_${LUSTRE_NODE_OPT}
113
				DEPENDS safety_plane_archi_MAKE_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT_2})
114
	else()
115
		message(FATAL_ERROR "Unknown shell command ${BASH} -c for ${CMAKE_HOST_SYSTEM_NAME}")
116
	endif()
117
	
118
	 #************** execute C binary **********************************
119
	 add_test(NAME safety_plane_archi_DIFF_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT_2}
120
COMMAND ${JAVA_RUNTIME} -cp ${CMAKE_BINARY_DIR}/modules/ compare_lustrec_outputs ${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT_2}_outputs ../${L}_output_values ${EPSILON}
121
	   WORKING_DIRECTORY ${LUSTRE_OUTPUT_DIR_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT_2}}
122
	)
123
	SET_TESTS_PROPERTIES ( safety_plane_archi_DIFF_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT_2}
124
	 PROPERTIES REQUIRED_FILES ${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT_2}_outputs
125
				DEPENDS safety_plane_archi_BIN_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT_2} )
126
	
127
ENDFOREACH()
128

    
129
add_custom_target(safety_plane_archi COMMAND ${CMAKE_CTEST_COMMAND} -R safety_plane_archi)
130