mirror of https://gitlab.com/ita1024/waf.git
Add more folder initialization tests
This commit is contained in:
parent
3cea04e829
commit
8b49da2fa7
|
@ -3,17 +3,24 @@
|
|||
top = '.'
|
||||
out = 'tmp_out'
|
||||
|
||||
import os
|
||||
from waflib import ConfigSet, Context, Build, Configure
|
||||
import os, random, time
|
||||
from waflib import ConfigSet, Context, Build, Configure, Utils
|
||||
|
||||
Configure.autoconfig='clobber'
|
||||
|
||||
def options(opt):
|
||||
opt.add_option('--based', action='store', default='foo', help='base directory', dest='based')
|
||||
opt.add_option('--dumpf', action='store', default='foo', help='dump config to this file', dest='dumpf')
|
||||
opt.add_option('--force-autoconfig', action='store', default=False, dest='force_autoconfig')
|
||||
|
||||
def configure(ctx):
|
||||
pass
|
||||
# force autoconfig to depend on an always-changing file - once
|
||||
if ctx.options.force_autoconfig:
|
||||
fname = ctx.options.dumpf + '_autoconfig'
|
||||
s = "%f%d" % (time.time(), random.randint(0, 10**9))
|
||||
Utils.writef(fname, s)
|
||||
ctx.files.append(fname)
|
||||
Configure.autoconfig = False
|
||||
|
||||
def build(ctx):
|
||||
pass
|
||||
|
|
|
@ -115,6 +115,20 @@ def build(bld):
|
|||
test_cmd([exe, '--top=%s' % proj_cwd], proj_cwd, 'autoconfig')
|
||||
cleanup(bld)
|
||||
|
||||
test_cmd([wscript, 'configure', '--top=project', '--out=project/tmp_out'], up_cwd, 'wscript configure with relative top/out from up cwd',
|
||||
launch_dir='..')
|
||||
test_cmd([wscript], proj_cwd, ' next build from top')
|
||||
test_cmd([wscript], proj_out_cwd, ' next build from out', launch_dir='tmp_out')
|
||||
test_cmd([wscript], proj_sub_cwd, ' next build from subfolder', launch_dir='sub')
|
||||
cleanup(bld)
|
||||
|
||||
test_cmd([exe, '--force-autoconfig', '--top=project'], up_cwd, 'autoconfig from up 1', launch_dir='..')
|
||||
os.remove(dumpf_default + '_autoconfig')
|
||||
test_cmd([exe, '--force-autoconfig', '--top=project'], up_cwd, 'autoconfig from up 2', launch_dir='..')
|
||||
os.remove(dumpf_default + '_autoconfig')
|
||||
test_cmd([exe, '--force-autoconfig', '--out=badout'], proj_cwd, 'autoconfig with clobber')
|
||||
cleanup(bld)
|
||||
|
||||
if failures:
|
||||
bld.fatal('there were errors')
|
||||
|
||||
|
|
Loading…
Reference in New Issue