Project

General

Profile

Download (15.4 KB) Statistics
| Branch: | Tag: | Revision:
1
include(CMakeParseArguments)
2
include(FindUnixCommands)
3

    
4

    
5

    
6

    
7
#******************first stratefy :generate input values and their outputs for reference
8
function(Copy_or_generate_lusi_input_and_output_values_for_reference )
9
  set(options "")
10
  set(oneValueArgs  NODE LUS_FILE  SRC_DIR DST_DIR MAX)
11
  set(multiValueArgs  OPTS )
12
  cmake_parse_arguments(GEN "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
13

    
14
  #message("check references files for ${GEN_LUS_FILE}  ")
15
  get_filename_component(L ${GEN_LUS_FILE} NAME_WE)
16
  set(LUSTRE_OUTPUT_DIR "${GEN_DST_DIR}/${L}")
17
  file(COPY ${GEN_LUS_FILE}   DESTINATION  ${LUSTRE_OUTPUT_DIR})
18

    
19
  #generate .lusi if not exists
20
  if(EXISTS ${GEN_SRC_DIR}/${L}.lusi)
21
    file(COPY  ${GEN_SRC_DIR}/${L}.lusi DESTINATION  ${LUSTRE_OUTPUT_DIR})
22
  else()
23
    message("generate ${L}.lusi \n")
24
    Lustre_Compile(LUS_FILE ${GEN_LUS_FILE}
25
      NODE ""
26
      OPTS "-lusi"
27
      DIR ${GEN_SRC_DIR}
28
      DST_DIR ${GEN_DST_DIR})
29
    CUT_OPTIONS("-lusi" GEN_OPTS_CUT_0)
30
    
31
    
32
    execute_process(RESULT_VARIABLE res 
33
     COMMAND ${LUSTRE_COMPILER} ${LUSTREC_ARGS_${L}__${GEN_OPTS_CUT_0}} 
34
     WORKING_DIRECTORY ${GEN_SRC_DIR})
35
    if(${res} STREQUAL "0")
36
      file(COPY  ${GEN_SRC_DIR}/${L}.lusi DESTINATION  ${LUSTRE_OUTPUT_DIR})
37
    else()
38
      message(FATAL_ERROR "${L}.lusi couldn't be generated")
39
    endif()
40
  endif()
41

    
42

    
43
  #generate input and output values
44
  if(EXISTS ${GEN_SRC_DIR}/${L}_${GEN_NODE}_input_values)
45
    file(COPY  ${GEN_SRC_DIR}/${L}_${GEN_NODE}_input_values DESTINATION  ${LUSTRE_OUTPUT_DIR})
46
  elseif(EXISTS ${GEN_SRC_DIR}/${L}.lusi)
47
    message("generate ${L}_${GEN_NODE}_input_values \n")
48

    
49
    execute_process(RESULT_VARIABLE res 
50
      COMMAND ${JAVA_RUNTIME} -cp ${CMAKE_BINARY_DIR}/modules/ Generate_inputs_lusi ${GEN_NODE} ${L}.lusi ${GEN_MAX}
51
      WORKING_DIRECTORY ${GEN_SRC_DIR})
52

    
53
    if(${res} STREQUAL "0")
54
      file(COPY  ${GEN_SRC_DIR}/${L}_${GEN_NODE}_input_values DESTINATION  ${LUSTRE_OUTPUT_DIR})
55
    else()
56
      message(FATAL_ERROR "${L}_input_values couldn't be generated")
57
    endif()
58
  endif()
59

    
60
  if(GEN_OPTS)
61
    CUT_OPTIONS("${GEN_OPTS}" GEN_OPTS_CUT)
62
  endif()
63
  
64
  if(EXISTS ${GEN_SRC_DIR}/${L}_${GEN_NODE}_${GEN_OPTS_CUT}_output_values)
65
    file(COPY  ${GEN_SRC_DIR}/${L}_${GEN_NODE}_${GEN_OPTS_CUT}_output_values DESTINATION  ${LUSTRE_OUTPUT_DIR})
66
  elseif(EXISTS ${GEN_SRC_DIR}/${L}_${GEN_NODE}_input_values)
67
    message("generate  ${L}_${GEN_NODE}_${GEN_OPTS_CUT}_output_values for reference \n")
68
        
69
    Lustre_Compile(LUS_FILE ${GEN_LUS_FILE}
70
      NODE ${GEN_NODE}
71
      OPTS ${GEN_OPTS}
72
      DIR ${GEN_SRC_DIR}
73
      DST_DIR ${GEN_DST_DIR})
74
    
75
    execute_process(
76
      COMMAND ${LUSTRE_COMPILER} ${LUSTREC_ARGS_${L}_${GEN_NODE}_${GEN_OPTS_CUT}} 
77
      WORKING_DIRECTORY ${GEN_SRC_DIR})			
78
    execute_process(
79
      COMMAND  make -f ${L}.makefile
80
      WORKING_DIRECTORY ${GEN_SRC_DIR})	
81
    execute_process(RESULT_VARIABLE res 
82
      COMMAND ${BASH} -c "./${L}_${GEN_NODE} < ${L}_${GEN_NODE}_input_values > ${L}_${GEN_NODE}_${GEN_OPTS_CUT}_output_values"
83
      WORKING_DIRECTORY ${GEN_SRC_DIR})	
84
    file(REMOVE ${GEN_SRC_DIR}/${L}_${GEN_NODE} ${GEN_SRC_DIR}/io_frontend.o ${GEN_SRC_DIR}/${L}.c ${GEN_SRC_DIR}/${L}.h ${GEN_SRC_DIR}/${L}.lusic ${GEN_SRC_DIR}/${L}.makefile ${GEN_SRC_DIR}/${L}.o ${GEN_SRC_DIR}/${L}_alloc.h ${GEN_SRC_DIR}/${L}_main.c ${GEN_SRC_DIR}/${L}_main.o )
85
    if(${res} STREQUAL "0")
86
      file(COPY  ${GEN_SRC_DIR}/${L}_${GEN_NODE}_${GEN_OPTS_CUT}_output_values DESTINATION  ${LUSTRE_OUTPUT_DIR})
87
    else()
88
      message(FATAL_ERROR "${L}_${GEN_NODE}_${GEN_OPTS_CUT}_output_values Error")
89
    endif()
90
  endif()
91

    
92

    
93
endfunction(Copy_or_generate_lusi_input_and_output_values_for_reference)
94

    
95

    
96

    
97

    
98

    
99

    
100

    
101

    
102

    
103

    
104
#****************************second stratefy :generate zustre output.xml for reference
105
function(Copy_or_generate_zustre_output_xml_for_reference )
106
  set(options "")
107
  set(oneValueArgs  NODE LUS_FILE SRC_DIR DST_DIR)
108
  set(multiValueArgs  OPTS )
109
  cmake_parse_arguments(GEN "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
110

    
111
  if(GEN_OPTS)
112
    CUT_OPTIONS("${GEN_OPTS}" ZUS_OPTS_CUT)
113
  endif()
114
  get_filename_component(L ${GEN_LUS_FILE} NAME_WE)
115
  set(LUSTRE_OUTPUT_DIR "${GEN_DST_DIR}/${L}")
116
  if(EXISTS ${GEN_SRC_DIR}/${L}_${GEN_NODE}_${ZUS_OPTS_CUT}.xml)
117
    file(COPY ${GEN_SRC_DIR}/${L}_${GEN_NODE}_${ZUS_OPTS_CUT}.xml   DESTINATION  ${LUSTRE_OUTPUT_DIR})
118
    file(READ ${GEN_SRC_DIR}/${L}_${GEN_NODE}_${ZUS_OPTS_CUT}.xml ${L}_${GEN_NODE}_zustre_output)		
119
  else()
120
    message("generate ${L}_${GEN_NODE}_${ZUS_OPTS_CUT}.xml for reference\n")
121
    Zustre_Compile(LUS_FILE ${GEN_LUS_FILE}
122
      NODE ${GEN_NODE}
123
      OPTS ${GEN_OPTS}
124
      DST_DIR ${GEN_DST_DIR}
125
      )
126

    
127
    execute_process(RESULT_VARIABLE res 
128
      OUTPUT_VARIABLE ${L}_${GEN_NODE}_zustre_output
129
      COMMAND  ${ZUSTRE_COMPILER} ${ZUSTRE_ARGS_${L}_${GEN_NODE}_${ZUS_OPTS_CUT}} 
130
      WORKING_DIRECTORY ${GEN_SRC_DIR})
131
    
132
    file(WRITE ${GEN_SRC_DIR}/${L}_${GEN_NODE}_${ZUS_OPTS_CUT}.xml ${${L}_${GEN_NODE}_zustre_output})
133
    file(COPY ${GEN_SRC_DIR}/${L}_${GEN_NODE}_${ZUS_OPTS_CUT}.xml   DESTINATION  ${LUSTRE_OUTPUT_DIR})
134
    
135
  endif()
136
  if( ${${L}_${GEN_NODE}_zustre_output} MATCHES "<Answer>CEX</Answer>")
137
    set(ZUSTRE_ANSWER "CEX")
138
  elseif( ${${L}_${GEN_NODE}_zustre_output} MATCHES "<Answer>SAFE</Answer>")
139
    set(ZUSTRE_ANSWER "SAFE")
140
  elseif( ${${L}_${GEN_NODE}_zustre_output} MATCHES "<Answer>TIMEOUT</Answer>")
141
    set(ZUSTRE_ANSWER "TIMEOUT")
142
  else()
143
    set(ZUSTRE_ANSWER "ERROR")
144
  endif()
145
  set(ZUSTRE_ANSWER_${L}_${GEN_NODE} "${ZUSTRE_ANSWER}" PARENT_SCOPE)
146
endfunction(Copy_or_generate_zustre_output_xml_for_reference )
147

    
148

    
149

    
150

    
151

    
152

    
153

    
154
#***********************third strategy: Compile with zustre and compare
155

    
156
function(Zustre_compile_and_compare_to_reference)
157
  set(options "")
158
  set(oneValueArgs  NODE LUS_FILE  TESTS_PREFIX CALL_ID SRC_DIR DST_DIR)
159
  set(multiValueArgs  OPTS )
160
  cmake_parse_arguments(GEN "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
161

    
162

    
163
  get_filename_component(L ${GEN_LUS_FILE} NAME_WE)
164
  
165
  Lustre_Compile(LUS_FILE ${GEN_LUS_FILE}
166
    NODE ""
167
    OPTS "-horn"
168
    DST_DIR ${GEN_DST_DIR}
169
    )
170
  CUT_OPTIONS("-horn" LUS_OPTS_CUT)
171
   
172
  add_test(NAME ${GEN_TESTS_PREFIX}_COMPIL_LUSTRE_HORN_${L}__${LUS_OPTS_CUT}_${GEN_CALL_ID}
173
    COMMAND  ${LUSTRE_COMPILER} ${LUSTREC_ARGS_${L}__${LUS_OPTS_CUT}} 
174
    )
175

    
176
  Zustre_Compile(LUS_FILE ${GEN_LUS_FILE}
177
    NODE ${GEN_NODE}
178
    OPTS ${GEN_OPTS}
179
    DST_DIR ${GEN_DST_DIR}
180
    )
181
  
182
  if(GEN_OPTS)
183
    CUT_OPTIONS("${GEN_OPTS}" ZUS_OPTS_CUT)
184
  endif()
185
  
186
  set(ZUSTRE_OUTPUT_DIR ${ZUSTRE_OUTPUT_DIR_${L}_${GEN_NODE}_${ZUS_OPTS_CUT}})
187
  
188
  set(ZUSTRE_ARGS_TEMP "${ZUSTRE_ARGS_${L}_${GEN_NODE}_${ZUS_OPTS_CUT}}" "> ${L}_${GEN_NODE}_${ZUS_OPTS_CUT}.xml")
189
  JOIN("${ZUSTRE_ARGS_TEMP}" " " ZUSTRE_ARGS)
190
  
191
  add_test(NAME ${GEN_TESTS_PREFIX}_COMPIL_ZUSTRE_${L}_${GEN_NODE}_${ZUS_OPTS_CUT}_${GEN_CALL_ID}
192
    COMMAND bash -c "${ZUSTRE_COMPILER} ${ZUSTRE_ARGS}"
193
    WORKING_DIRECTORY ${ZUSTRE_OUTPUT_DIR}
194
    )
195
  SET_TESTS_PROPERTIES (  ${GEN_TESTS_PREFIX}_COMPIL_ZUSTRE_${L}_${GEN_NODE}_${ZUS_OPTS_CUT}_${GEN_CALL_ID}
196
    PROPERTIES FAIL_REGULAR_EXPRESSION "AssertionError;ERROR;Failed;Traceback"
197
    DEPENDS ${GEN_TESTS_PREFIX}_COMPIL_LUSTRE_HORN_${L}__${LUS_OPTS_CUT}_${GEN_CALL_ID})
198
  
199
  add_test(NAME ${GEN_TESTS_PREFIX}_COMPARE_REF_ZUSTRE_${L}_${GEN_NODE}_${ZUS_OPTS_CUT}_${GEN_CALL_ID}
200
    COMMAND ${CMAKE_COMMAND} -DREF=${GEN_DST_DIR}/${L}/${L}_${GEN_NODE}_${ZUS_OPTS_CUT}.xml
201
                             -DGEN=${ZUSTRE_OUTPUT_DIR}/${L}_${GEN_NODE}_${ZUS_OPTS_CUT}.xml
202
    	    -P ${CMAKE_SOURCE_DIR}/modules/compare_ref_zustre.cmake
203

    
204
    WORKING_DIRECTORY ${ZUSTRE_OUTPUT_DIR}
205
    )
206
  SET_TESTS_PROPERTIES ( ${GEN_TESTS_PREFIX}_COMPARE_REF_ZUSTRE_${L}_${GEN_NODE}_${ZUS_OPTS_CUT}_${GEN_CALL_ID}
207
    PROPERTIES REQUIRED_FILES  "${L}_${GEN_NODE}_${ZUS_OPTS_CUT}.xml"
208
    DEPENDS ${GEN_TESTS_PREFIX}_COMPIL_ZUSTRE_${L}_${GEN_NODE}_${ZUS_OPTS_CUT}_${GEN_CALL_ID})
209

    
210
  
211
  # add_test(NAME ${GEN_TESTS_PREFIX}_TAILGEN_ZUSTRE_${L}_${GEN_NODE}_${ZUS_OPTS_CUT}_${GEN_CALL_ID}
212
  #   COMMAND bash -c "tail -n +8 ${L}_${GEN_NODE}_${ZUS_OPTS_CUT}.xml > ${L}_tailed1.xml; | grep Answer | awk '{$1=$1};1'"
213
  #   WORKING_DIRECTORY ${ZUSTRE_OUTPUT_DIR}
214
  #   )
215
  # SET_TESTS_PROPERTIES ( ${GEN_TESTS_PREFIX}_TAILGEN_ZUSTRE_${L}_${GEN_NODE}_${ZUS_OPTS_CUT}_${GEN_CALL_ID}
216
  #   PROPERTIES REQUIRED_FILES  ${L}_${GEN_NODE}_${ZUS_OPTS_CUT}.xml
217
  #   DEPENDS ${GEN_TESTS_PREFIX}_COMPIL_ZUSTRE_${L}_${GEN_NODE}_${ZUS_OPTS_CUT}_${GEN_CALL_ID})
218
  
219
  # add_test(NAME ${GEN_TESTS_PREFIX}_TAILREF_ZUSTRE_${L}_${GEN_NODE}_${ZUS_OPTS_CUT}_${GEN_CALL_ID}
220
  #   COMMAND bash -c "tail -n +8 ${L}_${GEN_NODE}_${ZUS_OPTS_CUT}.xml > ${L}_${GEN_NODE}_tailed2.xml"
221
  #   WORKING_DIRECTORY ${GEN_DST_DIR}/${L}/
222
  #   )
223
  # SET_TESTS_PROPERTIES ( ${GEN_TESTS_PREFIX}_TAILREF_ZUSTRE_${L}_${GEN_NODE}_${ZUS_OPTS_CUT}_${GEN_CALL_ID}
224
  #   PROPERTIES REQUIRED_FILES  ${L}_${GEN_NODE}_${ZUS_OPTS_CUT}.xml
225
  #   DEPENDS ${GEN_TESTS_PREFIX}_TAILGEN_ZUSTRE_${L}_${GEN_NODE}_${ZUS_OPTS_CUT}_${GEN_CALL_ID})
226
  
227
  
228
  # add_test(NAME ${GEN_TESTS_PREFIX}_DIFF_ZUSTRE_${L}_${GEN_NODE}_${ZUS_OPTS_CUT}_${GEN_CALL_ID}
229
  #   COMMAND ${CMAKE_COMMAND} -E compare_files  ${L}_tailed1.xml  ../${L}_${GEN_NODE}_tailed2.xml
230
  #   WORKING_DIRECTORY ${ZUSTRE_OUTPUT_DIR}
231
  #   )
232
  # SET_TESTS_PROPERTIES ( ${GEN_TESTS_PREFIX}_DIFF_ZUSTRE_${L}_${GEN_NODE}_${ZUS_OPTS_CUT}_${GEN_CALL_ID}
233
  #   PROPERTIES REQUIRED_FILES  ${L}_tailed1.xml
234
  #   DEPENDS ${GEN_TESTS_PREFIX}_TAILREF_ZUSTRE_${L}_${GEN_NODE}_${ZUS_OPTS_CUT}_${GEN_CALL_ID})	
235

    
236
endfunction(Zustre_compile_and_compare_to_reference)
237

    
238

    
239

    
240

    
241

    
242

    
243

    
244

    
245

    
246
#***********************fourth strategy: compare in case of CEX examples the Zustre trace with lustrec
247
function(Compare_Zustre_and_Lustrec_outputs)
248
  set(options "")
249
  set(oneValueArgs  NODE LUS_FILE  CALL_ID TESTS_PREFIX SRC_DIR DST_DIR)
250
  set(multiValueArgs  OPTS )
251
  cmake_parse_arguments(GEN "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
252

    
253
  
254
  get_filename_component(L ${GEN_LUS_FILE} NAME_WE)
255

    
256
  Zustre_Compile(LUS_FILE ${GEN_LUS_FILE}
257
    NODE ${GEN_NODE}
258
    OPTS ${GEN_OPTS}
259
    DST_DIR ${GEN_DST_DIR}
260
    )
261
  if(GEN_OPTS)
262
    CUT_OPTIONS("${GEN_OPTS}" ZUS_OPTS_CUT)
263
  endif()
264
  set(ZUSTRE_OUTPUT_DIR ${ZUSTRE_OUTPUT_DIR_${L}_${GEN_NODE}_${ZUS_OPTS_CUT}})
265
 
266

    
267

    
268
  add_test(NAME ${GEN_TESTS_PREFIX}_XPathParser_lusi_ZUSTRE_${L}_${GEN_NODE}_${ZUS_OPTS_CUT}_${GEN_CALL_ID}
269
    COMMAND ${JAVA_RUNTIME} -cp ${CMAKE_BINARY_DIR}/modules/ XPathParser_lusi ${GEN_NODE} ../${L}.lusi ${L}_${GEN_NODE}_${ZUS_OPTS_CUT}.xml
270
    WORKING_DIRECTORY ${ZUSTRE_OUTPUT_DIR}
271
    )
272
  SET_TESTS_PROPERTIES ( ${GEN_TESTS_PREFIX}_XPathParser_lusi_ZUSTRE_${L}_${GEN_NODE}_${ZUS_OPTS_CUT}_${GEN_CALL_ID}
273
    PROPERTIES REQUIRED_FILES  ${GEN_DST_DIR}/${L}/${L}.lusi 
274
    DEPENDS ${GEN_TESTS_PREFIX}_COMPIL_ZUSTRE_${L}_${GEN_NODE}_${ZUS_OPTS_CUT}_${GEN_CALL_ID} )	
275
  
276
  Lustre_Compile(LUS_FILE ${lus_file}
277
    NODE ${GEN_NODE}
278
    OPTS ""
279
    DIR ${ZUSTRE_OUTPUT_DIR}
280
    DST_DIR ${GEN_DST_DIR})
281
  
282
  set(LUS_OPTS_CUT "")
283
  add_test(NAME ${GEN_TESTS_PREFIX}_COMPIL_LUSTRE_${L}_${GEN_NODE}_${LUS_OPTS_CUT}_${GEN_CALL_ID}
284
    COMMAND  ${LUSTRE_COMPILER} ${LUSTREC_ARGS_${L}_${GEN_NODE}_${LUS_OPTS_CUT}} 
285
    WORKING_DIRECTORY ${ZUSTRE_OUTPUT_DIR}
286
    )
287

    
288
  add_test(NAME ${GEN_TESTS_PREFIX}_MAKE_${L}_${GEN_NODE}_${LUS_OPTS_CUT}_${GEN_CALL_ID}
289
    COMMAND  make -f ${L}.makefile
290
    WORKING_DIRECTORY ${ZUSTRE_OUTPUT_DIR}
291
    )
292
  SET_TESTS_PROPERTIES ( ${GEN_TESTS_PREFIX}_MAKE_${L}_${GEN_NODE}_${LUS_OPTS_CUT}_${GEN_CALL_ID}
293
    PROPERTIES DEPENDS ${GEN_TESTS_PREFIX}_COMPIL_LUSTRE_${L}_${GEN_NODE}_${LUS_OPTS_CUT}_${GEN_CALL_ID}
294
    REQUIRED_FILES ${L}.makefile
295
    )
296
  
297
  
298
  if (BASH)
299
    add_test(
300
      NAME ${GEN_TESTS_PREFIX}_BIN_${L}_${GEN_NODE}_${LUS_OPTS_CUT}_${GEN_CALL_ID} 
301
      COMMAND ${BASH} -c "./${L}_${GEN_NODE} < input_values > ${L}_${GEN_NODE}_outputs"
302
      WORKING_DIRECTORY ${ZUSTRE_OUTPUT_DIR}
303
      )
304
    SET_TESTS_PROPERTIES ( ${GEN_TESTS_PREFIX}_BIN_${L}_${GEN_NODE}_${LUS_OPTS_CUT}_${GEN_CALL_ID}
305
      PROPERTIES REQUIRED_FILES ${L}_${GEN_NODE}
306
      DEPENDS ${GEN_TESTS_PREFIX}_MAKE_${L}_${GEN_NODE}_${LUS_OPTS_CUT}_${GEN_CALL_ID})
307
  else()
308
    message(FATAL_ERROR "Unknown shell command for ${CMAKE_HOST_SYSTEM_NAME}")
309
  endif()
310

    
311
  #************** compare **********************************
312
  add_test(NAME ${GEN_TESTS_PREFIX}_COMPARE_OUTPUTS_OF_LUSTREC_ZUSTRE_${L}_${GEN_NODE}_${LUS_OPTS_CUT}_${GEN_CALL_ID}
313
    COMMAND ${CMAKE_COMMAND} -E compare_files ${L}_${GEN_NODE}_outputs ZUSTRE_output_values
314
    WORKING_DIRECTORY ${ZUSTRE_OUTPUT_DIR}
315
    )
316
  SET_TESTS_PROPERTIES ( ${GEN_TESTS_PREFIX}_COMPARE_OUTPUTS_OF_LUSTREC_ZUSTRE_${L}_${GEN_NODE}_${LUS_OPTS_CUT}_${GEN_CALL_ID}
317
    PROPERTIES REQUIRED_FILES ${L}_${GEN_NODE}_outputs
318
    DEPENDS ${GEN_TESTS_PREFIX}_BIN_${L}_${GEN_NODE}_${LUS_OPTS_CUT}_${GEN_CALL_ID} )
319
  
320
  
321

    
322

    
323

    
324

    
325
endfunction()
326

    
327

    
328

    
329

    
330

    
331

    
332

    
333

    
334

    
335

    
336

    
337

    
338

    
339

    
340

    
341

    
342

    
343

    
344

    
345

    
346

    
347

    
348

    
349
#******************************fifth strategy, test the lustrec binary with outputs of reference
350

    
351

    
352
function(Lustre_compile_and_compare_to_reference)
353
  set(options "")
354
  set(oneValueArgs  NODE LUS_FILE CALL_ID  TESTS_PREFIX SRC_DIR DST_DIR)
355
  set(multiValueArgs  OPTS )
356
  cmake_parse_arguments(GEN "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
357

    
358
  get_filename_component(L ${GEN_LUS_FILE} NAME_WE)
359
  # First command generate C files from Lustre file
360
  Lustre_Compile(LUS_FILE ${GEN_LUS_FILE}
361
    NODE ${GEN_NODE}
362
    OPTS ${GEN_OPTS}
363
    DST_DIR ${GEN_DST_DIR}
364
    )
365
  if(GEN_OPTS)
366
    CUT_OPTIONS("${GEN_OPTS}" LUS_OPTS_CUT)
367
  endif()
368

    
369
  add_test(NAME ${GEN_TESTS_PREFIX}_COMPIL_LUSTRE_${L}_${GEN_NODE}_${LUS_OPTS_CUT}_${GEN_CALL_ID}
370
    COMMAND  ${LUSTRE_COMPILER} ${LUSTREC_ARGS_${L}_${GEN_NODE}_${LUS_OPTS_CUT}}
371
    WORKING_DIRECTORY ${LUSTRE_OUTPUT_DIR_${L}_${GEN_NODE}_${LUS_OPTS_CUT}}
372
    )
373

    
374
  #********************* make -f ${L}.makefile ***************************
375
  add_test(NAME ${GEN_TESTS_PREFIX}_MAKE_${L}_${GEN_NODE}_${LUS_OPTS_CUT}_${GEN_CALL_ID}
376
    COMMAND  make -f ${L}.makefile
377
    WORKING_DIRECTORY ${LUSTRE_OUTPUT_DIR_${L}_${GEN_NODE}_${LUS_OPTS_CUT}}
378
    )
379
  SET_TESTS_PROPERTIES ( ${GEN_TESTS_PREFIX}_MAKE_${L}_${GEN_NODE}_${LUS_OPTS_CUT}_${GEN_CALL_ID}
380
    PROPERTIES DEPENDS ${GEN_TESTS_PREFIX}_COMPIL_LUSTRE_${L}_${GEN_NODE}_${LUS_OPTS_CUT}_${GEN_CALL_ID}
381
    REQUIRED_FILES ${L}.makefile
382
    )
383
  
384
  #************** execute C binary **********************************
385
  
386
  if (BASH)
387
    add_test(
388
      NAME ${GEN_TESTS_PREFIX}_BIN_${L}_${GEN_NODE}_${LUS_OPTS_CUT}_${GEN_CALL_ID} 
389
      COMMAND ${BASH} -c "./${L}_${GEN_NODE} < ../${L}_${GEN_NODE}_input_values > ${L}_${GEN_NODE}_${LUS_OPTS_CUT}_output_values"
390
      WORKING_DIRECTORY ${LUSTRE_OUTPUT_DIR_${L}_${GEN_NODE}_${LUS_OPTS_CUT}}
391
      )
392
    SET_TESTS_PROPERTIES ( ${GEN_TESTS_PREFIX}_BIN_${L}_${GEN_NODE}_${LUS_OPTS_CUT}_${GEN_CALL_ID}
393
      PROPERTIES REQUIRED_FILES ${L}_${GEN_NODE}
394
      DEPENDS ${GEN_TESTS_PREFIX}_MAKE_${L}_${GEN_NODE}_${LUS_OPTS_CUT}_${GEN_CALL_ID})
395
  else()
396
    message(FATAL_ERROR "Unknown shell command ${BASH} -c for ${CMAKE_HOST_SYSTEM_NAME}")
397
  endif()
398

    
399
  #************** execute C binary **********************************
400
  add_test(NAME ${GEN_TESTS_PREFIX}_DIFF_${L}_${GEN_NODE}_${LUS_OPTS_CUT}_${GEN_CALL_ID}
401
    COMMAND ${CMAKE_COMMAND} -E compare_files  ${L}_${GEN_NODE}_${LUS_OPTS_CUT}_output_values ../${L}_${GEN_NODE}__output_values 
402
    WORKING_DIRECTORY ${LUSTRE_OUTPUT_DIR_${L}_${GEN_NODE}_${LUS_OPTS_CUT}}
403
    )
404
  SET_TESTS_PROPERTIES ( ${GEN_TESTS_PREFIX}_DIFF_${L}_${GEN_NODE}_${LUS_OPTS_CUT}_${GEN_CALL_ID}
405
    PROPERTIES REQUIRED_FILES  ${L}_${GEN_NODE}_${LUS_OPTS_CUT}_output_values
406
    DEPENDS ${GEN_TESTS_PREFIX}_BIN_${L}_${GEN_NODE}_${LUS_OPTS_CUT}_${GEN_CALL_ID} )
407

    
408
endfunction()
409

    
410

    
411

    
412

    
413

    
414

    
415

    
416

    
417

    
418

    
(10-10/10)