Project

General

Profile

Download (14.6 KB) Statistics
| Branch: | Tag: | Revision:
1 c79336a0 bourbouh
include(CMakeParseArguments)
2 cac038b0 bourbouh
include(FindUnixCommands)
3 c79336a0 bourbouh
4 cac038b0 bourbouh
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 c79336a0 bourbouh
  set(options "")
10 cac038b0 bourbouh
  set(oneValueArgs  NODE LUS_FILE  SRC_DIR DST_DIR MAX)
11 c79336a0 bourbouh
  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 cac038b0 bourbouh
  set(LUSTRE_OUTPUT_DIR "${GEN_DST_DIR}/${L}")
17 c79336a0 bourbouh
  file(COPY ${GEN_LUS_FILE}   DESTINATION  ${LUSTRE_OUTPUT_DIR})
18
19
  #generate .lusi if not exists
20 cac038b0 bourbouh
  if(EXISTS ${GEN_SRC_DIR}/${L}.lusi)
21
    file(COPY  ${GEN_SRC_DIR}/${L}.lusi DESTINATION  ${LUSTRE_OUTPUT_DIR})
22 c79336a0 bourbouh
  else()
23
    message("generate ${L}.lusi \n")
24
    Lustre_Compile(LUS_FILE ${GEN_LUS_FILE}
25
      NODE ""
26
      OPTS "-lusi"
27 cac038b0 bourbouh
      DIR ${GEN_SRC_DIR}
28
      DST_DIR ${GEN_DST_DIR})
29
    CUT_OPTIONS("-lusi" GEN_OPTS_CUT_0)
30
    
31 c79336a0 bourbouh
    
32
    execute_process(RESULT_VARIABLE res 
33 cac038b0 bourbouh
     COMMAND ${LUSTRE_COMPILER} ${LUSTREC_ARGS_${L}__${GEN_OPTS_CUT_0}} 
34
     WORKING_DIRECTORY ${GEN_SRC_DIR})
35 c79336a0 bourbouh
    if(${res} STREQUAL "0")
36 cac038b0 bourbouh
      file(COPY  ${GEN_SRC_DIR}/${L}.lusi DESTINATION  ${LUSTRE_OUTPUT_DIR})
37 c79336a0 bourbouh
    else()
38
      message(FATAL_ERROR "${L}.lusi couldn't be generated")
39
    endif()
40
  endif()
41
42 cac038b0 bourbouh
43 c79336a0 bourbouh
  #generate input and output values
44 cac038b0 bourbouh
  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 c79336a0 bourbouh
    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 cac038b0 bourbouh
      WORKING_DIRECTORY ${GEN_SRC_DIR})
52 c79336a0 bourbouh
53
    if(${res} STREQUAL "0")
54 cac038b0 bourbouh
      file(COPY  ${GEN_SRC_DIR}/${L}_${GEN_NODE}_input_values DESTINATION  ${LUSTRE_OUTPUT_DIR})
55 c79336a0 bourbouh
    else()
56
      message(FATAL_ERROR "${L}_input_values couldn't be generated")
57
    endif()
58
  endif()
59
60
  if(GEN_OPTS)
61 cac038b0 bourbouh
    CUT_OPTIONS("${GEN_OPTS}" GEN_OPTS_CUT)
62 c79336a0 bourbouh
  endif()
63
  
64 cac038b0 bourbouh
  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 c79336a0 bourbouh
    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 cac038b0 bourbouh
      OPTS ${GEN_OPTS}
72
      DIR ${GEN_SRC_DIR}
73
      DST_DIR ${GEN_DST_DIR})
74 c79336a0 bourbouh
    
75
    execute_process(
76 cac038b0 bourbouh
      COMMAND ${LUSTRE_COMPILER} ${LUSTREC_ARGS_${L}_${GEN_NODE}_${GEN_OPTS_CUT}} 
77
      WORKING_DIRECTORY ${GEN_SRC_DIR})			
78 c79336a0 bourbouh
    execute_process(
79
      COMMAND  make -f ${L}.makefile
80 cac038b0 bourbouh
      WORKING_DIRECTORY ${GEN_SRC_DIR})	
81 c79336a0 bourbouh
    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 cac038b0 bourbouh
      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 c79336a0 bourbouh
    if(${res} STREQUAL "0")
86 cac038b0 bourbouh
      file(COPY  ${GEN_SRC_DIR}/${L}_${GEN_NODE}_${GEN_OPTS_CUT}_output_values DESTINATION  ${LUSTRE_OUTPUT_DIR})
87 c79336a0 bourbouh
    else()
88
      message(FATAL_ERROR "${L}_${GEN_NODE}_${GEN_OPTS_CUT}_output_values Error")
89
    endif()
90
  endif()
91
92
93 cac038b0 bourbouh
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 5600dad4 bourbouh
    PROPERTIES FAIL_REGULAR_EXPRESSION "AssertionError;ERROR;Failed;Traceback"
197 cac038b0 bourbouh
    DEPENDS ${GEN_TESTS_PREFIX}_COMPIL_LUSTRE_HORN_${L}__${LUS_OPTS_CUT}_${GEN_CALL_ID})
198
  
199
  
200
  add_test(NAME ${GEN_TESTS_PREFIX}_TAIL1_ZUSTRE_${L}_${GEN_NODE}_${ZUS_OPTS_CUT}_${GEN_CALL_ID}
201
    COMMAND bash -c "tail -n +8 ${L}_${GEN_NODE}_${ZUS_OPTS_CUT}.xml > ${L}_tailed1.xml"
202
    WORKING_DIRECTORY ${ZUSTRE_OUTPUT_DIR}
203
    )
204
  SET_TESTS_PROPERTIES ( ${GEN_TESTS_PREFIX}_TAIL1_ZUSTRE_${L}_${GEN_NODE}_${ZUS_OPTS_CUT}_${GEN_CALL_ID}
205
    PROPERTIES REQUIRED_FILES  ${L}_${GEN_NODE}_${ZUS_OPTS_CUT}.xml
206
    DEPENDS ${GEN_TESTS_PREFIX}_COMPIL_ZUSTRE_${L}_${GEN_NODE}_${ZUS_OPTS_CUT}_${GEN_CALL_ID})
207
  
208
  add_test(NAME ${GEN_TESTS_PREFIX}_TAIL2_ZUSTRE_${L}_${GEN_NODE}_${ZUS_OPTS_CUT}_${GEN_CALL_ID}
209
    COMMAND bash -c "tail -n +8 ${L}_${GEN_NODE}_${ZUS_OPTS_CUT}.xml > ${L}_${GEN_NODE}_tailed2.xml"
210
    WORKING_DIRECTORY ${GEN_DST_DIR}/${L}/
211
    )
212
  SET_TESTS_PROPERTIES ( ${GEN_TESTS_PREFIX}_TAIL2_ZUSTRE_${L}_${GEN_NODE}_${ZUS_OPTS_CUT}_${GEN_CALL_ID}
213
    PROPERTIES REQUIRED_FILES  ${L}_${GEN_NODE}_${ZUS_OPTS_CUT}.xml
214
    DEPENDS ${GEN_TESTS_PREFIX}_TAIL1_ZUSTRE_${L}_${GEN_NODE}_${ZUS_OPTS_CUT}_${GEN_CALL_ID})
215
  
216
  
217
  add_test(NAME ${GEN_TESTS_PREFIX}_DIFF_ZUSTRE_${L}_${GEN_NODE}_${ZUS_OPTS_CUT}_${GEN_CALL_ID}
218
    COMMAND ${CMAKE_COMMAND} -E compare_files  ${L}_tailed1.xml  ../${L}_${GEN_NODE}_tailed2.xml
219
    WORKING_DIRECTORY ${ZUSTRE_OUTPUT_DIR}
220
    )
221
  SET_TESTS_PROPERTIES ( ${GEN_TESTS_PREFIX}_DIFF_ZUSTRE_${L}_${GEN_NODE}_${ZUS_OPTS_CUT}_${GEN_CALL_ID}
222
    PROPERTIES REQUIRED_FILES  ${L}_tailed1.xml
223
    DEPENDS ${GEN_TESTS_PREFIX}_TAIL2_ZUSTRE_${L}_${GEN_NODE}_${ZUS_OPTS_CUT}_${GEN_CALL_ID})	
224
225
endfunction(Zustre_compile_and_compare_to_reference)
226
227
228
229
230
231
232
233
234
235
#***********************fourth strategy: compare in case of CEX examples the Zustre trace with lustrec
236
function(Compare_Zustre_and_Lustrec_outputs)
237
  set(options "")
238
  set(oneValueArgs  NODE LUS_FILE  CALL_ID TESTS_PREFIX SRC_DIR DST_DIR)
239
  set(multiValueArgs  OPTS )
240
  cmake_parse_arguments(GEN "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
241
242
  
243
  get_filename_component(L ${GEN_LUS_FILE} NAME_WE)
244
245
  Zustre_Compile(LUS_FILE ${GEN_LUS_FILE}
246
    NODE ${GEN_NODE}
247
    OPTS ${GEN_OPTS}
248
    DST_DIR ${GEN_DST_DIR}
249
    )
250
  if(GEN_OPTS)
251
    CUT_OPTIONS("${GEN_OPTS}" ZUS_OPTS_CUT)
252
  endif()
253
  set(ZUSTRE_OUTPUT_DIR ${ZUSTRE_OUTPUT_DIR_${L}_${GEN_NODE}_${ZUS_OPTS_CUT}})
254
 
255
256
257
  add_test(NAME ${GEN_TESTS_PREFIX}_XPathParser_lusi_ZUSTRE_${L}_${GEN_NODE}_${ZUS_OPTS_CUT}_${GEN_CALL_ID}
258
    COMMAND ${JAVA_RUNTIME} -cp ${CMAKE_BINARY_DIR}/modules/ XPathParser_lusi ${GEN_NODE} ../${L}.lusi ${L}_${GEN_NODE}_${ZUS_OPTS_CUT}.xml
259
    WORKING_DIRECTORY ${ZUSTRE_OUTPUT_DIR}
260
    )
261
  SET_TESTS_PROPERTIES ( ${GEN_TESTS_PREFIX}_XPathParser_lusi_ZUSTRE_${L}_${GEN_NODE}_${ZUS_OPTS_CUT}_${GEN_CALL_ID}
262
    PROPERTIES REQUIRED_FILES  ${GEN_DST_DIR}/${L}/${L}.lusi 
263
    DEPENDS ${GEN_TESTS_PREFIX}_COMPIL_ZUSTRE_${L}_${GEN_NODE}_${ZUS_OPTS_CUT}_${GEN_CALL_ID} )	
264
  
265
  Lustre_Compile(LUS_FILE ${lus_file}
266
    NODE ${GEN_NODE}
267
    OPTS ""
268
    DIR ${ZUSTRE_OUTPUT_DIR}
269
    DST_DIR ${GEN_DST_DIR})
270
  
271
  set(LUS_OPTS_CUT "")
272
  add_test(NAME ${GEN_TESTS_PREFIX}_COMPIL_LUSTRE_${L}_${GEN_NODE}_${LUS_OPTS_CUT}_${GEN_CALL_ID}
273
    COMMAND  ${LUSTRE_COMPILER} ${LUSTREC_ARGS_${L}_${GEN_NODE}_${LUS_OPTS_CUT}} 
274
    WORKING_DIRECTORY ${ZUSTRE_OUTPUT_DIR}
275
    )
276
277
  add_test(NAME ${GEN_TESTS_PREFIX}_MAKE_${L}_${GEN_NODE}_${LUS_OPTS_CUT}_${GEN_CALL_ID}
278
    COMMAND  make -f ${L}.makefile
279
    WORKING_DIRECTORY ${ZUSTRE_OUTPUT_DIR}
280
    )
281
  SET_TESTS_PROPERTIES ( ${GEN_TESTS_PREFIX}_MAKE_${L}_${GEN_NODE}_${LUS_OPTS_CUT}_${GEN_CALL_ID}
282
    PROPERTIES DEPENDS ${GEN_TESTS_PREFIX}_COMPIL_LUSTRE_${L}_${GEN_NODE}_${LUS_OPTS_CUT}_${GEN_CALL_ID}
283
    REQUIRED_FILES ${L}.makefile
284
    )
285
  
286
  
287
  if (BASH)
288
    add_test(
289
      NAME ${GEN_TESTS_PREFIX}_BIN_${L}_${GEN_NODE}_${LUS_OPTS_CUT}_${GEN_CALL_ID} 
290
      COMMAND ${BASH} -c "./${L}_${GEN_NODE} < input_values > ${L}_${GEN_NODE}_outputs"
291
      WORKING_DIRECTORY ${ZUSTRE_OUTPUT_DIR}
292
      )
293
    SET_TESTS_PROPERTIES ( ${GEN_TESTS_PREFIX}_BIN_${L}_${GEN_NODE}_${LUS_OPTS_CUT}_${GEN_CALL_ID}
294
      PROPERTIES REQUIRED_FILES ${L}_${GEN_NODE}
295
      DEPENDS ${GEN_TESTS_PREFIX}_MAKE_${L}_${GEN_NODE}_${LUS_OPTS_CUT}_${GEN_CALL_ID})
296
  else()
297
    message(FATAL_ERROR "Unknown shell command for ${CMAKE_HOST_SYSTEM_NAME}")
298
  endif()
299
300
  #************** compare **********************************
301
  add_test(NAME ${GEN_TESTS_PREFIX}_COMPARE_OUTPUTS_OF_LUSTREC_ZUSTRE_${L}_${GEN_NODE}_${LUS_OPTS_CUT}_${GEN_CALL_ID}
302
    COMMAND ${CMAKE_COMMAND} -E compare_files ${L}_${GEN_NODE}_outputs ZUSTRE_output_values
303
    WORKING_DIRECTORY ${ZUSTRE_OUTPUT_DIR}
304
    )
305
  SET_TESTS_PROPERTIES ( ${GEN_TESTS_PREFIX}_COMPARE_OUTPUTS_OF_LUSTREC_ZUSTRE_${L}_${GEN_NODE}_${LUS_OPTS_CUT}_${GEN_CALL_ID}
306
    PROPERTIES REQUIRED_FILES ${L}_${GEN_NODE}_outputs
307
    DEPENDS ${GEN_TESTS_PREFIX}_BIN_${L}_${GEN_NODE}_${LUS_OPTS_CUT}_${GEN_CALL_ID} )
308
  
309
  
310
311
312
313
314
endfunction()
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
#******************************fifth strategy, test the lustrec binary with outputs of reference
339
340
341
function(Lustre_compile_and_compare_to_reference)
342
  set(options "")
343
  set(oneValueArgs  NODE LUS_FILE CALL_ID  TESTS_PREFIX SRC_DIR DST_DIR)
344
  set(multiValueArgs  OPTS )
345
  cmake_parse_arguments(GEN "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
346
347
  get_filename_component(L ${GEN_LUS_FILE} NAME_WE)
348
  # First command generate C files from Lustre file
349
  Lustre_Compile(LUS_FILE ${GEN_LUS_FILE}
350
    NODE ${GEN_NODE}
351
    OPTS ${GEN_OPTS}
352
    DST_DIR ${GEN_DST_DIR}
353
    )
354
  if(GEN_OPTS)
355
    CUT_OPTIONS("${GEN_OPTS}" LUS_OPTS_CUT)
356
  endif()
357
358
  add_test(NAME ${GEN_TESTS_PREFIX}_COMPIL_LUSTRE_${L}_${GEN_NODE}_${LUS_OPTS_CUT}_${GEN_CALL_ID}
359
    COMMAND  ${LUSTRE_COMPILER} ${LUSTREC_ARGS_${L}_${GEN_NODE}_${LUS_OPTS_CUT}}
360
    WORKING_DIRECTORY ${LUSTRE_OUTPUT_DIR_${L}_${GEN_NODE}_${LUS_OPTS_CUT}}
361
    )
362
363
  #********************* make -f ${L}.makefile ***************************
364
  add_test(NAME ${GEN_TESTS_PREFIX}_MAKE_${L}_${GEN_NODE}_${LUS_OPTS_CUT}_${GEN_CALL_ID}
365
    COMMAND  make -f ${L}.makefile
366
    WORKING_DIRECTORY ${LUSTRE_OUTPUT_DIR_${L}_${GEN_NODE}_${LUS_OPTS_CUT}}
367
    )
368
  SET_TESTS_PROPERTIES ( ${GEN_TESTS_PREFIX}_MAKE_${L}_${GEN_NODE}_${LUS_OPTS_CUT}_${GEN_CALL_ID}
369
    PROPERTIES DEPENDS ${GEN_TESTS_PREFIX}_COMPIL_LUSTRE_${L}_${GEN_NODE}_${LUS_OPTS_CUT}_${GEN_CALL_ID}
370
    REQUIRED_FILES ${L}.makefile
371
    )
372
  
373
  #************** execute C binary **********************************
374
  
375
  if (BASH)
376
    add_test(
377
      NAME ${GEN_TESTS_PREFIX}_BIN_${L}_${GEN_NODE}_${LUS_OPTS_CUT}_${GEN_CALL_ID} 
378
      COMMAND ${BASH} -c "./${L}_${GEN_NODE} < ../${L}_${GEN_NODE}_input_values > ${L}_${GEN_NODE}_${LUS_OPTS_CUT}_output_values"
379
      WORKING_DIRECTORY ${LUSTRE_OUTPUT_DIR_${L}_${GEN_NODE}_${LUS_OPTS_CUT}}
380
      )
381
    SET_TESTS_PROPERTIES ( ${GEN_TESTS_PREFIX}_BIN_${L}_${GEN_NODE}_${LUS_OPTS_CUT}_${GEN_CALL_ID}
382
      PROPERTIES REQUIRED_FILES ${L}_${GEN_NODE}
383
      DEPENDS ${GEN_TESTS_PREFIX}_MAKE_${L}_${GEN_NODE}_${LUS_OPTS_CUT}_${GEN_CALL_ID})
384
  else()
385
    message(FATAL_ERROR "Unknown shell command ${BASH} -c for ${CMAKE_HOST_SYSTEM_NAME}")
386
  endif()
387
388
  #************** execute C binary **********************************
389
  add_test(NAME ${GEN_TESTS_PREFIX}_DIFF_${L}_${GEN_NODE}_${LUS_OPTS_CUT}_${GEN_CALL_ID}
390
    COMMAND ${CMAKE_COMMAND} -E compare_files  ${L}_${GEN_NODE}_${LUS_OPTS_CUT}_output_values ../${L}_${GEN_NODE}__output_values 
391
    WORKING_DIRECTORY ${LUSTRE_OUTPUT_DIR_${L}_${GEN_NODE}_${LUS_OPTS_CUT}}
392
    )
393
  SET_TESTS_PROPERTIES ( ${GEN_TESTS_PREFIX}_DIFF_${L}_${GEN_NODE}_${LUS_OPTS_CUT}_${GEN_CALL_ID}
394
    PROPERTIES REQUIRED_FILES  ${L}_${GEN_NODE}_${LUS_OPTS_CUT}_output_values
395
    DEPENDS ${GEN_TESTS_PREFIX}_BIN_${L}_${GEN_NODE}_${LUS_OPTS_CUT}_${GEN_CALL_ID} )
396
397
endfunction()
398
399
400
401
402
403
404
405
406