mirror of https://gitlab.com/ita1024/waf.git
Add more installation tests
This commit is contained in:
parent
09fd2f211f
commit
a079b50df1
|
@ -22,6 +22,7 @@ def test(self):
|
|||
def configure(conf):
|
||||
|
||||
tmpdir = conf.bldnode.make_node('tmpdir')
|
||||
tmpdir.delete(evict=False)
|
||||
|
||||
def build(bld):
|
||||
bld.is_install = env.INSTALL
|
||||
|
@ -32,15 +33,28 @@ def configure(conf):
|
|||
tsk = bld.install_files('${PREFIX}/bin', 'tmpfile', chmod=Utils.O755, name='cheese')
|
||||
bld(rule='ls -l ${SRC}', always=True, bring_in='cheese', features='ruler')
|
||||
|
||||
# preserve the folder structure or not (relative_trick)
|
||||
bld.path.make_node('blah/blah').mkdir()
|
||||
bld(features='subst', source='tmpfile', target='blah/blah/rel1', is_copy=True, install_path='${PREFIX}')
|
||||
|
||||
bld(features='subst', source='tmpfile', target='blah/blah/rel2', is_copy=True)
|
||||
bld.install_files('${PREFIX}', 'blah/blah/rel2', relative_base=bld.path.get_bld(), relative_trick=True)
|
||||
|
||||
bld(features='subst', source='tmpfile', target='blah/blah/rel3', is_copy=True)
|
||||
bld.install_files('${PREFIX}', 'blah/blah/rel3', relative_base=bld.path.search_node('blah').get_bld(), relative_trick=True)
|
||||
|
||||
env = conf.env.derive()
|
||||
env.INSTALL = Build.INSTALL
|
||||
conf.run_build(build_fun=build, msg='building', okmsg='ok', errmsg='eh', env=env)
|
||||
assert tmpdir.exists()
|
||||
assert tmpdir.make_node('bin/foo').exists()
|
||||
assert tmpdir.make_node('bin/tmpfile').abspath()
|
||||
assert tmpdir.make_node('bin/tmpfile').exists()
|
||||
assert tmpdir.make_node('bin/foo').read() == tmpdir.make_node('bin/tmpfile').read()
|
||||
assert os.path.lexists(tmpdir.make_node('bin/bar').abspath())
|
||||
assert os.readlink(tmpdir.make_node('bin/bar').abspath()) == '../tmpfile'
|
||||
assert tmpdir.make_node('rel1').exists()
|
||||
assert tmpdir.make_node('blah/blah/rel2').exists()
|
||||
assert tmpdir.make_node('blah/rel3').exists()
|
||||
|
||||
env.INSTALL = Build.UNINSTALL
|
||||
conf.run_build(build_fun=build, msg='building', okmsg='ok', errmsg='eh', env=env)
|
||||
|
@ -49,4 +63,8 @@ def configure(conf):
|
|||
assert not tmpdir.make_node('bin/tmpfile').exists()
|
||||
assert not os.path.lexists(tmpdir.make_node('bin/bar').abspath())
|
||||
assert not tmpdir.exists()
|
||||
assert not tmpdir.make_node('rel1').exists()
|
||||
assert not tmpdir.make_node('blah/blah/rel2').exists()
|
||||
assert not tmpdir.make_node('blah/rel3').exists()
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue