@ -1749,6 +1749,53 @@ int main(int argc, char **argv) {
self . _run ( ninja ,
workdir = os . path . join ( tmpdir , ' builddir ' ) )
def test_cross_file_system_paths ( self ) :
if is_windows ( ) :
raise unittest . SkipTest ( ' system crossfile paths not defined for Windows (yet) ' )
testdir = os . path . join ( self . common_test_dir , ' 1 trivial ' )
cross_content = textwrap . dedent ( """ \
[ binaries ]
c = ' /usr/bin/cc '
ar = ' /usr/bin/ar '
strip = ' /usr/bin/ar '
[ properties ]
[ host_machine ]
system = ' linux '
cpu_family = ' x86 '
cpu = ' i686 '
endian = ' little '
""" )
with tempfile . TemporaryDirectory ( ) as d :
dir_ = os . path . join ( d , ' meson ' , ' cross ' )
os . makedirs ( dir_ )
with tempfile . NamedTemporaryFile ( ' w ' , dir = dir_ , delete = False ) as f :
f . write ( cross_content )
name = os . path . basename ( f . name )
with mock . patch . dict ( os . environ , { ' XDG_DATA_HOME ' : d } ) :
self . init ( testdir , [ ' --cross-file= ' + name ] , inprocess = True )
self . wipe ( )
with mock . patch . dict ( os . environ , { ' XDG_DATA_DIRS ' : d } ) :
os . environ . pop ( ' XDG_DATA_HOME ' , None )
self . init ( testdir , [ ' --cross-file= ' + name ] , inprocess = True )
self . wipe ( )
with tempfile . TemporaryDirectory ( ) as d :
dir_ = os . path . join ( d , ' .local ' , ' share ' , ' meson ' , ' cross ' )
os . makedirs ( dir_ )
with tempfile . NamedTemporaryFile ( ' w ' , dir = dir_ , delete = False ) as f :
f . write ( cross_content )
name = os . path . basename ( f . name )
with mock . patch ( ' mesonbuild.coredata.os.path.expanduser ' , lambda x : x . replace ( ' ~ ' , d ) ) :
self . init ( testdir , [ ' --cross-file= ' + name ] , inprocess = True )
self . wipe ( )
class FailureTests ( BasePlatformTests ) :
'''
@ -2546,50 +2593,6 @@ endian = 'little'
self . init ( testdir , [ ' -Db_lto=true ' ] , default_args = False )
self . build ( ' reconfigure ' )
def test_cross_file_system_paths ( self ) :
testdir = os . path . join ( self . common_test_dir , ' 1 trivial ' )
cross_content = textwrap . dedent ( """ \
[ binaries ]
c = ' /usr/bin/cc '
ar = ' /usr/bin/ar '
strip = ' /usr/bin/ar '
[ properties ]
[ host_machine ]
system = ' linux '
cpu_family = ' x86 '
cpu = ' i686 '
endian = ' little '
""" )
with tempfile . TemporaryDirectory ( ) as d :
dir_ = os . path . join ( d , ' meson ' , ' cross ' )
os . makedirs ( dir_ )
with tempfile . NamedTemporaryFile ( ' w ' , dir = dir_ , delete = False ) as f :
f . write ( cross_content )
name = os . path . basename ( f . name )
with mock . patch . dict ( os . environ , { ' XDG_DATA_HOME ' : d } ) :
self . init ( testdir , [ ' --cross-file= ' + name ] , inprocess = True )
self . wipe ( )
with mock . patch . dict ( os . environ , { ' XDG_DATA_DIRS ' : d } ) :
os . environ . pop ( ' XDG_DATA_HOME ' , None )
self . init ( testdir , [ ' --cross-file= ' + name ] , inprocess = True )
self . wipe ( )
with tempfile . TemporaryDirectory ( ) as d :
dir_ = os . path . join ( d , ' .local ' , ' share ' , ' meson ' , ' cross ' )
os . makedirs ( dir_ )
with tempfile . NamedTemporaryFile ( ' w ' , dir = dir_ , delete = False ) as f :
f . write ( cross_content )
name = os . path . basename ( f . name )
with mock . patch ( ' mesonbuild.coredata.os.path.expanduser ' , lambda x : x . replace ( ' ~ ' , d ) ) :
self . init ( testdir , [ ' --cross-file= ' + name ] , inprocess = True )
self . wipe ( )
def test_vala_generated_source_buildir_inside_source_tree ( self ) :
'''
Test that valac outputs generated C files in the expected location when