aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--waflib/extras/autowaf.py54
-rw-r--r--wscript4
2 files changed, 41 insertions, 17 deletions
diff --git a/waflib/extras/autowaf.py b/waflib/extras/autowaf.py
index feaae3c6..92d0e57e 100644
--- a/waflib/extras/autowaf.py
+++ b/waflib/extras/autowaf.py
@@ -87,9 +87,6 @@ def set_options(opt, debug_by_default=False, test=False):
test_opts.add_option('--wrapper', type='string',
dest='test_wrapper',
help='command prefix for tests (e.g. valgrind)')
- test_opts.add_option('--verbose-tests', action='store_true',
- default=False, dest='verbose_tests',
- help='always show test output')
g_step = 1
@@ -249,16 +246,37 @@ def configure(conf):
conf.env['CXXFLAGS'] = ['-O0', '-g']
else:
if conf.env['MSVC_COMPILER']:
- conf.env['CFLAGS'] = ['/MD', '/FS', '/DNDEBUG']
- conf.env['CXXFLAGS'] = ['/MD', '/FS', '/DNDEBUG']
+ append_cxx_flags(['/MD', '/FS', '/DNDEBUG'])
else:
append_cxx_flags(['-DNDEBUG'])
if conf.env.MSVC_COMPILER:
Options.options.no_coverage = True
- if Options.options.strict:
- conf.env.append_value('CFLAGS', ['/Wall'])
- conf.env.append_value('CXXFLAGS', ['/Wall'])
+ append_cxx_flags(['/nologo',
+ '/FS',
+ '/DNDEBUG',
+ '/D_CRT_SECURE_NO_WARNINGS',
+ '/experimental:external',
+ '/external:W0',
+ '/external:anglebrackets'])
+ conf.env.append_value('LINKFLAGS', '/nologo')
+ if Options.options.strict or Options.options.ultra_strict:
+ ms_strict_flags = ['/Wall',
+ '/wd4061',
+ '/wd4200',
+ '/wd4514',
+ '/wd4571',
+ '/wd4625',
+ '/wd4626',
+ '/wd4706',
+ '/wd4710',
+ '/wd4820',
+ '/wd5026',
+ '/wd5027',
+ '/wd5045']
+ conf.env.append_value('CFLAGS', ms_strict_flags)
+ conf.env.append_value('CXXFLAGS', ms_strict_flags)
+ conf.env.append_value('CXXFLAGS', ['/EHsc'])
else:
if Options.options.ultra_strict:
Options.options.strict = True
@@ -346,7 +364,7 @@ def set_c_lang(conf, lang):
"Set a specific C language standard, like 'c99' or 'c11'"
if conf.env.MSVC_COMPILER:
# MSVC has no hope or desire to compile C99, just compile as C++
- conf.env.append_unique('CFLAGS', ['-TP'])
+ conf.env.append_unique('CFLAGS', ['/TP'])
else:
flag = '-std=%s' % lang
conf.check(cflags=['-Werror', flag],
@@ -370,7 +388,7 @@ def set_modern_c_flags(conf):
if 'COMPILER_CC' in conf.env:
if conf.env.MSVC_COMPILER:
# MSVC has no hope or desire to compile C99, just compile as C++
- conf.env.append_unique('CFLAGS', ['-TP'])
+ conf.env.append_unique('CFLAGS', ['/TP'])
else:
for flag in ['-std=c11', '-std=c99']:
if conf.check(cflags=['-Werror', flag], mandatory=False,
@@ -739,11 +757,17 @@ def cd_to_orig_dir(ctx, child):
else:
os.chdir('..')
+def bench_time():
+ if hasattr(time, 'perf_counter'): # Added in Python 3.3
+ return time.perf_counter()
+ else:
+ return time.time()
+
def pre_test(ctx, appname, dirs=['src']):
Logs.pprint('GREEN', '\n[==========] Running %s tests' % appname)
if not hasattr(ctx, 'autowaf_tests_total'):
- ctx.autowaf_tests_start_time = time.clock()
+ ctx.autowaf_tests_start_time = bench_time()
ctx.autowaf_tests_total = 0
ctx.autowaf_tests_failed = 0
ctx.autowaf_local_tests_total = 0
@@ -811,7 +835,7 @@ def post_test(ctx, appname, dirs=['src'], remove=['*boost*', 'c++*']):
coverage_lcov.close()
coverage_log.close()
- duration = (time.clock() - ctx.autowaf_tests_start_time) * 1000.0
+ duration = (bench_time() - ctx.autowaf_tests_start_time) * 1000.0
total_tests = ctx.autowaf_tests[appname]['total']
failed_tests = ctx.autowaf_tests[appname]['failed']
passed_tests = total_tests - failed_tests
@@ -884,7 +908,7 @@ def run_test(ctx,
if type(test) != list and not callable(test):
Logs.pprint('RED', test)
- if Options.options.verbose_tests and type(test) != list and not callable(test):
+ if Options.options.verbose and type(test) != list and not callable(test):
sys.stdout.write(out[0].decode('utf-8'))
sys.stderr.write(out[1].decode('utf-8'))
@@ -899,7 +923,7 @@ def tests_name(ctx, appname, name='*'):
def begin_tests(ctx, appname, name='*'):
ctx.autowaf_local_tests_failed = 0
ctx.autowaf_local_tests_total = 0
- ctx.autowaf_local_tests_start_time = time.clock()
+ ctx.autowaf_local_tests_start_time = bench_time()
Logs.pprint('GREEN', '\n[----------] %s' % (
tests_name(ctx, appname, name)))
@@ -913,7 +937,7 @@ def begin_tests(ctx, appname, name='*'):
return Handle()
def end_tests(ctx, appname, name='*'):
- duration = (time.clock() - ctx.autowaf_local_tests_start_time) * 1000.0
+ duration = (bench_time() - ctx.autowaf_local_tests_start_time) * 1000.0
total = ctx.autowaf_local_tests_total
failures = ctx.autowaf_local_tests_failed
if failures == 0:
diff --git a/wscript b/wscript
index 848f6657..093bdbe3 100644
--- a/wscript
+++ b/wscript
@@ -339,7 +339,7 @@ def test_suite(ctx, base_uri, testdir, report, isyntax, osyntax, options=''):
asserter = 'http://drobilla.net/drobilla#me'
def run_test(command, expected_return, name, quiet=False):
- header = Options.options.verbose_tests
+ header = Options.options.verbose
result = autowaf.run_test(ctx, APPNAME, command, expected_return, name=name, header=header, quiet=quiet)
if expected_return is not None and expected_return != 0:
autowaf.run_test(ctx, APPNAME,
@@ -361,7 +361,7 @@ def test_suite(ctx, base_uri, testdir, report, isyntax, osyntax, options=''):
thru_options += list(itertools.combinations(thru_flags, n))
thru_options_iter = itertools.cycle(thru_options)
- quiet = not Options.options.verbose_tests
+ quiet = not Options.options.verbose
tests_name = '%s.%s' % (testdir, test_class[test_class.find('#') + 1:])
with autowaf.begin_tests(ctx, APPNAME, tests_name):
for (num, test) in enumerate(sorted(tests)):