feature/crepe_org
Last change
on this file since d9a5466 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
|
Rev | Line | |
---|
[6ed0f4e] | 1 | # vim:set syntax=python: |
---|
| 2 | |
---|
[281381f] | 3 | import os.path |
---|
| 4 | |
---|
[21def97] | 5 | uselib = ['aubio'] |
---|
[58cffee] | 6 | |
---|
| 7 | includes = ['../src', '.'] |
---|
[21def97] | 8 | programs_sources = ctx.path.ant_glob('src/**/*.c') |
---|
[58cffee] | 9 | |
---|
[505b49a] | 10 | test_sound_target = '44100Hz_44100f_sine441_stereo.wav' |
---|
| 11 | test_sound_abspath = bld.path.get_bld().make_node(test_sound_target) |
---|
[60384e9] | 12 | # workaround to double escape backslash characters on windows |
---|
| 13 | test_sound_abspath = str(test_sound_abspath).replace('\\', '\\\\') |
---|
[505b49a] | 14 | |
---|
[242e923] | 15 | b = bld(name='create_tests_source', |
---|
[505b49a] | 16 | rule='python ${SRC} ${TGT}', |
---|
[3569326] | 17 | source='create_tests_source.py', |
---|
[505b49a] | 18 | target=test_sound_target) |
---|
[242e923] | 19 | # use post() to create the task, keep a reference to it |
---|
| 20 | b.post() |
---|
| 21 | create_tests_source = b.tasks[0] |
---|
[505b49a] | 22 | |
---|
[21def97] | 23 | for source_file in programs_sources: |
---|
[281381f] | 24 | target = os.path.basename(os.path.splitext(str(source_file))[0]) |
---|
[242e923] | 25 | a = bld(features = 'c cprogram test', |
---|
[21def97] | 26 | source = source_file, |
---|
[281381f] | 27 | target = target, |
---|
[dc0e759] | 28 | includes = includes, |
---|
[21def97] | 29 | use = uselib, |
---|
[09fab95] | 30 | install_path = None, |
---|
[505b49a] | 31 | defines = ['AUBIO_UNSTABLE_API=1', |
---|
[586383d] | 32 | 'AUBIO_TESTS_SOURCE={}'.format(test_sound_abspath)] |
---|
[21def97] | 33 | ) |
---|
[242e923] | 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.