Bug 433473 - FreeBSD support, part 5
Summary: FreeBSD support, part 5
Status: RESOLVED FIXED
Alias: None
Product: valgrind
Classification: Developer tools
Component: drd (show other bugs)
Version: unspecified
Platform: Other FreeBSD
: NOR normal
Target Milestone: ---
Assignee: Bart Van Assche
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-02-23 09:24 UTC by Paul Floyd
Modified: 2021-10-07 19:35 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
DRD tests changes (51.80 KB, patch)
2021-02-23 09:24 UTC, Paul Floyd
Details
diffs in DRD/tests (50.33 KB, patch)
2021-09-23 19:23 UTC, Paul Floyd
Details
freebsd5 patch (53.26 KB, text/plain)
2021-09-26 21:57 UTC, Mark Wielaard
Details
freebsd5 (55.29 KB, text/plain)
2021-09-30 16:25 UTC, Mark Wielaard
Details
drd and helgrind tests (123.53 KB, patch)
2021-10-05 20:49 UTC, Paul Floyd
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Floyd 2021-02-23 09:24:37 UTC
Created attachment 136077 [details]
DRD tests changes

Changes in the DRD tests directory. Here are the main things.

Makefile.am
New expecteds. I cleaned up the C++ tests that work OK with clang.
Made libdl (which does not exist on FreeBSD conditional)
Added a FreeBSD version of thread_name. In general this seems to be going a bit against the DRD philosophy of not having platform specific tests.

Soumc C files wouldn't compile (missing headers).

There is a FreeBSD defect related to the use of
    pthread_attr_setstacksize(&attr, PTHREAD_STACK_MIN + 4096);
In all cases these have been made conditional

bar_bad* needs an expexted, like Solaris

circular_buffer was generating errors due to the global seed. So I moved the call to rand into main and added the time to a new struct.

concurrent_close - increased the stack depth because FreeBSD start function is in libc which increases the stack depth.

filters - make sure GNU sed is used. Need to make this a configure time selection. Added some FreeBSD specific filters.

pth_detached3 - need to see if this can be made a bit more portable without the #ifdef; required header change

std_list - added a guard to setlocale otherwise there were tons of hazards

swapcontext -WIP

There are a few new expecteds and modified expected where I need to change the C files and hence the line numbers.
Comment 1 Paul Floyd 2021-09-23 19:23:17 UTC
Created attachment 141836 [details]
diffs in DRD/tests
Comment 2 Mark Wielaard 2021-09-26 19:28:33 UTC
I haven't reviewed the new/changed tests themselves.

But this is where you would introduce the new configure.ac CONFIG files for:

drd/tests/filter_error_count.in
drd/tests/filter_error_summary.in
drd/tests/filter_stderr.in
drd/tests/filter_stderr_and_thread_no_and_offset.in
drd/tests/filter_thread_no.in
drd/tests/filter_xml_and_thread_no.in

I would also add them with their full names in .gitignore. Using filter_* is too broad IMHO.

Are you sure that the cleanup: rm -f vgcore.* in the .vgtest files is a good idea? Do these tests deliberately dump core? If not I would keep the vgcore files to investigate afterwards.

I assume the drd/tests/tc09_bad_unlock.stderr.exp-glibc2.8 and drd/tests/tc23_bogus_condwait.stderr.exp-linux-x86 changes were because of the line number shifts in the corresponding test files?
Comment 3 Paul Floyd 2021-09-26 19:45:56 UTC
I've added the full filter_ names to .gitignore.

As a rule, if the guest application dumps core when running standalone then it will also dump core when running under Valgrind. Since a lot of the regression tests are deliberately performing undefined behaviour, some of them do dump core. If I remmember rightly, these ones do not core dump on Linux but they do on FreeBSD.

I've had to change several test .c files. In the tc23 case, there is a header missing on FreeBSD and a copuple of the UB tests caused a hang, so I made them conditional.
Comment 4 Mark Wielaard 2021-09-26 20:21:45 UTC
This addition makes things compile:

diff --git a/.gitignore b/.gitignore
index 4f1a341cc..ca91c6b90 100644
--- a/.gitignore
+++ b/.gitignore
@@ -342,6 +342,12 @@
 /drd/tests/*.stderr.out
 /drd/tests/*.stdout.diff*
 /drd/tests/*.stdout.out
+/drd/tests/filter_error_count
+/drd/tests/filter_error_summary
+/drd/tests/filter_stderr_and_thread_no_and_offset
+/drd/tests/filter_stderr
+/drd/tests/filter_thread_no
+/drd/tests/filter_xml_and_thread_no
 /drd/tests/.deps
 /drd/tests/annotate_barrier
 /drd/tests/annotate_hb_err
diff --git a/configure.ac b/configure.ac
index 874287863..dee9b8911 100755
--- a/configure.ac
+++ b/configure.ac
@@ -5195,6 +5195,20 @@ AC_CONFIG_FILES([coregrind/link_tool_exe_darwin],
                 [chmod +x coregrind/link_tool_exe_darwin])
 AC_CONFIG_FILES([coregrind/link_tool_exe_solaris],
                 [chmod +x coregrind/link_tool_exe_solaris])
+
+AC_CONFIG_FILES([drd/tests/filter_stderr],
+                [chmod +x drd/tests/filter_stderr])
+AC_CONFIG_FILES([drd/tests/filter_error_count],
+                [chmod +x drd/tests/filter_error_count])
+AC_CONFIG_FILES([drd/tests/filter_error_summary],
+                [chmod +x drd/tests/filter_error_summary])
+AC_CONFIG_FILES([drd/tests/filter_stderr_and_thread_no_and_offset],
+                [chmod +x drd/tests/filter_stderr_and_thread_no_and_offset])
+AC_CONFIG_FILES([drd/tests/filter_thread_no],
+                [chmod +x drd/tests/filter_thread_no])
+AC_CONFIG_FILES([drd/tests/filter_xml_and_thread_no],
+                [chmod +x drd/tests/filter_xml_and_thread_no])
+
 AC_OUTPUT
 
 cat<<EOF

But tests/os_test freebsd cannot be used in a prereq in drd/tests/thread_name.vgtest drd/tests/thread_name_freebsd.vgtest and drd/tests/thread_name_xml.vgtest because that generates an error:
 returned 2: ../../tests/os_test freebsd

tests/is_test.c needs to be updated before this patch can be applied
Comment 5 Mark Wielaard 2021-09-26 21:57:33 UTC
Created attachment 141936 [details]
freebsd5 patch

After applying the freebsd-tests.patch from bug #433504 - FreeBSD support, part 8, before this one and adding those .gitignore and configure.ac CONFIG files this compiles on fedora x86_64. But it does introduce one failure drd/tests/tc23_bogus_condwait (stderr) because the line numbers in some backtraces don't match anymore.
Comment 6 Mark Wielaard 2021-09-30 16:25:44 UTC
Created attachment 142036 [details]
freebsd5

My original freebsd5 patch was missing some of the new filter .in files. This adds them.

I would still recommend merging this with freebsd7 patch to prevent some spurious failures for tests that changed for the helgrind tests.
Comment 7 Paul Floyd 2021-10-05 20:49:55 UTC
Created attachment 142185 [details]
drd and helgrind tests

Merged drd and helgrind tests
Comment 8 Paul Floyd 2021-10-07 19:35:27 UTC
Code committed with
commit 85bbe2853e813bbd83aa17bc17c2b73d82f6bc3e