Project

General

Profile

Revision 4d5a2e6e

View differences:

regression_tests/lustre_files/success/CMakeLists.txt
8 8
add_subdirectory(clocks)
9 9
add_subdirectory(lego_robot)
10 10
add_subdirectory(linear_ctl)
11
add_subdirectory(mpfr)
regression_tests/lustre_files/success/mpfr/CMakeLists.txt
1
cmake_minimum_required(VERSION 2.8.4)
2
include(FindUnixCommands)
3

  
4

  
5

  
6

  
7

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

  
77

  
78

  
79
FOREACH(lus_file ${GLOBAL_LUSTRE_FILES})
80
	get_filename_component(L ${lus_file} NAME_WE)
81
	set(LUSTRE_NODE_OPT  "${L}")
82

  
83

  
84
	#first combination :mpfr
85
	set(LUSTRE_OPTIONS_OPT "-mpfr" "100")
86
	set(EPSILON "0.0001")
87
	
88
	# First command generate C files from Lustre file
89
	Lustre_Compile(LUS_FILE ${lus_file}
90
					NODE ${LUSTRE_NODE_OPT}
91
					OPTS ${LUSTRE_OPTIONS_OPT}
92
					CALL_ID "2")
93
					
94
	set(LUS_OPTS_CUT_2 "${LUSTRE_OPTS_POSTFIX_${L}_2}")
95
	add_test(NAME mpfr_COMPIL_LUSTRE_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT_2}
96
			COMMAND  ${LUSTRE_COMPILER} ${LUSTREC_ARGS_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT_2}} 
97
	)
98

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

  
133

  
134

  
135

  
136
ENDFOREACH()
137

  
138
add_custom_target(mpfr COMMAND ${CMAKE_CTEST_COMMAND} -R mpfr)
139

  
regression_tests/lustre_files/success/mpfr/dss_test.lusi
1
(* Generated Lustre Interface file from dss_test.lus *)
2
(* by Lustre-C compiler version 1.3-458, 2016/10/25, 13:38:51 *)
3
(* Feel free to mask some of the definitions by removing them from this file. *)
4

  
5
node dss_test (In1_1_1: real; In2_1_1: real; In3_1_1: real; In4_1_1: real; In4_1_2: real; In5_1_1: real; In5_1_2: real; In6_1_1: real; In6_1_2: real; In7_1_1: real) returns (Out1_1_1: real; Out2_2_1: real; Out3_3_1: real; Out4_4_1: real; Out4_4_2: real; Out5_5_1: real; Out5_5_2: real; Out6_6_1: real; Out6_6_2: real; Out7_7_1: real);
6

  
regression_tests/lustre_files/success/mpfr/integrator_test.lusi
1
(* Generated Lustre Interface file from integrator_test.lus *)
2
(* by Lustre-C compiler version 1.3-458, 2016/10/25, 13:38:49 *)
3
(* Feel free to mask some of the definitions by removing them from this file. *)
4

  
5
node integrator_test (In1_1_1: real) returns (Out1_1_1: real);
6

  
regression_tests/lustre_files/success/mpfr/math_2_test.lusi
1
(* Generated Lustre Interface file from math_2_test.lus *)
2
(* by Lustre-C compiler version 1.3-458, 2016/10/25, 13:38:51 *)
3
(* Feel free to mask some of the definitions by removing them from this file. *)
4

  
5
#open <math>
6

  
7
node math_2_test (In6_1_1: real; In7_1_1: real; In8_1_1: real; In9_1_1: real; In11_1_1: real) returns (Out6_1_1: real; Out7_2_1: real; Out8_3_1: real; Out10_4_1: real);
8

  
regression_tests/lustre_files/success/mpfr/math_vect_2_test.lusi
1
(* Generated Lustre Interface file from math_vect_2_test.lus *)
2
(* by Lustre-C compiler version 1.3-458, 2016/10/25, 13:38:50 *)
3
(* Feel free to mask some of the definitions by removing them from this file. *)
4

  
5
#open <math>
6

  
7
node math_vect_2_test (In6_1_1: real; In6_1_2: real; In6_1_3: real; In7_1_1: real; In7_1_2: real; In7_1_3: real; In8_1_1: real; In8_1_2: real; In8_1_3: real; In9_1_1: real; In9_1_2: real; In9_1_3: real; In11_1_1: real; In11_1_2: real; In11_1_3: real; In1_1_1: real; In1_1_2: real; In1_1_3: real; In2_1_1: real; In3_1_1: real; In4_1_1: real; In4_1_2: real; In4_1_3: real) returns (Out6_1_1: real; Out6_1_2: real; Out6_1_3: real; Out7_2_1: real; Out7_2_2: real; Out7_2_3: real; Out8_3_1: real; Out8_3_2: real; Out8_3_3: real; Out10_4_1: real; Out10_4_2: real; Out10_4_3: real; Out1_5_1: real; Out1_5_2: real; Out1_5_3: real; Out2_6_1: real; Out2_6_2: real; Out2_6_3: real);
8

  

Also available in: Unified diff