Skip to content

Commit

Permalink
test: fix DebugSymbolsTest.ReqWrapList on PPC64LE
Browse files Browse the repository at this point in the history
Currently, DebugSymbolsTest.ReqWrapList fails on PPC64LE when Node has
been configured with Link Time Optimization (LTO) and using RHEL 8.5
and gcc:
```console
$ . /opt/rh/gcc-toolset-11/enable
$ export CC='ccache gcc'
$ export CXX='ccache g++'
$ ./configure --enable-lto
$ make -j8 cctest
...
21:52:27 [ RUN      ] DebugSymbolsTest.ReqWrapList
21:52:27 ../test/cctest/test_node_postmortem_metadata.cc:203: Failure
21:52:27 Expected equality of these values:
21:52:27   expected
21:52:27     Which is: 140736537072320
21:52:27   calculated
21:52:27     Which is: 1099680328560
21:52:27 [  FAILED  ] DebugSymbolsTest.ReqWrapList (43 ms)
```

After looking into this is seems that the compiler is tampering with the
`last` variable when compiling with LTO enabled. This commit suggests
adding volatile to this variable to prevent the compiler from tampering
with it.

PR-URL: #44341
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
  • Loading branch information
danbev authored and RafaelGSS committed Sep 26, 2022
1 parent eb25fe7 commit 20e04c6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion test/cctest/test_node_postmortem_metadata.cc
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,8 @@ TEST_F(DebugSymbolsTest, ReqWrapList) {
// ARM64 CI machinies.
for (auto it : *(*env)->req_wrap_queue()) (void) &it;

auto last = tail + nodedbg_offset_ListNode_ReqWrap__next___uintptr_t;
volatile uintptr_t last =
tail + nodedbg_offset_ListNode_ReqWrap__next___uintptr_t;
last = *reinterpret_cast<uintptr_t*>(last);

auto expected = reinterpret_cast<uintptr_t>(&obj);
Expand Down

0 comments on commit 20e04c6

Please sign in to comment.