Tests fail in LTO-enabled builds in Ubuntu/Debian
Summary
Enabling LTO with -flto=auto -ffat-lto-objects
makes a few tests fail
Steps to reproduce
(on Ubuntu 22.04)
$ ulimit -c unlimited
$ env CFLAGS="-flto=auto -ffat-lto-objects" CXXFLAGS="-flto=auto -ffat-lto-objects" LDFLAGS="-flto=auto -ffat-lto-objects" cmake .
$ make -j4 all test-programs test
...
38/38 Test #38: suite_wslua ......................... Passed 11.91 sec
95% tests passed, 2 tests failed out of 38
Total Test time (real) = 228.08 sec
The following tests FAILED:
1 - suite_capture (Failed)
37 - suite_unittests (Failed)
Errors while running CTest
...
$ gdb /home/rbalint/projects/deb/wireshark.git/run/wmem_test core.378458
GNU gdb (Ubuntu 12.0.90-0ubuntu1) 12.0.90
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /home/rbalint/projects/deb/wireshark.git/run/wmem_test...
[New LWP 378458]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `/home/rbalint/projects/deb/wireshark.git/run/wmem_test --verbose'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x000055be51a8e056 in wmem_tree_foreach_nodes (node=0x1a1a1a1a1a1a1a1a,
callback=callback@entry=0x55be51a8d840 <count_nodes>, user_data=user_data@entry=0x7ffe46cde44c)
at /home/rbalint/projects/deb/wireshark.git/wsutil/wmem/wmem_tree.c:725
725 if (node->left) {
(gdb) bt full
#0 0x000055be51a8e056 in wmem_tree_foreach_nodes (node=0x1a1a1a1a1a1a1a1a,
callback=callback@entry=0x55be51a8d840 <count_nodes>, user_data=user_data@entry=0x7ffe46cde44c)
at /home/rbalint/projects/deb/wireshark.git/wsutil/wmem/wmem_tree.c:725
stop_traverse = 0
#1 0x000055be51a8e064 in wmem_tree_foreach_nodes (node=node@entry=0x55be5306cb40,
callback=callback@entry=0x55be51a8d840 <count_nodes>, user_data=user_data@entry=0x7ffe46cde44c)
at /home/rbalint/projects/deb/wireshark.git/wsutil/wmem/wmem_tree.c:726
stop_traverse = 0
#2 0x000055be51a98220 in wmem_tree_foreach (user_data=0x7ffe46cde44c, callback=0x55be51a8d840 <count_nodes>,
tree=0x55be52d34090) at /home/rbalint/projects/deb/wireshark.git/wsutil/wmem/wmem_tree.c:759
No locals.
#3 wmem_tree_count (tree=0x55be52d34090) at /home/rbalint/projects/deb/wireshark.git/wsutil/wmem/wmem_tree.c:317
count = 0
count = <optimized out>
...
$ cat /home/rbalint/projects/deb/wireshark.git/Testing/Temporary/LastTest.log
...
Capture from a fifo using Wireshark ... FAIL
test_wireshark_capture_from_stdin (suite_capture.case_wireshark_capture)
Capture from stdin using Wireshark ... FAIL
test_wireshark_capture_snapshot_len (suite_capture.case_wireshark_capture)
Capture truncated packets using Wireshark ... skipped 'Test requires capture privileges.'
======================================================================
FAIL: test_wireshark_capture_from_fifo (suite_capture.case_wireshark_capture)
Capture from a fifo using Wireshark
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/rbalint/projects/deb/wireshark.git/test/fixtures.py", line 54, in wrapped
test_fn(self, *fixtures)
File "/home/rbalint/projects/deb/wireshark.git/test/suite_capture.py", line 491, in test_wireshark_capture_from_fifo
check_capture_fifo(self, cmd=wireshark_k)
File "/home/rbalint/projects/deb/wireshark.git/test/suite_capture.py", line 143, in check_capture_fifo_real
capture_proc = self.assertRun(capture_command(cmd,
File "/home/rbalint/projects/deb/wireshark.git/test/subprocesstest.py", line 304, in assertRun
self.assertEqual(process.returncode, expected_return)
AssertionError: -11 != 0
======================================================================
FAIL: test_wireshark_capture_from_stdin (suite_capture.case_wireshark_capture)
Capture from stdin using Wireshark
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/rbalint/projects/deb/wireshark.git/test/fixtures.py", line 54, in wrapped
test_fn(self, *fixtures)
File "/home/rbalint/projects/deb/wireshark.git/test/suite_capture.py", line 496, in test_wireshark_capture_from_stdin
check_capture_stdin(self, cmd=wireshark_k)
File "/home/rbalint/projects/deb/wireshark.git/test/suite_capture.py", line 172, in check_capture_stdin_real
pipe_proc = self.assertRun(slow_dhcp_cmd + ' | ' + capture_cmd, shell=True)
File "/home/rbalint/projects/deb/wireshark.git/test/subprocesstest.py", line 304, in assertRun
self.assertEqual(process.returncode, expected_return)
AssertionError: 139 != 0
----------------------------------------------------------------------
Ran 22 tests in 10.762s
What is the current bug behavior?
Some tests fail with SIGSEGV
.
What is the expected correct behavior?
Tests passing
Originally reported as https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1015706 .
I suspect LTO made a preexisting problem surface.
Edited by Balint Reczey