From owner-dev-commits-src-branches@freebsd.org Thu May 27 18:46:09 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D4C6C642746; Thu, 27 May 2021 18:46:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FrcGT5TWDz4ggR; Thu, 27 May 2021 18:46:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A44071289; Thu, 27 May 2021 18:46:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14RIk94Q024971; Thu, 27 May 2021 18:46:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14RIk9BT024970; Thu, 27 May 2021 18:46:09 GMT (envelope-from git) Date: Thu, 27 May 2021 18:46:09 GMT Message-Id: <202105271846.14RIk9BT024970@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dimitry Andric Subject: git: ee5326013093 - stable/12 - Merge a bunch of googletest build improvements MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: ee5326013093ddf50cae165e66dda9d8ac092d97 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 May 2021 18:46:09 -0000 The branch stable/12 has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=ee5326013093ddf50cae165e66dda9d8ac092d97 commit ee5326013093ddf50cae165e66dda9d8ac092d97 Author: Dimitry Andric AuthorDate: 2021-05-27 18:45:13 +0000 Commit: Dimitry Andric CommitDate: 2021-05-27 18:45:13 +0000 Merge a bunch of googletest build improvements googletest: pick from upstream: Don't allow signed/unsigned wchar_t in gcc 9 and later Pick 711fccf8317b4fb7adc21c00fc1e20823c5d875f from upstream googletest: Don't allow signed/unsigned wchar_t in gcc 9 and later Upstream pull request: https://github.com/google/googletest/pull/2270 Sponsored by: Dell EMC Isilon (cherry picked from commit f157ca4696f5922275d5d451736005b9332eb136) Major improvement to build parallelism for googletest internal tests Currently the googletest internal tests build after the matching library. However, each of these is serialized at the top level makefile. Additionally some of the tests (e.g. the gmock-matches-test) take up to 90 seconds to build with clang -O2. Having to wait for this test to complete before continuing to the next directory seriously slows down the parllelism of a -j32 build. Before this change running `make -C lib/googletest -j32 -s` in buildenv took 202 seconds, now it's 153 due to improved parallelism. Reviewed By: emaste (no objection) Differential Revision: https://reviews.freebsd.org/D26748 (cherry picked from commit 2ed3236082a4473c1da8f72c1ebc071a7b54321f) Enable SUBDIR_PARALLEL for lib/googletest This saves a few seconds in a parallel build since we can build the gtest_main and gmock subdirectories in parallel. Reviewed By: ngie Differential Revision: https://reviews.freebsd.org/D26760 (cherry picked from commit 4fa4bd6312cbeebda23a80feb77f29691af0cd7b) Significantly reduce compile time for googletest internal tests Clang's optimizer spends a really long time on these tests at -O2, so we now use -O0 instead. This reduces the -j32 time for lib/googletest/test from 131s to 29s. Using -O0 also reduces the disk usage from 144MB (at -O2) / 92MB (at -O1) to 82MB. Reviewed By: ngie, dim Differential Revision: https://reviews.freebsd.org/D26751 (cherry picked from commit 433f33d285eee7cd6a822b9d833a537dfc808634) --- .../include/gmock/internal/gmock-internal-utils.h | 5 ++++- lib/googletest/Makefile | 8 ++++++-- lib/googletest/gmock/Makefile | 3 --- lib/googletest/gmock_main/Makefile | 3 --- lib/googletest/gtest/Makefile | 3 --- lib/googletest/gtest_main/Makefile | 3 --- lib/googletest/tests/Makefile | 6 ++++++ lib/googletest/tests/Makefile.inc | 18 ++++++++++++++++++ lib/googletest/{gmock/tests => tests/gmock}/Makefile | 0 .../{gmock_main/tests => tests/gmock_main}/Makefile | 0 lib/googletest/{gtest/tests => tests/gtest}/Makefile | 0 .../{gtest_main/tests => tests/gtest_main}/Makefile | 0 12 files changed, 34 insertions(+), 15 deletions(-) diff --git a/contrib/googletest/googlemock/include/gmock/internal/gmock-internal-utils.h b/contrib/googletest/googlemock/include/gmock/internal/gmock-internal-utils.h index db64c65cbb8a..989b804acf32 100644 --- a/contrib/googletest/googlemock/include/gmock/internal/gmock-internal-utils.h +++ b/contrib/googletest/googlemock/include/gmock/internal/gmock-internal-utils.h @@ -125,8 +125,11 @@ struct LinkedPtrLessThan { // // To gcc, // wchar_t == signed wchar_t != unsigned wchar_t == unsigned int +// +// gcc-9 appears to treat signed/unsigned wchar_t as ill-formed +// regardless of the signage of its underlying type. #ifdef __GNUC__ -#if !defined(__WCHAR_UNSIGNED__) +#if !defined(__WCHAR_UNSIGNED__) && (__GNUC__ < 9) // signed/unsigned wchar_t are valid types. # define GMOCK_HAS_SIGNED_WCHAR_T_ 1 #endif diff --git a/lib/googletest/Makefile b/lib/googletest/Makefile index b45985177f83..47d4939f2166 100644 --- a/lib/googletest/Makefile +++ b/lib/googletest/Makefile @@ -3,12 +3,16 @@ .include SUBDIR+= gtest -SUBDIR+= .WAIT SUBDIR+= gmock -SUBDIR+= .WAIT SUBDIR+= gmock_main SUBDIR+= gtest_main SUBDIR.${MK_TESTS}+= tests +SUBDIR_DEPEND_gtest_main= gtest +SUBDIR_DEPEND_gmock= gtest +SUBDIR_DEPEND_gmock_main= gmock +SUBDIR_DEPEND_tests= gmock_main +SUBDIR_PARALLEL= + .include diff --git a/lib/googletest/gmock/Makefile b/lib/googletest/gmock/Makefile index 8eb9fb99a368..d5a71d3c33a6 100644 --- a/lib/googletest/gmock/Makefile +++ b/lib/googletest/gmock/Makefile @@ -42,7 +42,4 @@ INTERNAL_CUSTOM_INCS+= gmock/internal/custom/gmock-generated-actions.h SRCS+= gmock-all.cc -HAS_TESTS= -SUBDIR.${MK_TESTS}+= tests - .include diff --git a/lib/googletest/gmock_main/Makefile b/lib/googletest/gmock_main/Makefile index a2ecab10d586..238f342d55eb 100644 --- a/lib/googletest/gmock_main/Makefile +++ b/lib/googletest/gmock_main/Makefile @@ -19,7 +19,4 @@ LDFLAGS+= -L${LIBGMOCKDIR} SRCS+= gmock_main.cc -HAS_TESTS= -SUBDIR.${MK_TESTS}+= tests - .include diff --git a/lib/googletest/gtest/Makefile b/lib/googletest/gtest/Makefile index b580c33eb45a..ed3786d5075d 100644 --- a/lib/googletest/gtest/Makefile +++ b/lib/googletest/gtest/Makefile @@ -47,7 +47,4 @@ SRCS+= gtest-all.cc LIBADD+= pthread -HAS_TESTS= -SUBDIR.${MK_TESTS}+= tests - .include diff --git a/lib/googletest/gtest_main/Makefile b/lib/googletest/gtest_main/Makefile index 1499482d878a..dc102ed8a6e0 100644 --- a/lib/googletest/gtest_main/Makefile +++ b/lib/googletest/gtest_main/Makefile @@ -17,7 +17,4 @@ LDFLAGS+= -L${LIBGTESTDIR} SRCS+= gtest_main.cc -HAS_TESTS= -SUBDIR.${MK_TESTS}+= tests - .include diff --git a/lib/googletest/tests/Makefile b/lib/googletest/tests/Makefile index 3b3078f8612a..1df9936ff6cf 100644 --- a/lib/googletest/tests/Makefile +++ b/lib/googletest/tests/Makefile @@ -3,4 +3,10 @@ .PATH: ${SRCTOP}/tests KYUAFILE= yes +# Note: we start the gmock_main and gmock tests first since those take up to +# 60 seconds to build, so starting them late seriously reduces build parallism. +SUBDIR= gmock_main gmock gtest_main gtest + +SUBDIR_PARALLEL= + .include diff --git a/lib/googletest/tests/Makefile.inc b/lib/googletest/tests/Makefile.inc new file mode 100644 index 000000000000..667b5c102930 --- /dev/null +++ b/lib/googletest/tests/Makefile.inc @@ -0,0 +1,18 @@ +# $FreeBSD$ + +.include "../Makefile.inc" +# Keep the existing tests directory structure (with subdirs per component) +# rather than installing all of them to /usr/tests/lib/googletest +TESTSDIR= ${TESTSBASE}/lib/googletest/${.CURDIR:T} + +# Clang's optimizer spends a really long time on these tests at -O2. Changing +# -O2 to -O1 reduces the -j32 time for lib/googletest/test from 131s to 71s. +# Using -O0 further reduces the time to 29s, and also reduces the disk usage +# from 144MB (at -O2) / 92MB (at -O1) to 82MB, so we use -O0. +# Note: Building without debug info saves about 10-15% of the build time, so we +# only enable debug info if DEBUG_FLAGS is not empty (71s -> 64s at -O1 and -j32). +CFLAGS.clang+= -O0 +.if empty(DEBUG_FLAGS) +MK_DEBUG_FILES:=no +CFLAGS.clang+= -g0 +.endif diff --git a/lib/googletest/gmock/tests/Makefile b/lib/googletest/tests/gmock/Makefile similarity index 100% rename from lib/googletest/gmock/tests/Makefile rename to lib/googletest/tests/gmock/Makefile diff --git a/lib/googletest/gmock_main/tests/Makefile b/lib/googletest/tests/gmock_main/Makefile similarity index 100% rename from lib/googletest/gmock_main/tests/Makefile rename to lib/googletest/tests/gmock_main/Makefile diff --git a/lib/googletest/gtest/tests/Makefile b/lib/googletest/tests/gtest/Makefile similarity index 100% rename from lib/googletest/gtest/tests/Makefile rename to lib/googletest/tests/gtest/Makefile diff --git a/lib/googletest/gtest_main/tests/Makefile b/lib/googletest/tests/gtest_main/Makefile similarity index 100% rename from lib/googletest/gtest_main/tests/Makefile rename to lib/googletest/tests/gtest_main/Makefile