From e55d73304102145c46c32f25dbe103cd4c750d37 Mon Sep 17 00:00:00 2001 From: David Steele Date: Mon, 17 Sep 2018 11:38:10 -0400 Subject: [PATCH] Add -ftree-coalesce-vars option to unit test compilation. This is a workaround for inefficient handling of many setjmps in gcc >= 4.9. Setjmp is used in all error handling, but in the unit tests each test macro contains an error handling block so they add up pretty quickly for large unit tests. Enabling -ftree-coalesce-vars in affected versions reduces build time and memory requirements by nearly an order of magnitude. Even so, compiles are much slower than gcc <= 4.8. We submitted a bug for this at: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87316 Which was marked as a duplicate of: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63155 --- doc/xml/release.xml | 4 ++++ test/lib/pgBackRestTest/Common/JobTest.pm | 1 + 2 files changed, 5 insertions(+) diff --git a/doc/xml/release.xml b/doc/xml/release.xml index 12091e3d5..653cebede 100644 --- a/doc/xml/release.xml +++ b/doc/xml/release.xml @@ -121,6 +121,10 @@

Make Valgrind return an error even when a non-fatal issue is detected. Update some minor issues discovered in the tests as a result.

+ +

Add -ftree-coalesce-vars option to unit test compilation.

+
+

Clear test directory between test runs.

diff --git a/test/lib/pgBackRestTest/Common/JobTest.pm b/test/lib/pgBackRestTest/Common/JobTest.pm index 302bcd8c8..80e897fdb 100644 --- a/test/lib/pgBackRestTest/Common/JobTest.pm +++ b/test/lib/pgBackRestTest/Common/JobTest.pm @@ -400,6 +400,7 @@ sub run "\n" . "test.o: test.c\n" . "\t\$(CC) \$(CFLAGS) \$(TESTFLAGS) -O0" . + ($self->{oTest}->{&TEST_VM} ne VM_U12 ? ' -ftree-coalesce-vars' : '') . (vmCoverageC($self->{oTest}->{&TEST_VM}) && $self->{bCoverageUnit} ? ' -fprofile-arcs -ftest-coverage' : '') . " -c test.c\n" .