Project

General

Profile

Revision 0c9457a0 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
include(FindUnixCommands)
3 2

  
4 3

  
5

  
6
#find_package(Lustre)
4
set(LUSTRE_OPTIONS_OPT "" )
5
set(MAX_INPUT_VALUE 100)
7 6

  
8 7

  
9 8
#proceed all subdirectories
10 9
SUBDIRLIST(SUBDIRS ${CMAKE_CURRENT_SOURCE_DIR}  "src_")
11

  
12
#take all lustre files
13
set(GLOBAL_LUSTRE_FILES "")
14 10
FOREACH(subdir ${SUBDIRS})
15
  #message("${subdir}")
16
  LUSTREFILES(LFILE ${subdir} )
17
  list(APPEND GLOBAL_LUSTRE_FILES ${LFILE})
18
  get_filename_component(L ${LFILE} NAME_WE)
19
  set(LUSTRE_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/${L}")
20
  file(COPY ${LFILE} "${subdir}/input_values" "${subdir}/outputs_values"   DESTINATION  ${LUSTRE_OUTPUT_DIR})
21
ENDFOREACH()
22

  
23
#first combination :no option
24
set(LUSTRE_OPTIONS_OPT "")
25
FOREACH(lus_file ${GLOBAL_LUSTRE_FILES})
11
  LUSTREFILES(LFILES ${subdir} )
12
  set(TESTS_PREFIX "Simulink")
13
  set(SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/${subdir}")
14
  set(DST_DIR "${CMAKE_CURRENT_BINARY_DIR}")
15
  FOREACH(lus_file ${LFILES})
26 16
	get_filename_component(L ${lus_file} NAME_WE)
27
	set(LUSTRE_NODE_OPT  "${L}")
28
	
29
	# First command generate C files from Lustre file
30
	Lustre_Compile(LUS_FILE ${lus_file}
31
					NODE ${LUSTRE_NODE_OPT}
32
					OPTS ${LUSTRE_OPTIONS_OPT})
33
					
34
	set(LUS_OPTS_CUT ${LUSTRE_OPTS_POSTFIX_${L}})
35
	add_test(NAME Simulink_COMPIL_LUSTRE_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT}
36
			COMMAND  ${LUSTRE_COMPILER} ${LUSTREC_ARGS_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT}} 
37
			#REQUIRED_FILES ${lus_file}
17
	set(NODE_NAME  "${L}")
18
	Copy_or_generate_lusi_input_and_output_values_for_reference(
19
		LUS_FILE ${lus_file}
20
		NODE ${NODE_NAME}
21
		OPTS ${LUSTRE_OPTIONS_OPT}
22
		MAX ${MAX_INPUT_VALUE}  	#maximum value for input values.
23
		SRC_DIR ${SRC_DIR}
24
		DST_DIR ${DST_DIR}
38 25
	)
39 26

  
40
	 #********************* make -f ${L}.makefile ***************************
41
	 add_test(NAME Simulink_MAKE_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT}
42
			COMMAND  make -f ${L}.makefile
43
			WORKING_DIRECTORY ${LUSTRE_OUTPUT_DIR_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT}}
27
	Lustre_compile_and_compare_to_reference(
28
		LUS_FILE ${lus_file}
29
		NODE ${NODE_NAME}
30
		TESTS_PREFIX ${TESTS_PREFIX}
31
		OPTS ${LUSTRE_OPTIONS_OPT}
32
		CALL_ID "1"
33
		SRC_DIR ${SRC_DIR}
34
		DST_DIR ${DST_DIR}
44 35
	)
45
	SET_TESTS_PROPERTIES ( Simulink_MAKE_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT}
46
	 PROPERTIES DEPENDS Simulink_COMPIL_LUSTRE_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT}
47
				REQUIRED_FILES ${L}.makefile
48
				)
49
	 
50
	 #************** execute C binary **********************************
51
	
52
	if (BASH)
53
		add_test(
54
			NAME Simulink_BIN_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT} 
55
			COMMAND ${BASH} -c "./${L}_${LUSTRE_NODE_OPT} < ../input_values > ${L}_${LUSTRE_NODE_OPT}_outputs"
56
			WORKING_DIRECTORY ${LUSTRE_OUTPUT_DIR_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT}}
57
		)
58
		SET_TESTS_PROPERTIES ( Simulink_BIN_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT}
59
			PROPERTIES REQUIRED_FILES ${L}_${LUSTRE_NODE_OPT}
60
				DEPENDS Simulink_MAKE_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT})
61
	else()
62
		message(FATAL_ERROR "Unknown shell command for ${CMAKE_HOST_SYSTEM_NAME}")
63
	endif()
64

  
65
	 #************** execute C binary **********************************
66
	 add_test(NAME Simulink_DIFF_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT}
67
			COMMAND ${CMAKE_COMMAND} -E compare_files ${L}_${LUSTRE_NODE_OPT}_outputs ../outputs_values 
68
			WORKING_DIRECTORY ${LUSTRE_OUTPUT_DIR_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT}}
69
	)
70
	SET_TESTS_PROPERTIES ( Simulink_DIFF_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT}
71
	 PROPERTIES REQUIRED_FILES ${L}_${LUSTRE_NODE_OPT}_outputs
72
				DEPENDS Simulink_BIN_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT} )
73
				
74 36
	
37
  ENDFOREACH()
75 38
ENDFOREACH()
76 39

  
77 40
add_custom_target(Simulink COMMAND ${CMAKE_CTEST_COMMAND} -R Simulink)
41

  

Also available in: Unified diff