Project

General

Profile

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

  
4 3

  
4
set(LUSTRE_OPTIONS_OPT "" )
5
set(MAX_INPUT_VALUE 100)
5 6

  
6
#find_package(Lustre)
7

  
8
if(LUSTRE_COMPILER)
9
  message(STATUS "Found lustrec: ${LUSTRE_COMPILER} ")
10
else(LUSTRE_COMPILER)
11
  message(FATAL_ERROR "lustrec not found")
12
endif(LUSTRE_COMPILER)
13 7

  
14 8
#proceed all subdirectories
15 9
SUBDIRLIST(SUBDIRS ${CMAKE_CURRENT_SOURCE_DIR}  "src_")
16

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

  
28
#first combination :no option
29
set(LUSTRE_OPTIONS_OPT "")
30

  
31
FOREACH(lus_file ${GLOBAL_LUSTRE_FILES})
11
  LUSTREFILES(LFILES ${subdir} )
12
  set(TESTS_PREFIX "Steteflow")
13
  set(SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/${subdir}")
14
  set(DST_DIR "${CMAKE_CURRENT_BINARY_DIR}")
15
  FOREACH(lus_file ${LFILES})
32 16
	get_filename_component(L ${lus_file} NAME_WE)
33
	set(LUSTRE_NODE_OPT  "${L}")
34
	
35
	# First command generate C files from Lustre file
36
	Lustre_Compile(LUS_FILE ${lus_file}
37
					NODE ${LUSTRE_NODE_OPT}
38
					OPTS ${LUSTRE_OPTIONS_OPT})
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}
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}
44 25
	)
45 26

  
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}}
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}
50 35
	)
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 **********************************
57
	
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}}
63
		)
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} )
79
				
80 36
	
37
  ENDFOREACH()
81 38
ENDFOREACH()
82 39

  
83
add_custom_target(Stateflow COMMAND ${CMAKE_CTEST_COMMAND} -R Stateflow)
40
add_custom_target(Steteflow COMMAND ${CMAKE_CTEST_COMMAND} -R Steteflow)
41

  

Also available in: Unified diff