2
0
mirror of https://github.com/FWGS/xash3d-fwgs synced 2024-12-22 17:01:14 +01:00

wscript: refactoring, replace --enable-fs-tests with --enable-tests

* Run filesystem tests in sequential order, to avoid tests being run
before filesystem_stdio DLL is linked
* Include new interface test in filesystem
This commit is contained in:
Alibek Omarov 2023-04-13 18:40:27 +03:00
parent db40d58208
commit d86ab19351
2 changed files with 25 additions and 19 deletions

View File

@ -1,12 +1,7 @@
#!/usr/bin/env python
from waflib.Tools import waf_unit_test
def options(opt):
grp = opt.add_option_group('filesystem_stdio options')
grp.add_option('--enable-fs-tests', action='store_true', dest = 'FS_TESTS', default = False,
help = 'enable filesystem_stdio tests')
pass
def configure(conf):
nortti = {
@ -15,8 +10,6 @@ def configure(conf):
}
conf.env.append_unique('CXXFLAGS', conf.get_flags_by_compiler(nortti, conf.env.COMPILER_CC))
conf.env.FS_TESTS = conf.options.FS_TESTS
if conf.env.DEST_OS != 'android':
if conf.env.cxxshlib_PATTERN.startswith('lib'):
conf.env.cxxshlib_PATTERN = conf.env.cxxshlib_PATTERN[3:]
@ -32,21 +25,25 @@ def build(bld):
libs += [ 'public' ]
bld.shlib(target = 'filesystem_stdio',
features = 'cxx',
features = 'cxx seq',
source = bld.path.ant_glob(['*.c', '*.cpp']),
use = libs,
install_path = bld.env.LIBDIR,
subsystem = bld.env.MSVC_SUBSYSTEM)
if bld.env.FS_TESTS:
if bld.env.TESTS:
# build in same module, so dynamic linking will work
# for now (until we turn libpublic to shared module lol)
bld.program(features = 'test',
source = 'tests/caseinsensitive.c',
target = 'test_caseinsensitive',
use = libs + [ 'DL' ],
rpath = '$ORIGIN',
subsystem = bld.env.CONSOLE_SUBSYSTEM,
install_path = None)
bld.add_post_fun(waf_unit_test.summary)
bld.add_post_fun(waf_unit_test.set_exit_code)
tests = {
'caseinsensitive' : 'tests/caseinsensitive.c',
'interface' : 'tests/interface.cpp',
}
for i in tests:
bld.program(features = 'test seq',
source = tests[i],
target = 'test_%s' % i,
use = libs + ['DL'],
rpath = '$ORIGIN',
subsystem = bld.env.CONSOLE_SUBSYSTEM,
install_path = None)

View File

@ -3,6 +3,7 @@
# a1batross, mittorn, 2018
from waflib import Build, Context, Logs
from waflib.Tools import waf_unit_test
import sys
import os
@ -127,6 +128,9 @@ def options(opt):
grp.add_option('--disable-werror', action = 'store_true', dest = 'DISABLE_WERROR', default = False,
help = 'disable compilation abort on warning')
grp.add_option('--enable-tests', action = 'store_true', dest = 'TESTS', default = False,
help = 'enable building standalone tests (does not enable engine tests!) [default: %default]')
grp = opt.add_option_group('Renderers options')
grp.add_option('--enable-all-renderers', action='store_true', dest='ALL_RENDERERS', default=False,
@ -325,6 +329,7 @@ def configure(conf):
conf.env.append_unique('CFLAGS', cflags)
conf.env.append_unique('CXXFLAGS', cxxflags)
conf.env.TESTS = conf.options.TESTS
conf.env.ENABLE_UTILS = conf.options.ENABLE_UTILS
conf.env.ENABLE_FUZZER = conf.options.ENABLE_FUZZER
conf.env.DEDICATED = conf.options.DEDICATED
@ -466,3 +471,7 @@ def build(bld):
continue
bld.add_subproject(i.name)
if bld.env.TESTS:
bld.add_post_fun(waf_unit_test.summary)
bld.add_post_fun(waf_unit_test.set_exit_code)