Integrated the new testlist.py into the build.
This commit is contained in:
parent
f95c87dc96
commit
18c7eae71e
|
@ -1,9 +1,10 @@
|
||||||
# 19 january 2020
|
# 19 january 2020
|
||||||
|
|
||||||
libui_test_sources = [
|
# Using files() is the cleanest way to ensure the python script below gets the right filenames regardless of how meson sandboxes the command it's running.
|
||||||
|
libui_test_sources = files([
|
||||||
'initmain.c',
|
'initmain.c',
|
||||||
'noinitwrongthread.c',
|
'noinitwrongthread.c',
|
||||||
]
|
])
|
||||||
|
|
||||||
libui_test_sources_without_cases = [
|
libui_test_sources_without_cases = [
|
||||||
'errors.c',
|
'errors.c',
|
||||||
|
@ -38,24 +39,34 @@ if libui_OS == 'windows'
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
pymod = import('python')
|
||||||
|
python = pymod.find_installation()
|
||||||
|
# Likewise, use files() here to make sure the Python script itself will always have the right path.
|
||||||
|
libui_testlist_py = files(['testlist.py'])
|
||||||
|
|
||||||
|
libui_testlist_h = custom_target(
|
||||||
|
'testlist.h',
|
||||||
|
input: libui_test_sources,
|
||||||
|
output: ['testlist.h'],
|
||||||
|
command: [python, libui_testlist_py, 'header', '@OUTPUT@', '@INPUT@'])
|
||||||
|
libui_testlist_c = custom_target(
|
||||||
|
'testlist.c',
|
||||||
|
input: libui_test_sources,
|
||||||
|
output: ['testlist.c'],
|
||||||
|
command: [python, libui_testlist_py, 'source', '@OUTPUT@', '@INPUT@'])
|
||||||
|
|
||||||
# TODO once we upgrade to 0.49.0, add pie: true
|
# TODO once we upgrade to 0.49.0, add pie: true
|
||||||
# TODO once we upgrade to 0.50.0, add protocol: 'exitcode'
|
# TODO once we upgrade to 0.50.0, add protocol: 'exitcode'
|
||||||
libui_testparent = executable('testparent', libui_test_sources + libui_test_sources_without_cases,
|
libui_testparent = executable('testparent', libui_test_sources + libui_test_sources_without_cases + [libui_testlist_c, libui_testlist_h],
|
||||||
dependencies: libui_binary_deps + libui_test_deps,
|
dependencies: libui_binary_deps + libui_test_deps,
|
||||||
link_with: libui_libui,
|
link_with: libui_libui,
|
||||||
gui_app: false,
|
gui_app: false,
|
||||||
install: false)
|
install: false)
|
||||||
|
|
||||||
pymod = import('python')
|
runresult = run_command(python, libui_testlist_py + ['list'] + libui_test_sources)
|
||||||
python = pymod.find_installation()
|
|
||||||
# Using files() is the cleanest way to ensure the python script gets the right filenames regardless of how meson sandboxes the command it's running.
|
|
||||||
libui_testlist_py = files(['testlist.py'])
|
|
||||||
libui_test_sources_files = files(libui_test_sources)
|
|
||||||
runresult = run_command(python, libui_testlist_py + ['list'] + libui_test_sources_files)
|
|
||||||
if runresult.returncode() != 0
|
if runresult.returncode() != 0
|
||||||
error('testlist.py failed; cannot compute list of test cases. Exit code @0@; stderr:\n@1@'.format(runresult.returncode(), runresult.stderr()))
|
error('testlist.py failed; cannot compute list of test cases. Exit code @0@; stderr:\n@1@'.format(runresult.returncode(), runresult.stderr()))
|
||||||
endif
|
endif
|
||||||
# TODO make sure this works properly on Windows
|
|
||||||
foreach casename : runresult.stdout().split()
|
foreach casename : runresult.stdout().split()
|
||||||
test(casename, libui_testparent,
|
test(casename, libui_testparent,
|
||||||
args: [casename],
|
args: [casename],
|
||||||
|
|
|
@ -93,6 +93,8 @@ sharedbitsPrintfFunc(
|
||||||
5, 6);
|
5, 6);
|
||||||
#undef sharedbitsPrintfFunc
|
#undef sharedbitsPrintfFunc
|
||||||
|
|
||||||
|
#include "testlist.h"
|
||||||
|
|
||||||
// end of test framework definitions
|
// end of test framework definitions
|
||||||
|
|
||||||
#define diff(fmt) "\ngot " fmt "\nwant " fmt
|
#define diff(fmt) "\ngot " fmt "\nwant " fmt
|
||||||
|
|
Loading…
Reference in New Issue