From 2ed3236082a4473c1da8f72c1ebc071a7b54321f Mon Sep 17 00:00:00 2001 From: Alex Richardson Date: Mon, 19 Oct 2020 19:50:57 +0000 Subject: [PATCH] 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 --- 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 | 6 ++++++ 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 10 files changed, 12 insertions(+), 12 deletions(-) create mode 100644 lib/googletest/tests/Makefile.inc rename lib/googletest/{gmock/tests => tests/gmock}/Makefile (100%) rename lib/googletest/{gmock_main/tests => tests/gmock_main}/Makefile (100%) rename lib/googletest/{gtest/tests => tests/gtest}/Makefile (100%) rename lib/googletest/{gtest_main/tests => tests/gtest_main}/Makefile (100%) 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 103bf84db5b2..470682faebc1 100644 --- a/lib/googletest/gtest/Makefile +++ b/lib/googletest/gtest/Makefile @@ -47,7 +47,4 @@ SRCS+= gtest-all.cc LIBADD+= pthread regex -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..3b6b7fc07a9b --- /dev/null +++ b/lib/googletest/tests/Makefile.inc @@ -0,0 +1,6 @@ +# $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} 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