Skip to content

Commit

Permalink
Fix nasm test [skip appveyor]
Browse files Browse the repository at this point in the history
Fix reported problem of missing header (no declaration for exit()).
Clean up to current styles.

Signed-off-by: Mats Wichmann <mats@linux.com>
  • Loading branch information
mwichmann committed Oct 6, 2024
1 parent fc36781 commit fab3191
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 27 deletions.
1 change: 1 addition & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER
cl.exe-compatible command line switches.
- Some manpage cleanup for the gettext and pdf/ps builders.
- Some clarifications in the User Guide "Environments" chapter.
- Fix nasm test for missing include file, cleanup.

From Alex James:
- On Darwin, PermissionErrors are now handled while trying to access
Expand Down
2 changes: 2 additions & 0 deletions RELEASE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ FIXES
/etc/paths.d. This may occur if SCons is invoked in a sandboxed environment
(such as Nix).

- Fix nasm test for missing include file, cleanup.

IMPROVEMENTS
------------

Expand Down
51 changes: 24 additions & 27 deletions test/AS/nasm.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/usr/bin/env python
#
# __COPYRIGHT__
# MIT License
#
# Copyright The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
Expand All @@ -20,9 +22,6 @@
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#

__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"

"""
Verify correct use of the live 'nasm' assembler.
Expand All @@ -39,7 +38,6 @@
test = TestSCons.TestSCons()

nasm = test.where_is('nasm')

if not nasm:
test.skip_test('nasm not found; skipping test\n')

Expand Down Expand Up @@ -77,32 +75,35 @@

test.file_fixture('wrapper.py')

test.write('SConstruct', """
eee = Environment(tools = ['gcc', 'gnulink', 'nasm'],
CFLAGS = ['-m32'],
LINKFLAGS = '-m32',
ASFLAGS = '-f %(nasm_format)s')
fff = eee.Clone(AS = r'%(_python_)s wrapper.py ' + WhereIs('nasm'))
eee.Program(target = 'eee', source = ['eee.asm', 'eee_main.c'])
fff.Program(target = 'fff', source = ['fff.asm', 'fff_main.c'])
""" % locals())

test.write('eee.asm',
"""
test.write('SConstruct', f"""\
_ = DefaultEnvironment(tools=[])
eee = Environment(
tools=['gcc', 'gnulink', 'nasm'],
CFLAGS=['-m32'],
LINKFLAGS='-m32',
ASFLAGS='-f {nasm_format}',
)
fff = eee.Clone(AS=r'{_python_} wrapper.py ' + WhereIs('nasm'))
eee.Program(target='eee', source=['eee.asm', 'eee_main.c'])
fff.Program(target='fff', source=['fff.asm', 'fff_main.c'])
""")

test.write('eee.asm', """\
global name
name:
db 'eee.asm',0
""")

test.write('fff.asm',
"""
test.write('fff.asm', """\
global name
name:
db 'fff.asm',0
""")

test.write('eee_main.c', r"""
#include <stdio.h>
#include <stdlib.h>
extern char name[];
int
Expand All @@ -129,20 +130,16 @@
}
""")

test.run(arguments = 'eee' + _exe, stderr = None)

test.run(program = test.workpath('eee'), stdout = "eee_main.c eee.asm\n")
test.run(arguments='eee' + _exe, stderr=None)

test.run(program=test.workpath('eee'), stdout="eee_main.c eee.asm\n")
test.must_not_exist('wrapper.out')

test.run(arguments = 'fff' + _exe)

test.run(program = test.workpath('fff'), stdout = "fff_main.c fff.asm\n")
test.run(arguments='fff' + _exe)

test.run(program=test.workpath('fff'), stdout="fff_main.c fff.asm\n")
test.must_match('wrapper.out', "wrapper.py\n")



test.pass_test()

# Local Variables:
Expand Down

0 comments on commit fab3191

Please sign in to comment.