Project

General

Profile

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

View differences:

regression_tests/lustre_files/success/Simulink/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

  
26
  file(COPY ${LFILE} "${subdir}/input_values" "${subdir}/outputs_values" DESTINATION  ${LUSTRE_OUTPUT_DIR})
25
  file(COPY ${LFILE} "${subdir}/input_values" "${subdir}/outputs_values"   DESTINATION  ${LUSTRE_OUTPUT_DIR})
27 26
ENDFOREACH()
28 27

  
29 28
#first combination :no option
30 29
set(LUSTRE_OPTIONS_OPT "")
31
set(GENERATION_RESULTS "")
32
set(REPORT_PATH  "${CMAKE_CURRENT_BINARY_DIR}/report")
33
file(WRITE ${REPORT_PATH}  "")
34 30
FOREACH(lus_file ${GLOBAL_LUSTRE_FILES})
35 31
	get_filename_component(L ${lus_file} NAME_WE)
36 32
	set(LUSTRE_NODE_OPT  "${L}")
37
	set(LUSTRE_OPTIONS_OPT  "" )
38 33
	
39 34
	# First command generate C files from Lustre file
40 35
	Lustre_Compile(LUS_FILE ${lus_file}
41 36
					NODE ${LUSTRE_NODE_OPT}
42 37
					OPTS ${LUSTRE_OPTIONS_OPT})
38
					
39
	set(LUS_OPTS_CUT ${LUSTRE_OPTS_POSTFIX_${L}})
40
	add_test(NAME Simulink_COMPIL_LUSTRE_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT}
41
			COMMAND  ${LUSTRE_COMPILER} ${LUSTREC_ARGS_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT}} 
42
			#REQUIRED_FILES ${lus_file}
43
	)
43 44

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

  
70
	 #************** execute C binary **********************************
71
	 add_test(NAME Simulink_DIFF_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT}
72
			COMMAND ${CMAKE_COMMAND} -E compare_files ${L}_${LUSTRE_NODE_OPT}_outputs ../outputs_values 
73
			WORKING_DIRECTORY ${LUSTRE_OUTPUT_DIR_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT}}
74
	)
75
	SET_TESTS_PROPERTIES ( Simulink_DIFF_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT}
76
	 PROPERTIES REQUIRED_FILES ${L}_${LUSTRE_NODE_OPT}_outputs
77
				DEPENDS Simulink_BIN_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT} )
78
				
79
	
78 80
ENDFOREACH()
79 81

  
80 82

  
81
add_custom_target (Simulink_GENERATE_FILES ALL
82
	DEPENDS ${GENERATION_RESULTS})

Also available in: Unified diff