@ -180,6 +180,16 @@ def check_pkg(conf, name, **args):
@@ -180,6 +180,16 @@ def check_pkg(conf, name, **args):
else :
conf . env [ var_name ] = CheckType . OPTIONAL
if not conf . env . MSVC_COMPILER and ' system ' in args and args [ ' system ' ] :
includes = conf . env [ ' INCLUDES_ ' + nameify ( args [ ' uselib_store ' ] ) ]
for path in includes :
if ' COMPILER_CC ' in conf . env :
conf . env . append_value ( ' CFLAGS ' , [ ' -isystem ' , path ] )
if ' COMPILER_CXX ' in conf . env :
conf . env . append_value ( ' CXXFLAGS ' , [ ' -isystem ' , path ] )
conf . env . append_value ( ' CXXFLAGS ' , [ ' -isystem ' , ' /usr/local/include ' ] )
def normpath ( path ) :
if sys . platform == ' win32 ' :
return os . path . normpath ( path ) . replace ( ' \\ ' , ' / ' )
@ -721,8 +731,6 @@ def cd_to_build_dir(ctx, appname):
@@ -721,8 +731,6 @@ def cd_to_build_dir(ctx, appname):
os . chdir ( os . path . join ( ' build ' , appname ) )
else :
os . chdir ( ' build ' )
Logs . pprint ( ' GREEN ' , ( " Waf: Entering directory ` %s ' " %
os . path . abspath ( os . getcwd ( ) ) ) )
def cd_to_orig_dir ( ctx , child ) :
if child :
@ -731,6 +739,8 @@ def cd_to_orig_dir(ctx, child):
@@ -731,6 +739,8 @@ def cd_to_orig_dir(ctx, child):
os . chdir ( ' .. ' )
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_total = 0
ctx . autowaf_tests_failed = 0
@ -796,21 +806,20 @@ def post_test(ctx, appname, dirs=['src'], remove=['*boost*', 'c++*']):
@@ -796,21 +806,20 @@ def post_test(ctx, appname, dirs=['src'], remove=['*boost*', 'c++*']):
coverage_lcov . close ( )
coverage_log . close ( )
if ctx . autowaf_tests [ appname ] [ ' failed ' ] > 0 :
Logs . pprint ( ' RED ' , ' \n Summary: %d / %d %s tests failed ' % (
ctx . autowaf_tests [ appname ] [ ' failed ' ] ,
ctx . autowaf_tests [ appname ] [ ' total ' ] ,
appname ) )
else :
Logs . pprint ( ' GREEN ' , ' \n Summary: All %d %s tests passed ' % (
ctx . autowaf_tests [ appname ] [ ' total ' ] , appname ) )
total_tests = ctx . autowaf_tests [ appname ] [ ' total ' ]
failed_tests = ctx . autowaf_tests [ appname ] [ ' failed ' ]
passed_tests = total_tests - failed_tests
Logs . pprint ( ' GREEN ' , ' [==========] %d tests from %s ran ' % (
total_tests , appname ) )
if not ctx . env . NO_COVERAGE :
Logs . pprint ( ' GREEN ' , ' Coverage: <file:// %s > \n '
Logs . pprint ( ' GREEN ' , ' [----------] Coverage: <file:// %s > '
% os . path . abspath ( ' coverage/index.html ' ) )
Logs . pprint ( ' GREEN ' , ( " Waf: Leaving directory ` %s ' " %
os . path . abspath ( os . getcwd ( ) ) ) )
Logs . pprint ( ' GREEN ' , ' [ PASSED ] %d tests ' % passed_tests )
if failed_tests > 0 :
Logs . pprint ( ' RED ' , ' [ FAILED ] %d tests ' % failed_tests )
Logs . pprint ( ' ' , ' ' )
top_level = ( len ( ctx . stack_path ) > 1 )
if top_level :
cd_to_orig_dir ( ctx , top_level )
@ -844,7 +853,7 @@ def run_test(ctx,
@@ -844,7 +853,7 @@ def run_test(ctx,
if isinstance ( test , type ( [ ] ) ) :
s = ' ' . join ( test )
if header and not quiet :
Logs . pprint ( ' Green ' , ' \n ** Test %s ' % s )
Logs . pprint ( ' Green ' , ' \n [ RUN ] %s ' % s )
cmd = test
if Options . options . test_wrapper :
cmd = Options . options . test_wrapper + ' ' + test
@ -859,17 +868,18 @@ def run_test(ctx,
@@ -859,17 +868,18 @@ def run_test(ctx,
success = desired_status is None or returncode == desired_status
if success :
if not quiet :
Logs . pprint ( ' GREEN ' , ' ** Pass %s ' % name )
Logs . pprint ( ' GREEN ' , ' [ OK ] %s ' % name )
else :
Logs . pprint ( ' RED ' , ' ** FAIL %s ' % name )
Logs . pprint ( ' RED ' , ' [ FAILED ] %s ' % name )
ctx . autowaf_tests_failed + = 1
ctx . autowaf_local_tests_failed + = 1
ctx . autowaf_tests [ appname ] [ ' failed ' ] + = 1
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 ) :
sys . stdout . write ( out [ 0 ] )
sys . stderr . write ( out [ 1 ] )
sys . stdout . write ( out [ 0 ] . decode ( ' utf-8 ' ) )
sys . stderr . write ( out [ 1 ] . decode ( ' utf-8 ' ) )
return ( success , out )
@ -882,7 +892,7 @@ def tests_name(ctx, appname, name='*'):
@@ -882,7 +892,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
Logs . pprint ( ' GREEN ' , ' \n ** Begin %s test s' % (
Logs . pprint ( ' GREEN ' , ' [----------] % s' % (
tests_name ( ctx , appname , name ) ) )
class Handle :
@ -895,13 +905,14 @@ def begin_tests(ctx, appname, name='*'):
@@ -895,13 +905,14 @@ def begin_tests(ctx, appname, name='*'):
return Handle ( )
def end_tests ( ctx , appname , name = ' * ' ) :
total = ctx . autowaf_local_tests_total
failures = ctx . autowaf_local_tests_failed
if failures == 0 :
Logs . pprint ( ' GREEN ' , ' ** Passed all %d %s tests ' % (
Logs . pprint ( ' GREEN ' , ' [----------] %d tests from %s \n ' % (
ctx . autowaf_local_tests_total , tests_name ( ctx , appname , name ) ) )
else :
Logs . pprint ( ' RED ' , ' ** Failed %d / %d %s tests ' % (
failures , ctx . autowaf_local_tests_ total, tests_name ( ctx , appname , name ) ) )
Logs . pprint ( ' RED ' , ' [----------] %d / %d tests from %s \n ' % (
total - failures , total , tests_name ( ctx , appname , name ) ) )
def run_tests ( ctx ,
appname ,