Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ NOTE: Since SCons 4.9.0, Python 3.7.0 or above is required.

RELEASE VERSION/DATE TO BE FILLED IN LATER

From John Doe:

- Whatever John Doe did.
From John Doe:
- Whatever John Doe did.

From Bill Prendergast:
- Fixed SCons.Variables.PackageVariable to correctly test the default
Expand All @@ -23,6 +22,8 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER
when default setting is a boolean string.

From Mats Wichmann:
- Clean up C and C++ FLAGS tests. Tests which use a real compiler
are now more clearly distinguished (-live.py suffix and docstring).
- runtest.py once again finds "external" tests, such as the tests for
tools in scons-contrib. An earlier rework had broken this. Fixes #4699.

Expand Down
6 changes: 3 additions & 3 deletions RELEASE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ Past official release announcements appear at:

==================================================================

A new SCons release, 4.9.0, is now available on the SCons download page:
A new SCons release, X.Y.Z, is now available on the SCons download page:

https://scons.org/pages/download.html

Here is a summary of the changes since 4.9.1:

Here is a summary of the changes since 4.9.0:

NEW FUNCTIONALITY
-----------------
Expand Down Expand Up @@ -66,4 +66,4 @@ Thanks to the following contributors listed below for their contributions to thi
==========================================================================================
.. code-block:: text

git shortlog --no-merges -ns 4.0.1..HEAD
git shortlog --no-merges -ns 4.9.1..HEAD
61 changes: 32 additions & 29 deletions test/CC/CCFLAGS.py → test/CC/CCFLAGS-live.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,17 @@
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

"""
Test behavior of CCFLAGS.

This is a live test, uses the detected C compiler.
"""

import sys

import TestSCons

_obj = TestSCons._obj
test = TestSCons.TestSCons()

if sys.platform == 'win32':
import SCons.Tool.MSCommon as msc
Expand All @@ -41,19 +48,17 @@
fooflags = '-DFOO'
barflags = '-DBAR'

test = TestSCons.TestSCons()

test.write('SConstruct', """
test.write('SConstruct', f"""\
DefaultEnvironment(tools=[])
foo = Environment(CCFLAGS = '%s')
bar = Environment(CCFLAGS = '%s')
foo.Object(target = 'foo%s', source = 'prog.c')
bar.Object(target = 'bar%s', source = 'prog.c')
foo.Program(target = 'foo', source = 'foo%s')
bar.Program(target = 'bar', source = 'bar%s')
foo.Program(target = 'prog', source = 'prog.c',
CCFLAGS = '$CCFLAGS -DBAR $BAZ', BAZ = '-DBAZ')
""" % (fooflags, barflags, _obj, _obj, _obj, _obj))
foo = Environment(CCFLAGS='{fooflags}')
bar = Environment(CCFLAGS='{barflags}')

foo_obj = foo.Object(target='foo', source='prog.c')
bar_obj = bar.Object(target='bar', source='prog.c')
foo.Program(target='foo', source=foo_obj)
bar.Program(target='bar', source=bar_obj)
foo.Program(target='prog', source='prog.c', CCFLAGS='$CCFLAGS -DBAR $BAZ', BAZ='-DBAZ')
""")

test.write('prog.c', r"""
#include <stdio.h>
Expand All @@ -76,30 +81,28 @@
}
""")


test.run(arguments = '.')

test.run(program = test.workpath('foo'), stdout = "prog.c: FOO\n")
test.run(program = test.workpath('bar'), stdout = "prog.c: BAR\n")
test.run(program = test.workpath('prog'), stdout = """\
test.run(arguments='.')
test.run(program=test.workpath('foo'), stdout="prog.c: FOO\n")
test.run(program=test.workpath('bar'), stdout="prog.c: BAR\n")
test.run(program=test.workpath('prog'), stdout="""\
prog.c: FOO
prog.c: BAR
prog.c: BAZ
""")

test.write('SConstruct', """
test.write('SConstruct', f"""\
DefaultEnvironment(tools=[])
bar = Environment(CCFLAGS = '%s')
bar.Object(target = 'foo%s', source = 'prog.c')
bar.Object(target = 'bar%s', source = 'prog.c')
bar.Program(target = 'foo', source = 'foo%s')
bar.Program(target = 'bar', source = 'bar%s')
""" % (barflags, _obj, _obj, _obj, _obj))
bar = Environment(CCFLAGS='{barflags}')

test.run(arguments = '.')
foo_obj = bar.Object(target='foo', source='prog.c')
bar_obj = bar.Object(target='bar', source='prog.c')
bar.Program(target='foo', source=foo_obj)
bar.Program(target='bar', source=bar_obj)
""")

test.run(program = test.workpath('foo'), stdout = "prog.c: BAR\n")
test.run(program = test.workpath('bar'), stdout = "prog.c: BAR\n")
test.run(arguments='.')
test.run(program=test.workpath('foo'), stdout="prog.c: BAR\n")
test.run(program=test.workpath('bar'), stdout="prog.c: BAR\n")

test.pass_test()

Expand Down
65 changes: 34 additions & 31 deletions test/CC/CFLAGS.py → test/CC/CFLAGS-live.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,20 @@
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

"""
Test behavior of CFLAGS.

This is a live test, uses the detected C compiler.
"""

import sys

import TestSCons

test = TestSCons.TestSCons()

# Make sure CFLAGS is not passed to CXX by just expanding CXXCOM
test.write('SConstruct', """
test.write('SConstruct', """\
DefaultEnvironment(tools=[])
env = Environment(CFLAGS='-xyz', CCFLAGS='-abc')
print(env.subst('$CXXCOM'))
Expand All @@ -41,8 +48,6 @@
test.must_not_contain_any_line(test.stdout(), ["-xyz"])
test.must_contain_all_lines(test.stdout(), ["-abc"])

_obj = TestSCons._obj

# Test passing CFLAGS to C compiler by actually compiling programs
if sys.platform == 'win32':
import SCons.Tool.MSCommon as msc
Expand All @@ -57,17 +62,17 @@
fooflags = '-DFOO'
barflags = '-DBAR'


test.write('SConstruct', """
foo = Environment(CFLAGS = '%s')
bar = Environment(CFLAGS = '%s')
foo.Object(target = 'foo%s', source = 'prog.c')
bar.Object(target = 'bar%s', source = 'prog.c')
foo.Program(target = 'foo', source = 'foo%s')
bar.Program(target = 'bar', source = 'bar%s')
foo.Program(target = 'prog', source = 'prog.c',
CFLAGS = '$CFLAGS -DBAR $BAZ', BAZ = '-DBAZ')
""" % (fooflags, barflags, _obj, _obj, _obj, _obj))
test.write('SConstruct', f"""\
DefaultEnvironment(tools=[])
foo = Environment(CFLAGS="{fooflags}")
bar = Environment(CFLAGS="{barflags}")

foo_obj = foo.Object(target='foo', source='prog.c')
bar_obj = bar.Object(target='bar', source='prog.c')
foo.Program(target='foo', source=foo_obj)
bar.Program(target='bar', source=bar_obj)
foo.Program(target='prog', source='prog.c', CFLAGS='$CFLAGS -DBAR $BAZ', BAZ='-DBAZ')
""")

test.write('prog.c', r"""
#include <stdio.h>
Expand All @@ -90,30 +95,28 @@
}
""")



test.run(arguments = '.')

test.run(program = test.workpath('foo'), stdout = "prog.c: FOO\n")
test.run(program = test.workpath('bar'), stdout = "prog.c: BAR\n")
test.run(program = test.workpath('prog'), stdout = """\
test.run(arguments='.')
test.run(program=test.workpath('foo'), stdout="prog.c: FOO\n")
test.run(program=test.workpath('bar'), stdout="prog.c: BAR\n")
test.run(program=test.workpath('prog'), stdout="""\
prog.c: FOO
prog.c: BAR
prog.c: BAZ
""")

test.write('SConstruct', """
bar = Environment(CFLAGS = '%s')
bar.Object(target = 'foo%s', source = 'prog.c')
bar.Object(target = 'bar%s', source = 'prog.c')
bar.Program(target = 'foo', source = 'foo%s')
bar.Program(target = 'bar', source = 'bar%s')
""" % (barflags, _obj, _obj, _obj, _obj))
test.write('SConstruct', f"""\
DefaultEnvironment(tools=[])
bar = Environment(CFLAGS='{barflags}')

test.run(arguments = '.')
foo_obj = bar.Object(target='foo', source='prog.c')
bar_obj = bar.Object(target='bar', source='prog.c')
bar.Program(target='foo', source=foo_obj)
bar.Program(target='bar', source=bar_obj)
""")

test.run(program = test.workpath('foo'), stdout = "prog.c: BAR\n")
test.run(program = test.workpath('bar'), stdout = "prog.c: BAR\n")
test.run(arguments='.')
test.run(program=test.workpath('foo'), stdout="prog.c: BAR\n")
test.run(program=test.workpath('bar'), stdout="prog.c: BAR\n")

test.pass_test()

Expand Down
58 changes: 32 additions & 26 deletions test/CC/SHCCFLAGS.py → test/CC/SHCCFLAGS-live.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,17 @@
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

"""
Verify that $SHCCFLAGS settings are used to build shared object files.

This is a live test, uses the detected C compiler.
"""

import os
import sys

import TestSCons
import os


test = TestSCons.TestSCons()

e = test.Environment()
Expand All @@ -38,16 +45,16 @@
if sys.platform.find('irix') > -1:
os.environ['LD_LIBRARYN32_PATH'] = '.'

test.write('SConstruct', """
test.write('SConstruct', f"""\
DefaultEnvironment(tools=[])
foo = Environment(SHCCFLAGS = '%s', WINDOWS_INSERT_DEF=1)
bar = Environment(SHCCFLAGS = '%s', WINDOWS_INSERT_DEF=1)
foo = Environment(SHCCFLAGS='{fooflags}', WINDOWS_INSERT_DEF=1)
bar = Environment(SHCCFLAGS='{barflags}', WINDOWS_INSERT_DEF=1)

foo_obj = foo.SharedObject(target = 'foo', source = 'prog.c')
foo.SharedLibrary(target = 'foo', source = foo_obj)
foo_obj = foo.SharedObject(target='foo', source='prog.c')
foo.SharedLibrary(target='foo', source=foo_obj)

bar_obj = bar.SharedObject(target = 'bar', source = 'prog.c')
bar.SharedLibrary(target = 'bar', source = bar_obj)
bar_obj = bar.SharedObject(target='bar', source='prog.c')
bar.SharedLibrary(target='bar', source=bar_obj)

fooMain = foo.Clone(LIBS='foo', LIBPATH='.')
foomain_obj = fooMain.Object(target='foomain', source='main.c')
Expand All @@ -56,7 +63,7 @@
barMain = bar.Clone(LIBS='bar', LIBPATH='.')
barmain_obj = barMain.Object(target='barmain', source='main.c')
barMain.Program(target='barprog', source=barmain_obj)
""" % (fooflags, barflags))
""")

test.write('foo.def', r"""
LIBRARY "foo"
Expand Down Expand Up @@ -89,7 +96,7 @@
}
""")

test.write('main.c', r"""
test.write('main.c', """\

void doIt();

Expand All @@ -101,31 +108,30 @@
}
""")

test.run(arguments = '.')

test.run(program = test.workpath('fooprog'), stdout = "prog.c: FOO\n")
test.run(program = test.workpath('barprog'), stdout = "prog.c: BAR\n")
test.run(arguments='.')
test.run(program=test.workpath('fooprog'), stdout="prog.c: FOO\n")
test.run(program=test.workpath('barprog'), stdout="prog.c: BAR\n")

test.write('SConstruct', """
bar = Environment(SHCCFLAGS = '%s', WINDOWS_INSERT_DEF=1)
test.write('SConstruct', f"""\
DefaultEnvironment(tools=[])
bar = Environment(SHCCFLAGS='{barflags}', WINDOWS_INSERT_DEF=1)

foo_obj = bar.SharedObject(target = 'foo', source = 'prog.c')
bar.SharedLibrary(target = 'foo', source = foo_obj)
foo_obj = bar.SharedObject(target='foo', source='prog.c')
bar.SharedLibrary(target='foo', source=foo_obj)

bar_obj = bar.SharedObject(target = 'bar', source = 'prog.c')
bar.SharedLibrary(target = 'bar', source = bar_obj)
bar_obj = bar.SharedObject(target='bar', source='prog.c')
bar.SharedLibrary(target='bar', source=bar_obj)

barMain = bar.Clone(LIBS='bar', LIBPATH='.')
foomain_obj = barMain.Object(target='foomain', source='main.c')
barmain_obj = barMain.Object(target='barmain', source='main.c')
barMain.Program(target='barprog', source=foomain_obj)
barMain.Program(target='fooprog', source=barmain_obj)
""" % barflags)

test.run(arguments = '.')
""")

test.run(program = test.workpath('fooprog'), stdout = "prog.c: BAR\n")
test.run(program = test.workpath('barprog'), stdout = "prog.c: BAR\n")
test.run(arguments='.')
test.run(program=test.workpath('fooprog'), stdout="prog.c: BAR\n")
test.run(program=test.workpath('barprog'), stdout="prog.c: BAR\n")

test.pass_test()

Expand Down
Loading
Loading