source: tests/wscript_build @ 3fa8d95

feature/cnnfeature/crepe
Last change on this file since 3fa8d95 was 242e923, checked in by Paul Brossier <piem@piem.org>, 6 years ago

[tests] make sure unit tests run after sound file is created

  • Property mode set to 100644
File size: 1.2 KB
Line 
1# vim:set syntax=python:
2
3import os.path
4
5uselib = ['aubio']
6
7includes = ['../src', '.']
8programs_sources = ctx.path.ant_glob('src/**/*.c')
9
10test_sound_target = '44100Hz_44100f_sine441_stereo.wav'
11test_sound_abspath = bld.path.get_bld().make_node(test_sound_target)
12# workaround to double escape backslash characters on windows
13test_sound_abspath = str(test_sound_abspath).replace('\\', '\\\\')
14
15b = bld(name='create_tests_source',
16    rule='python ${SRC} ${TGT}',
17    source='create_tests_source.py',
18    target=test_sound_target)
19# use post() to create the task, keep a reference to it
20b.post()
21create_tests_source = b.tasks[0]
22
23for source_file in programs_sources:
24    target = os.path.basename(os.path.splitext(str(source_file))[0])
25    a = bld(features = 'c cprogram test',
26            source = source_file,
27            target = target,
28            includes = includes,
29            use = uselib,
30            install_path = None,
31            defines = ['AUBIO_UNSTABLE_API=1',
32                        'AUBIO_TESTS_SOURCE={}'.format(test_sound_abspath)]
33       )
34    a.post()
35    # make sure the unit_test task runs *after* the source is created
36    a.tasks[-1].set_run_after(create_tests_source)
Note: See TracBrowser for help on using the repository browser.