From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 825D43858CDB; Thu, 22 Sep 2022 04:44:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 825D43858CDB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1663821886; bh=XOSrn7NYqUQLHdIk4eYLxCnlJ23mm3uMCQD4WK/N8i0=; h=From:To:Subject:Date:From; b=hCd5dbULPh04CgSWeoP0DZX/GdFhl3kuCvELfUxJlIuLKYYDACbCHOIYRf/YBmFdW lfa404LQSE2cp/M/tbPywqwf4C8iVsI9eN2Y4EoMUZ7m3TYYans/vFMl3+VJltLnK+ I93eGObWxipuotEkIXTNiFAslgqDCTCDXN91GQxQ= From: "research_trasio at irq dot a4lg.com" To: gdb-prs@sourceware.org Subject: [Bug sim/29596] New: "make check-sim" is broken (unexpectedly passes without actually testing) Date: Thu, 22 Sep 2022 04:44:46 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: sim X-Bugzilla-Version: HEAD X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: research_trasio at irq dot a4lg.com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter cc target_milestone attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D29596 Bug ID: 29596 Summary: "make check-sim" is broken (unexpectedly passes without actually testing) Product: gdb Version: HEAD Status: UNCONFIRMED Severity: normal Priority: P2 Component: sim Assignee: unassigned at sourceware dot org Reporter: research_trasio at irq dot a4lg.com CC: vapier at gentoo dot org Target Milestone: --- Created attachment 14344 --> https://sourceware.org/bugzilla/attachment.cgi?id=3D14344&action=3Ded= it testrun.1.log: AArch64 "make check-sim" log before the patch While I'm testing whether PR29595 is fixed, I found another bug. "make check-sim" doesn't work because it cannot detect a suitable assembler/compi= ler. This is what I'm repeatedly pinging but there's no response. At least, it's worth it to track here. Patch: (= ping 2) (= ping 3) I first reproduced this on riscv64-unknown-elf but talking with aarch64-unknown-elf will be better since AArch64 has decent number of tests= (in contrast to 1 from RISC-V). [How to reproduce] 1. Configure Binutils with aarch64-unknown-elf and build it /src/binutils/configure --target=3Daarch64-unknown-elf && make 2. Run `make check-sim' and confirmed that the simulator tests "pass" 3. Intentionally try to fail the test by modifying `sim/testsuite/aarch64/pass.s' (replace the last line from "pass" to "fail") 4. Run `make check-sim' and "confirmed" that the simulator tests "pass" (it should fail!) [Analysis] ... Yes, something is going wrong. After the test, you can see the test log in `sim/testsuite/aarch64/allinsn/testrun.log' (example: attached testrun.1.lo= g). We clearly find that the test runner didn't find recently built assembler (gas/as-new). That assembler (and the linker) is supposed to be used because the simulator itself (sim/Makefile) sets its configuration (see attached site.exp, genera= ted by sim/Makefile). At last, we find `sim/testsuite/lib/sim-defs.exp'. In the `sim_init_toolchain' function, it extracts {AS,LD,CC}_FOR_TARGET_AAR= CH64 and sets proper {AS,LD,CC}_FOR_TARGET. At least, it is supposed to do so. However, this block doesn't work because the `arch' variable returned by the `sim_arch' function is "./aarch64". That is supposed to be "aarch64". [Fix: Cause and Patch Details] `sim_arch' function is simple. Until the dirname part of the "arch" is not "." (current directory), it trims the filename part. For instance, if subdir is "A/B/C/D", this function returns "A". However, if subdir is "./A/B/C/D", this function returns "./A", not "A". In fact, actual subdir value here is "./aarch64" and we will get "./aarch64" for [sim_arch]. As a result, it fails to extract proper assembler/linker/compiler for given target. To deal with it, I added another "file tail" function call before returning. After this patch, `sim/testsuite/aarch64/allinsn/testrun.log' will look like attached testrun.2.log. We can confirm that the assembler is detected and "expectedly" fail (becaus= e we intentionally broke a testcase). Of course, fixing a testcase will make a success (see attached testrun.3.lo= g). [My status] I completed copyright assignment of GDB to FSF in August 2022 and I'm now e= ven a "write after approval" committer. If a maintainer gives me an approval, I can commit it in a day. --=20 You are receiving this mail because: You are on the CC list for the bug.=