Skip to content

sim_trim_path_from_arch

Tsukasa OI edited this page Oct 24, 2022 · 10 revisions

sim/testsuite: Trim extra path from arch

Issue Solved

When I tried to run make check-sim on RISC-V (to test that I fixed a simulator bug on Zmmul PATCH v2, I noticed that make check-sim is somehow blocked.

This is an excerpt from sim/testsuite/riscv/allinsn/testrun.log after I run make check-sim for riscv64-unknown-elf Binutils.

Running /path/to/binutils/sim/testsuite/./riscv/allinsn.exp ...
Can't find a compatible assembler
Executing on host: false /path/to/binutils/sim/testsuite/lib/compilercheck.c     -E -o testsuite/./riscv/allinsn/compilercheck.x    (timeout = 300)
spawn -ignore SIGHUP false /path/to/binutils/sim/testsuite/lib/compilercheck.c -E -o testsuite/./riscv/allinsn/compilercheck.x^M
compiler exited with status 1
Can't find a compatible C compiler
Testing pass.s on machine riscv.
UNTESTED: ./riscv/pass.s
testcase /path/to/binutils/sim/testsuite/./riscv/allinsn.exp completed in 0 seconds

        ===  Summary ===

# of untested testcases     1

It should be fixed if we give CC_FOR_TARGET_RISCV variable to the configure script but it turns out that it doesn't work.

I searched for a cause and I found that arch variable (the return value of sim_arch function) has a problem. On the RISC-V simulator testsuite, arch is supposed to be riscv but it was ./riscv. Clearly, sim_arch has failed to trim extra path components.

Also, it is found that it only occurs on parallel testing (found after a CNR report by Andrew Burgess). For instance, make -C sim check-DEJAGNU-parallel can force parallel testing.

This commit fixes that by extra file tail call.

After this, sim/testsuite/riscv/allinsn/testrun.log looks like this:

Running /src/binutils/sim/testsuite/./riscv/allinsn.exp ...
Found a compatible assembler
Executing on host: riscv64-unknown-elf-gcc /path/to/binutils/sim/testsuite/lib/compilercheck.c     -E -o testsuite/./riscv/allinsn/compilercheck.x    (timeout = 300)
spawn -ignore SIGHUP riscv64-unknown-elf-gcc /path/to/binutils/sim/testsuite/lib/compilercheck.c -E -o testsuite/./riscv/allinsn/compilercheck.x^M
Executing on host: riscv64-unknown-elf-gcc /path/to/binutils/sim/testsuite/lib/newlibcheck.c       -lm  -o testsuite/./riscv/allinsn/compilercheck.x    (timeout = 300)
spawn -ignore SIGHUP riscv64-unknown-elf-gcc /path/to/binutils/sim/testsuite/lib/newlibcheck.c -lm -o testsuite/./riscv/allinsn/compilercheck.x^M
Found newlib C compiler
Testing pass.s on machine riscv.
Executing on host: /path/to/binutils-build/./gas/as-new /path/to/binutils/sim/testsuite/./riscv/pass.s  -I/path/to/binutils/sim/testsuite/./riscv  -o testsuite/./riscv/allinsn/pass.s.o    (timeout = 300)
spawn -ignore SIGHUP /path/to/binutils-build/./gas/as-new /path/to/binutils/sim/testsuite/./riscv/pass.s -I/path/to/binutils/sim/testsuite/./riscv -o testsuite/./riscv/allinsn/pass.s.o^M
Executing on host: /path/to/binutils-build/./ld/ld-new testsuite/./riscv/allinsn/pass.s.o   -o testsuite/./riscv/allinsn/pass.s.x    (timeout = 300)
spawn -ignore SIGHUP /path/to/binutils-build/./ld/ld-new testsuite/./riscv/allinsn/pass.s.o -o testsuite/./riscv/allinsn/pass.s.x^M
./riscv/run    testsuite/./riscv/allinsn/pass.s.x
spawn ./riscv/run testsuite/./riscv/allinsn/pass.s.x^M
pass^M
PASS: riscv pass.s
testcase /path/to/binutils/sim/testsuite/./riscv/allinsn.exp completed in 0 seconds

        ===  Summary ===

# of expected passes        1
Clone this wiki locally