From 364cb87cb322dc1ba08d7cbfdcf36d70c72d27bf Mon Sep 17 00:00:00 2001 From: William Deegan Date: Fri, 19 Mar 2021 11:39:59 -0700 Subject: Fix test to no longer need factory or scanner specified. Flesh out the fixture with actual dirs and files. Also add SOURCE.relpath, so singular case is also tested --- test/File/File-relpath.py | 12 +++++++----- test/File/fixture/SConstruct-relpath | 16 ---------------- test/File/fixture/relpath/base/SConstruct | 15 +++++++++++++++ test/File/fixture/relpath/base/build/file1 | 0 test/File/fixture/relpath/base/src/file | 0 5 files changed, 22 insertions(+), 21 deletions(-) delete mode 100644 test/File/fixture/SConstruct-relpath create mode 100644 test/File/fixture/relpath/base/SConstruct create mode 100644 test/File/fixture/relpath/base/build/file1 create mode 100644 test/File/fixture/relpath/base/src/file diff --git a/test/File/File-relpath.py b/test/File/File-relpath.py index e3569dc..48c862b 100644 --- a/test/File/File-relpath.py +++ b/test/File/File-relpath.py @@ -36,11 +36,13 @@ test = TestSCons.TestSCons() test.subdir('src', ['src', 'dir']) -test.file_fixture('fixture/SConstruct-relpath', 'SConstruct') - -test.run('-Q', status=0, stdout="""\ +test.dir_fixture('fixture/relpath') +test.run('-Q', chdir='base', status=0, stdout="""\ ../foo/dir build/file1 %s %s -src +src/file +%s +src/file %s -""" % (os.path.abspath('../foo/dir'), os.path.abspath('build/file1'), os.path.abspath('src'))) +""" % (os.path.abspath('base/../foo/dir'), os.path.abspath('base/build/file1'), os.path.abspath('base/src/file'), + os.path.abspath('base/src/file'))) diff --git a/test/File/fixture/SConstruct-relpath b/test/File/fixture/SConstruct-relpath deleted file mode 100644 index 16a6e8f..0000000 --- a/test/File/fixture/SConstruct-relpath +++ /dev/null @@ -1,16 +0,0 @@ -import os - -import SCons.Defaults - -DefaultEnvironment(tools=[]) -Echo = Builder(action=['@echo ${TARGETS.relpath}', - 'echo ${TARGETS.abspath}', - 'echo ${SOURCES.relpath}', - 'echo ${SOURCES.abspath}'], - target_scanner=SCons.Defaults.DirEntryScanner, - target_factory=Entry, - source_factory=Entry - ) - -env = Environment(tools=[], BUILDERS={'Echo': Echo}) -env.Echo(['../foo/dir', 'build/file1'], ['src']) diff --git a/test/File/fixture/relpath/base/SConstruct b/test/File/fixture/relpath/base/SConstruct new file mode 100644 index 0000000..af2459e --- /dev/null +++ b/test/File/fixture/relpath/base/SConstruct @@ -0,0 +1,15 @@ +# Testcase to check that .relpath works on SOURCES,TARGETS, and the singular SOURCE +# This is the SConstruct for test/File/File-relpath.py +# +DefaultEnvironment(tools=[]) +Echo = Builder(action=['@echo ${TARGETS.relpath}', + '@echo ${TARGETS.abspath}', + '@echo ${SOURCES.relpath}', + '@echo ${SOURCES.abspath}', + '@echo ${SOURCE.relpath}', + '@echo ${SOURCE.abspath}' + ], + ) + +env = Environment(tools=[], BUILDERS={'Echo': Echo}) +env.Echo(['../foo/dir', 'build/file1'], ['src/file']) diff --git a/test/File/fixture/relpath/base/build/file1 b/test/File/fixture/relpath/base/build/file1 new file mode 100644 index 0000000..e69de29 diff --git a/test/File/fixture/relpath/base/src/file b/test/File/fixture/relpath/base/src/file new file mode 100644 index 0000000..e69de29 -- cgit v0.12