Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 924958 - dev-util/cpputest-4.0 fails tests (hang) with clang
Summary: dev-util/cpputest-4.0 fails tests (hang) with clang
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: No maintainer - Look at https://wiki.gentoo.org/wiki/Project:Proxy_Maintainers if you want to take care of it
URL:
Whiteboard:
Keywords: PullRequest, TESTFAILURE
Depends on:
Blocks: 915000
  Show dependency tree
 
Reported: 2024-02-19 08:05 UTC by Agostino Sarubbo
Modified: 2025-01-14 07:02 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log (build.log,150.64 KB, text/plain)
2024-02-19 08:05 UTC, Agostino Sarubbo
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Agostino Sarubbo gentoo-dev 2024-02-19 08:05:56 UTC
https://blogs.gentoo.org/ago/2020/07/04/gentoo-tinderbox/

Issue: dev-util/cpputest-4.0 fails tests (hang).
Discovered on: amd64 (internal ref: clang-lld_tinderbox)
System: CLANG-LLD (https://wiki.gentoo.org/wiki/Project:Tinderbox/Common_Issues_Helper#CLANG-LLD)

Info about the issue:
https://wiki.gentoo.org/wiki/Project:Tinderbox/Common_Issues_Helper#CF0016
Comment 1 Agostino Sarubbo gentoo-dev 2024-02-19 08:05:57 UTC
Created attachment 885392 [details]
build.log

build log and emerge --info
Comment 2 Zhixu Liu 2025-01-13 07:02:51 UTC
it seems this bug related with optimizations,
1. if build w/ CXXFLAGS="-O0", test finished
2. if apply following patch, test finished

diff --git a/src/CppUTest/Utest.cpp b/src/CppUTest/Utest.cpp
index d078bdf..2a741a6 100644
--- a/src/CppUTest/Utest.cpp
+++ b/src/CppUTest/Utest.cpp
@@ -172,6 +172,7 @@ void UtestShell::resetCrashMethod()
 void UtestShell::crash()
 {
     pleaseCrashMeRightNow();
+    printf("\n-- after %s:%d %p %p\n", __FILE__, __LINE__, NULLPTR, pleaseCrashMeRightNow);
 }

 void UtestShell::runOneTest(TestPlugin* plugin, TestResult& result)
Comment 3 Zhixu Liu 2025-01-13 07:35:35 UTC
asm code not worked:

00000000000c3db0 <_ZN10UtestShell5crashEv>:
   c3db0:       f3 0f 1e fa             endbr64
   c3db4:       ff 25 4e 13 0e 00       jmp    *0xe134e(%rip)        # 1a5108 <_ZL21pleaseCrashMeRightNow>
   c3dba:       66 0f 1f 44 00 00       nopw   0x0(%rax,%rax,1)


asm code worked (with patch):

00000000000c3dd0 <_ZN10UtestShell5crashEv>:
   c3dd0:       f3 0f 1e fa             endbr64
   c3dd4:       50                      push   %rax
   c3dd5:       ff 15 2d 13 0e 00       call   *0xe132d(%rip)        # 1a5108 <_ZL21pleaseCrashMeRightNow>
   c3ddb:       4c 8b 0d 26 13 0e 00    mov    0xe1326(%rip),%r9        # 1a5108 <_ZL21pleaseCrashMeRightNow>
   c3de2:       48 8d 15 cc 5e 01 00    lea    0x15ecc(%rip),%rdx        # d9cb5 <_IO_stdin_used+0x10cb5>
   c3de9:       b9 af 00 00 00          mov    $0xaf,%ecx
   c3dee:       45 31 c0                xor    %r8d,%r8d
   c3df1:       31 c0                   xor    %eax,%eax
   c3df3:       41 5b                   pop    %r11
   c3df5:       eb 09                   jmp    c3e00 <_ZL6printfPKcU25pass_dynamic_object_size1z>
   c3df7:       66 0f 1f 84 00 00 00    nopw   0x0(%rax,%rax,1)
   c3dfe:       00 00

# c++filt _ZN10UtestShell5crashEv
UtestShell::crash()
Comment 4 Larry the Git Cow gentoo-dev 2025-01-14 07:02:58 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=08bcbb8fa872ebfe830f17b8c89bdbaa01d1bc21

commit 08bcbb8fa872ebfe830f17b8c89bdbaa01d1bc21
Author:     Z. Liu <zhixu.liu@gmail.com>
AuthorDate: 2025-01-12 15:37:00 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2025-01-14 07:01:50 +0000

    dev-util/cpputest: fix configure & test
    
    1. fix unexpected errors during configuration, patch submitted to upstream at
       https://github.com/cpputest/cpputest/pull/1837
    2. adopt patch from https://github.com/cpputest/cpputest/pull/1679, fix
       tests hangs w/ clang
    
    Closes: https://bugs.gentoo.org/879681
    Closes: https://bugs.gentoo.org/924958
    Signed-off-by: Z. Liu <zhixu.liu@gmail.com>
    Closes: https://github.com/gentoo/gentoo/pull/40105
    Signed-off-by: Sam James <sam@gentoo.org>

 ...{cpputest-4.0.ebuild => cpputest-4.0-r1.ebuild} |  9 ++++-
 .../cpputest/files/cpputest-4.0-autoconf.patch     | 46 ++++++++++++++++++++++
 .../files/cpputest-4.0-replace-UB-by-abort.patch   | 33 ++++++++++++++++
 dev-util/cpputest/metadata.xml                     |  9 ++++-
 4 files changed, 94 insertions(+), 3 deletions(-)