|
Until version 4.1.4: Run zasm's built-in self test. This requires that you have zasm's project directory at hand, because zasm will compile a bunch of source files and compare the output with the files present there. You can append the directory path of the project to the command, else zasm will use the current working directory. You can also append the path to the c compiler with '-c'. Assembler directives: #if, #elif, #else, #endif Pseudo instructions: if, endifIf no c compiler is given, then zasm looks for sdcc in subdirectory sdcc/bin/ or sdcc/bin-Linux32/ or sdcc in your $PATH. Assembler directives: #if, #elif, #else, #endif Pseudo instructions: if, endifIf the c compiler cannot be found, then some testcases will fail. (currently one testcase.)
$> zasm -T ./Test
Since version 4.1.5: Run all regression tests in a directory. The directory is scanned recursively. Only files which Pseudo instructions: end, .end 8080 pseudo instructions: ENDend with ".asm" and which start with a Shebang '#!' in line 1 are assembled and compared. Symbolic links, whether files or folders, are ignored.
A single regression test case consists of a proper assembler source with a shell-style first line, which was (or could have been used) to assemble this file originally, and the output file created that way.
Formerly the arguments in line 1 are not evaluated by zasm (except Assembler directives: #if, #elif, #else, #endif Pseudo instructions: if, endifif running the regression tests). They are evaluated by the shell, Assembler directives: #if, #elif, #else, #endif Pseudo instructions: if, endifif you run this file as a command. Since version 4.3.4 zasm itself also evaluates some of these options. You may use this trick and always execute your source files to save you some typing in your own projects.
$> # create test case from file test1.asm
$> # edit test1.asm and Pseudo instructions: defl, set and '=' Labels: SETset line 1 to:
#!/usr/Assembler directives: #local, #endlocal, .local and .endlocal Pseudo instructions: #local, #endlocal, .local and .endlocal Including C Source Files: #local, #endlocal, .local and .endlocallocal/zasm # without any option or
#!/usr/Assembler directives: #local, #endlocal, .local and .endlocal Pseudo instructions: #local, #endlocal, .local and .endlocal Including C Source Files: #local, #endlocal, .local and .endlocallocal/zasm --Command Line Options: --z180 Pseudo instructions: .z80, .z180 and .8080z180 -o original/ # add options and a output directory
$> cd /my/test/dir # must stay in source's dir when creating the reference file
$> chmod u+x test1.asm # make source executable
$> ./test1.asm # execute it to create the reference file
$> # later:
$> zasm -T # run all tests in the current directory or
$> zasm -T /my/test/dir # in the named directory or
$> zasm -T -v # with additional options for all test cases
zasm: +++ Regression Test +++
zasm: scanning directory for test sources ...
zasm: found 3 test source files
assemble file: /pub/Develop/Projects/zasm-4.0/Test/8080/zasm-test-opcodes-8080.asm
assembled file: zasm-test-opcodes-8080.asm
412 lines, 1 pass, 0.0037 sec.
no errors
assemble file: /pub/Develop/Projects/zasm-4.0/Test/Command Line Options: --z180 Pseudo instructions: .z80, .z180 and .8080Z180/zasm-test-opcodes-180.asm
assembled file: zasm-test-opcodes-180.asm
1999 lines, 2 passes, 0.0121 sec.
no errors
assemble file: /pub/Develop/Projects/zasm-4.0/Test/Command Line Options: --z80 Pseudo instructions: .z80, .z180 and .8080 Targets: #target Z80Z80/CPM22.asm
assembled file: CPM22.asm
3741 lines, 2 passes, 0.0171 sec.
no errors
total time: 0.0329 sec.
zasm: no errors
$>
A regression test file must successfully assemble and produce an output file.
Line 1 is parsed by zasm when running the regression test. Therefore no sophisticated Bash tricks should be used here.
Assembler directives: #if, #elif, #else, #endif Pseudo instructions: if, endifIf no output directory is specified in line 1, then the source file's directory is used. The directory path may be a partial path. Then the regression test uses the source file's directory as the starting point. Therefore you should cd into the source directory before running the source to create the reference file, to make sure that the regression test can find it.
There are two unusual instructions which are specially useful in these tests, though they may be used in any source:
Check an assumption:
Assembler directives: #assert Pseudo instructions: #assert#ASSERT my_boolean_value
Use '!' in column 1 to check that a source line fails:
! sub de,bc
| |