Project

General

Profile

Revision 6c3ea955 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 2

  
3 3

  
4
#helpfull functions and macros
5
MACRO(SUBDIRLIST result curdir)
6
  FILE(GLOB children RELATIVE ${curdir} ${curdir}/*)
7
  SET(dirlist "")
8
  FOREACH(child ${children})
9
    IF(IS_DIRECTORY ${curdir}/${child})
10
      LIST(APPEND dirlist ${child})
11
    ENDIF()
12
  ENDFOREACH()
13
  SET(${result} ${dirlist})
14
ENDMACRO()
15 4

  
16
MACRO(LUSTREFILES result dir)
17
  FILE(GLOB children ${dir} ${dir}/*.lus)
18
  SET(lustreFileslist "")
19
  FOREACH(child ${children})
20
    IF(EXISTS ${child} AND NOT IS_DIRECTORY ${child})
21
      LIST(APPEND lustreFileslist ${child})
22
    ENDIF()
23
  ENDFOREACH()
24
  SET(${result} ${lustreFileslist})
25
ENDMACRO()
26 5

  
27 6
#find_package(Lustre)
28 7

  
......
33 12
endif(LUSTRE_COMPILER)
34 13

  
35 14
#proceed all subdirectories
36
SUBDIRLIST(SUBDIRS ${CMAKE_CURRENT_SOURCE_DIR})
15
SUBDIRLIST(SUBDIRS ${CMAKE_CURRENT_SOURCE_DIR}  "src_")
37 16

  
38 17
#take all lustre files
39 18
set(GLOBAL_LUSTRE_FILES "")
40 19
FOREACH(subdir ${SUBDIRS})
20
  #message("${subdir}")
41 21
  LUSTREFILES(LFILE ${subdir} )
42 22
  list(APPEND GLOBAL_LUSTRE_FILES ${LFILE})
43 23
  get_filename_component(L ${LFILE} NAME_WE)
......
49 29
set(LUSTRE_OPTIONS_OPT "")
50 30
set(GENERATION_RESULTS "")
51 31
set(REPORT_PATH  "${CMAKE_CURRENT_BINARY_DIR}/report")
52
file(WRITE REPORT_PATH "")
32
file(WRITE ${REPORT_PATH}  "")
53 33
FOREACH(lus_file ${GLOBAL_LUSTRE_FILES})
54 34
	get_filename_component(L ${lus_file} NAME_WE)
55 35
	set(LUSTRE_NODE_OPT  "${L}")
......
59 39
	Lustre_Compile(LUS_FILE ${lus_file}
60 40
					NODE ${LUSTRE_NODE_OPT}
61 41
					OPTS ${LUSTRE_OPTIONS_OPT})
62
						
63
	#second command : generate C binary from C files generated before		
64
	#third step : compare binary outputs with the reference.
65
	add_custom_command(
66
		OUTPUT ${LUSTRE_OUTPUT_DIR_${L}_${LUSTRE_NODE_OPT}_${LUSTRE_OPTIONS_OPT}}/report
67
		DEPENDS ${LUSTRE_GENERATED_FILES_${L}_${LUSTRE_NODE_OPT}_${LUSTRE_OPTIONS_OPT}}
68
		COMMAND make 
69
		ARGS  -f ${L}.makefile
70
		COMMAND ./${L}_${LUSTRE_NODE_OPT} 
71
		ARGS < ../input_values > ${L}_${LUSTRE_NODE_OPT}_outputs
72
		COMMAND diff
73
		ARGS -s ${L}_${LUSTRE_NODE_OPT}_outputs ../outputs_values > report
74
		WORKING_DIRECTORY ${LUSTRE_OUTPUT_DIR_${L}_${LUSTRE_NODE_OPT}_${LUSTRE_OPTIONS_OPT}}
75
		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"
76
	)
77
	add_test(NAME Stateflow_${L}_${LUSTRE_NODE_OPT}_${LUSTRE_OPTIONS_OPT}
42

  
43
	if(NOT ${LUSTRE_OUTPUT_DIR_${L}_${LUSTRE_NODE_OPT}_${LUSTRE_OPTIONS_OPT}_RESULT} STREQUAL "0" )
44
		message("****************${LUSTRE_GENERATED_FILES_${L}_${LUSTRE_NODE_OPT}_${LUSTRE_OPTIONS_OPT}}: Failed********")
45
	else(NOT ${LUSTRE_OUTPUT_DIR_${L}_${LUSTRE_NODE_OPT}_${LUSTRE_OPTIONS_OPT}_RESULT} STREQUAL "0")
46
		#second command : generate C binary from C files generated before		
47
		#third step : compare binary outputs with the reference.
48
		add_custom_command(
49
			OUTPUT ${LUSTRE_OUTPUT_DIR_${L}_${LUSTRE_NODE_OPT}_${LUSTRE_OPTIONS_OPT}}/report
50
			DEPENDS ${LUSTRE_GENERATED_FILES_${L}_${LUSTRE_NODE_OPT}_${LUSTRE_OPTIONS_OPT}}
51
			COMMAND make 
52
			ARGS  -f ${L}.makefile
53
			COMMAND ./${L}_${LUSTRE_NODE_OPT} 
54
			ARGS < ../input_values > ${L}_${LUSTRE_NODE_OPT}_outputs
55
			COMMAND diff
56
			ARGS -s ${L}_${LUSTRE_NODE_OPT}_outputs ../outputs_values > report
78 57
			WORKING_DIRECTORY ${LUSTRE_OUTPUT_DIR_${L}_${LUSTRE_NODE_OPT}_${LUSTRE_OPTIONS_OPT}}
79
			COMMAND diff -s  ${L}_${LUSTRE_NODE_OPT}_outputs ../outputs_values)
80
	set_tests_properties(Stateflow_${L}_${LUSTRE_NODE_OPT}_${LUSTRE_OPTIONS_OPT}
81
			PROPERTIES PASS_REGULAR_EXPRESSION "are identical")
82
			
83
			
84
	set(GENERATION_RESULTS ${GENERATION_RESULTS} ${LUSTRE_OUTPUT_DIR_${L}_${LUSTRE_NODE_OPT}_${LUSTRE_OPTIONS_OPT}}/report)
85
	
86
	if(EXISTS ${LUSTRE_OUTPUT_DIR_${L}_${LUSTRE_NODE_OPT}_${LUSTRE_OPTIONS_OPT}}/report )
87
		file(READ ${LUSTRE_OUTPUT_DIR_${L}_${LUSTRE_NODE_OPT}_${LUSTRE_OPTIONS_OPT}}/report REPORT)
88
		file(APPEND ${REPORT_PATH}.in  "${REPORT}")
89
		# Copy the temporary file to the final location
90
		configure_file(${REPORT_PATH}.in ${REPORT_PATH} COPYONLY)
91
	endif()
92
	
58
			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"
59
		)
60
		add_test(NAME Stateflow_${L}_${LUSTRE_NODE_OPT}_${LUSTRE_OPTIONS_OPT}
61
				WORKING_DIRECTORY ${LUSTRE_OUTPUT_DIR_${L}_${LUSTRE_NODE_OPT}_${LUSTRE_OPTIONS_OPT}}
62
				COMMAND diff -s  ${L}_${LUSTRE_NODE_OPT}_outputs ../outputs_values)
63
		set_tests_properties(Stateflow_${L}_${LUSTRE_NODE_OPT}_${LUSTRE_OPTIONS_OPT}
64
				PROPERTIES PASS_REGULAR_EXPRESSION "are identical")
65
				
66
				
67
		set(GENERATION_RESULTS ${GENERATION_RESULTS} ${LUSTRE_OUTPUT_DIR_${L}_${LUSTRE_NODE_OPT}_${LUSTRE_OPTIONS_OPT}}/report)
68
		
69
		if(EXISTS ${LUSTRE_OUTPUT_DIR_${L}_${LUSTRE_NODE_OPT}_${LUSTRE_OPTIONS_OPT}}/report )
70
			file(READ ${LUSTRE_OUTPUT_DIR_${L}_${LUSTRE_NODE_OPT}_${LUSTRE_OPTIONS_OPT}}/report REPORT)
71
			file(APPEND ${REPORT_PATH}.in  "${REPORT}")
72
			# Copy the temporary file to the final location
73
			configure_file(${REPORT_PATH}.in ${REPORT_PATH} COPYONLY)
74
		endif()
75
	endif(NOT ${LUSTRE_OUTPUT_DIR_${L}_${LUSTRE_NODE_OPT}_${LUSTRE_OPTIONS_OPT}_RESULT} STREQUAL "0")
76

  
93 77
ENDFOREACH()
94 78

  
95 79

  
96
add_custom_target (GENERATE_FILES ALL
80
add_custom_target (Stateflow_GENERATE_FILES ALL
97 81
	DEPENDS ${GENERATION_RESULTS})

Also available in: Unified diff