more filechecks?
This commit is contained in:
parent
2f6073b4df
commit
1ea5bb2edc
@ -129,6 +129,13 @@ unlimited_regs: Allow an unlimited number of registers""",
|
||||
action="store_true",
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
"--ignore-exit-code",
|
||||
help="Ignore exit code of the program and always return 0 if the program ran to completion.",
|
||||
action="store_true",
|
||||
default=False
|
||||
)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
# create a RunConfig from the cli args
|
||||
@ -170,7 +177,7 @@ unlimited_regs: Allow an unlimited number of registers""",
|
||||
|
||||
# launch the last loaded program
|
||||
cpu.launch(cpu.mmu.programs[-1], verbose=cfg.verbosity > 1)
|
||||
sys.exit(cpu.exit_code)
|
||||
sys.exit(cpu.exit_code if not args.ignore_exit_code else 0)
|
||||
|
||||
except RiscemuBaseException as e:
|
||||
print("Error: {}".format(e.message()))
|
||||
|
@ -1 +1,2 @@
|
||||
8.836818e-02 hello-world.asm
|
||||
8.096814e-02 hello-world.asm
|
||||
9.465098e-02 fibs.asm
|
||||
|
23
test/filecheck/fibs.asm
Normal file
23
test/filecheck/fibs.asm
Normal file
@ -0,0 +1,23 @@
|
||||
// RUN: python3 -m riscemu -v --ignore-exit-code %s || true | filecheck %s
|
||||
.data
|
||||
fibs: .space 1024
|
||||
|
||||
.text
|
||||
main:
|
||||
addi s1, zero, 0 // storage index
|
||||
addi s2, zero, 1024 // last storage index
|
||||
addi t0, zero, 1 // t0 = F_{i}
|
||||
addi t1, zero, 1 // t1 = F_{i+1}
|
||||
loop:
|
||||
sw t0, fibs(s1) // save
|
||||
add t2, t1, t0 // t2 = F_{i+2}
|
||||
addi t0, t1, 0 // t0 = t1
|
||||
addi t1, t2, 0 // t1 = t2
|
||||
addi s1, s1, 4 // increment storage pointer
|
||||
blt s1, s2, loop // loop as long as we did not reach array length
|
||||
// exit gracefully
|
||||
add a0, zero, t2
|
||||
addi a7, zero, 93
|
||||
scall // exit with code 0
|
||||
|
||||
// CHECK: [CPU] Program exited with code 1265227608
|
Loading…
Reference in New Issue
Block a user