Add cycle limit to CI emulator test
This commit is contained in:
parent
8647f77cc9
commit
ac284974d3
2 changed files with 8 additions and 2 deletions
3
Makefile
3
Makefile
|
@ -25,5 +25,6 @@ emu6502: memtest6502
|
|||
gcc -D_END=$$(cat tmp/memtest4k-f000-ascii.map | grep ^done, | cut -d, -f2 | tr -d ' ,') -o out/emu6502 src/emu6502.c src/fake6502.c
|
||||
|
||||
test: memtest6502
|
||||
gcc -DNOLIMIT -D_END=$$(cat tmp/memtest4k-f000-ascii.map | grep ^done, | cut -d, -f2 | tr -d ' ,') -o out/emu6502 src/emu6502.c src/fake6502.c
|
||||
# Run the emulator, but terminate after 10M instructions
|
||||
gcc -D_LIMIT=10000000 -D_END=$$(cat tmp/memtest4k-f000-ascii.map | grep ^done, | cut -d, -f2 | tr -d ' ,') -o out/emu6502 src/emu6502.c src/fake6502.c
|
||||
out/emu6502 | tail -30
|
||||
|
|
|
@ -84,7 +84,12 @@ int main() {
|
|||
reset6502();
|
||||
signal(SIGINT, intv);
|
||||
while (1) {
|
||||
#ifndef NOLIMIT
|
||||
#ifdef _LIMIT
|
||||
if (instructions >= _LIMIT) {
|
||||
dprintf(2, "Prematurely terminated after %d instructions (limit exceeded)", instructions);
|
||||
exit(2);
|
||||
}
|
||||
#else
|
||||
usleep(1);
|
||||
#endif
|
||||
step6502();
|
||||
|
|
Loading…
Reference in a new issue