From a9a358e68dfe962125a9dfc5da1a6a80778e37c7 Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sun, 22 Dec 2019 15:07:11 -0800 Subject: Set a build flag to help debug an "Invalid PCH" error when running tests in Travis CI under OS X with GCC 9. --- extras/scripts/postsubmit-helper.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/scripts/postsubmit-helper.sh b/extras/scripts/postsubmit-helper.sh index 36169bb..7a53da3 100755 --- a/extras/scripts/postsubmit-helper.sh +++ b/extras/scripts/postsubmit-helper.sh @@ -108,7 +108,7 @@ if [[ "${COMPILER}" != "bazel" ]] then # This is only needed in OS X but it has no effect on Linux so we can add it unconditionally. BOOST_INCLUDE_FLAG="-I /usr/local/include/boost" - COMMON_CXX_FLAGS="$STLARG $BOOST_INCLUDE_FLAG -Werror -pedantic" + COMMON_CXX_FLAGS="$STLARG $BOOST_INCLUDE_FLAG -Werror -pedantic -Winvalid-pch" echo CXX version: $($CXX --version) echo C++ Standard library location: $(echo '#include ' | $CXX -x c++ -E - | grep 'vector\"' | awk '{print $3}' | sed 's@/vector@@;s@\"@@g' | head -n 1) -- cgit v1.2.3 From 0187d6ce3fbd6092e64f6244a8e5c29877314603 Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sun, 22 Dec 2019 15:08:41 -0800 Subject: Make sure all brew-installed packages are linked in /usr/local. Some aren't by default. Hoping to fix a "clang-8 not found" build error when running tests under OS X. --- extras/scripts/travis_ci_install_osx.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/extras/scripts/travis_ci_install_osx.sh b/extras/scripts/travis_ci_install_osx.sh index 0bef2b1..78f5cd2 100755 --- a/extras/scripts/travis_ci_install_osx.sh +++ b/extras/scripts/travis_ci_install_osx.sh @@ -4,6 +4,8 @@ set -e install_brew_package() { time (brew install "$@" || brew outdated "$1" || brew upgrade "$@") + # Some formulas are not linked into /usr/local by default, make sure they are. + time (brew link "$@" || true) } # For md5sum, timeout -- cgit v1.2.3 From 2cc8be12c0311d9002e64c2ca718c51302785f9b Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sun, 22 Dec 2019 15:37:55 -0800 Subject: No longer use PCHs when running OS X CI tests with GCC 9, it does not work. --- .travis.yml | 16 ++++++++-------- extras/scripts/travis_yml_generator.py | 6 +++++- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9e1c79f..66571df 100644 --- a/.travis.yml +++ b/.travis.yml @@ -48,12 +48,6 @@ matrix: os: linux script: export OS=linux; export COMPILER='bazel'; export UBUNTU='18.04'; extras/scripts/postsubmit.sh DebugPlain - - compiler: gcc - env: COMPILER=gcc-9 TEST=DebugPlain - install: export OS=osx; export COMPILER='gcc-9'; extras/scripts/travis_ci_install_osx.sh - os: osx - osx_image: xcode11.4 - script: export OS=osx; export COMPILER='gcc-9'; extras/scripts/postsubmit.sh DebugPlain - compiler: clang env: COMPILER=clang-default STL=libc++ TEST=DebugPlain install: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; @@ -197,11 +191,17 @@ matrix: osx_image: xcode11.4 script: export OS=osx; export COMPILER='gcc-6'; extras/scripts/postsubmit.sh DebugPlain - compiler: gcc - env: COMPILER=gcc-9 TEST=ReleasePlain + env: COMPILER=gcc-9 TEST=ReleasePlainNoPch + install: export OS=osx; export COMPILER='gcc-9'; extras/scripts/travis_ci_install_osx.sh + os: osx + osx_image: xcode11.4 + script: export OS=osx; export COMPILER='gcc-9'; extras/scripts/postsubmit.sh ReleasePlainNoPch + - compiler: gcc + env: COMPILER=gcc-9 TEST=DebugPlainNoPch install: export OS=osx; export COMPILER='gcc-9'; extras/scripts/travis_ci_install_osx.sh os: osx osx_image: xcode11.4 - script: export OS=osx; export COMPILER='gcc-9'; extras/scripts/postsubmit.sh ReleasePlain + script: export OS=osx; export COMPILER='gcc-9'; extras/scripts/postsubmit.sh DebugPlainNoPch - compiler: clang env: COMPILER=clang-4.0 STL=libc++ TEST=ReleasePlain install: export OS=osx; export COMPILER='clang-4.0'; export STL='libc++'; extras/scripts/travis_ci_install_osx.sh diff --git a/extras/scripts/travis_yml_generator.py b/extras/scripts/travis_yml_generator.py index e2f5581..0b78678 100755 --- a/extras/scripts/travis_yml_generator.py +++ b/extras/scripts/travis_yml_generator.py @@ -176,7 +176,11 @@ add_ubuntu_tests(ubuntu_version='16.04', compiler='clang-3.9', stl='libstdc++', # visibility settings. # and the build eventually fails or times out. add_osx_tests(compiler='gcc-6', xcode_version='11.4', asan=False, ubsan=False) -add_osx_tests(compiler='gcc-9', xcode_version='11.4', asan=False, ubsan=False, smoke_tests=['DebugPlain']) +add_osx_tests(compiler='gcc-9', xcode_version='11.4', asan=False, ubsan=False, smoke_tests=['DebugPlain'], + # Using PCHs fails with this error: + # error: /Users/travis/build/google/fruit/build/tests/test_common-precompiled.h.gch: had text segment + # at different address + use_precompiled_headers_in_tests=False) add_osx_tests(compiler='clang-4.0', xcode_version='11.4', stl='libc++') add_osx_tests(compiler='clang-8.0', xcode_version='11.4', stl='libc++', smoke_tests=['DebugPlain'], # Disabled due to https://bugs.llvm.org/show_bug.cgi?id=41625. -- cgit v1.2.3 From fdaf99a72fe4c4762942d1f15009bcdb2e10c161 Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sun, 22 Dec 2019 15:39:30 -0800 Subject: Bump the minimum clang version used in OS X CI tests to 6.0. Clang 4.0 no longer exists in brew. --- .travis.yml | 12 ++++++------ extras/scripts/travis_yml_generator.py | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 66571df..0ff2503 100644 --- a/.travis.yml +++ b/.travis.yml @@ -203,18 +203,18 @@ matrix: osx_image: xcode11.4 script: export OS=osx; export COMPILER='gcc-9'; extras/scripts/postsubmit.sh DebugPlainNoPch - compiler: clang - env: COMPILER=clang-4.0 STL=libc++ TEST=ReleasePlain - install: export OS=osx; export COMPILER='clang-4.0'; export STL='libc++'; extras/scripts/travis_ci_install_osx.sh + env: COMPILER=clang-6.0 STL=libc++ TEST=ReleasePlain + install: export OS=osx; export COMPILER='clang-6.0'; export STL='libc++'; extras/scripts/travis_ci_install_osx.sh os: osx osx_image: xcode11.4 - script: export OS=osx; export COMPILER='clang-4.0'; export STL='libc++'; extras/scripts/postsubmit.sh + script: export OS=osx; export COMPILER='clang-6.0'; export STL='libc++'; extras/scripts/postsubmit.sh ReleasePlain - compiler: clang - env: COMPILER=clang-4.0 STL=libc++ TEST=DebugAsanUbsan - install: export OS=osx; export COMPILER='clang-4.0'; export STL='libc++'; extras/scripts/travis_ci_install_osx.sh + env: COMPILER=clang-6.0 STL=libc++ TEST=DebugAsanUbsan + install: export OS=osx; export COMPILER='clang-6.0'; export STL='libc++'; extras/scripts/travis_ci_install_osx.sh os: osx osx_image: xcode11.4 - script: export OS=osx; export COMPILER='clang-4.0'; export STL='libc++'; extras/scripts/postsubmit.sh + script: export OS=osx; export COMPILER='clang-6.0'; export STL='libc++'; extras/scripts/postsubmit.sh DebugAsanUbsan - compiler: clang env: COMPILER=clang-8.0 STL=libc++ TEST=ReleasePlainNoPch diff --git a/extras/scripts/travis_yml_generator.py b/extras/scripts/travis_yml_generator.py index 0b78678..95a8333 100755 --- a/extras/scripts/travis_yml_generator.py +++ b/extras/scripts/travis_yml_generator.py @@ -181,7 +181,7 @@ add_osx_tests(compiler='gcc-9', xcode_version='11.4', asan=False, ubsan=False, s # error: /Users/travis/build/google/fruit/build/tests/test_common-precompiled.h.gch: had text segment # at different address use_precompiled_headers_in_tests=False) -add_osx_tests(compiler='clang-4.0', xcode_version='11.4', stl='libc++') +add_osx_tests(compiler='clang-6.0', xcode_version='11.4', stl='libc++') add_osx_tests(compiler='clang-8.0', xcode_version='11.4', stl='libc++', smoke_tests=['DebugPlain'], # Disabled due to https://bugs.llvm.org/show_bug.cgi?id=41625. use_precompiled_headers_in_tests=False) -- cgit v1.2.3 From 6bec05244aeb29e4e90a84ebf916915d103f9b8e Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sun, 22 Dec 2019 15:43:11 -0800 Subject: Bump the minimum version of OS X used in CI tests to 10.13. Older versions no longer have Boost binary packages in brew, so brew tries compiling it from source and the build times out. --- .travis.yml | 20 ++------------------ extras/scripts/travis_yml_generator.py | 5 +---- 2 files changed, 3 insertions(+), 22 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0ff2503..4ca35cf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -242,23 +242,7 @@ matrix: install: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; extras/scripts/travis_ci_install_osx.sh os: osx - osx_image: xcode8.3 - script: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; extras/scripts/postsubmit.sh - ReleasePlain - - compiler: clang - env: COMPILER=clang-default STL=libc++ TEST=DebugAsan - install: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; - extras/scripts/travis_ci_install_osx.sh - os: osx - osx_image: xcode8.3 - script: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; extras/scripts/postsubmit.sh - DebugAsan - - compiler: clang - env: COMPILER=clang-default STL=libc++ TEST=ReleasePlain - install: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; - extras/scripts/travis_ci_install_osx.sh - os: osx - osx_image: xcode9.4 + osx_image: xcode9.3 script: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; extras/scripts/postsubmit.sh ReleasePlain - compiler: clang @@ -266,7 +250,7 @@ matrix: install: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; extras/scripts/travis_ci_install_osx.sh os: osx - osx_image: xcode9.4 + osx_image: xcode9.3 script: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; extras/scripts/postsubmit.sh DebugAsanUbsan - compiler: clang diff --git a/extras/scripts/travis_yml_generator.py b/extras/scripts/travis_yml_generator.py index 95a8333..76da62a 100755 --- a/extras/scripts/travis_yml_generator.py +++ b/extras/scripts/travis_yml_generator.py @@ -186,10 +186,7 @@ add_osx_tests(compiler='clang-8.0', xcode_version='11.4', stl='libc++', smoke_te # Disabled due to https://bugs.llvm.org/show_bug.cgi?id=41625. use_precompiled_headers_in_tests=False) -# UBSan is disabled because AppleClang does not support -fsanitize=undefined. -add_osx_tests(compiler='clang-default', xcode_version='8.3', stl='libc++', ubsan=False) - -add_osx_tests(compiler='clang-default', xcode_version='9.4', stl='libc++') +add_osx_tests(compiler='clang-default', xcode_version='9.3', stl='libc++') add_osx_tests(compiler='clang-default', xcode_version='10.3', stl='libc++', smoke_tests=['DebugPlain']) add_osx_tests(compiler='clang-default', xcode_version='11.4', stl='libc++', smoke_tests=['DebugPlain']) -- cgit v1.2.3 From e411f050accead5e855c74d1baac8c7f150715e3 Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sun, 22 Dec 2019 15:53:16 -0800 Subject: Really run "brew link" for keg-only packages. --- extras/scripts/travis_ci_install_osx.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/scripts/travis_ci_install_osx.sh b/extras/scripts/travis_ci_install_osx.sh index 78f5cd2..7946842 100755 --- a/extras/scripts/travis_ci_install_osx.sh +++ b/extras/scripts/travis_ci_install_osx.sh @@ -5,7 +5,7 @@ set -e install_brew_package() { time (brew install "$@" || brew outdated "$1" || brew upgrade "$@") # Some formulas are not linked into /usr/local by default, make sure they are. - time (brew link "$@" || true) + time (brew link --force "$@" || true) } # For md5sum, timeout -- cgit v1.2.3 From ceea9f7d1ceb831de2a0d164e39ada437f92f852 Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sun, 22 Dec 2019 16:28:44 -0800 Subject: More changes to try getting OS X CI tests to work again. --- extras/scripts/postsubmit-helper.sh | 2 +- extras/scripts/travis_ci_install_osx.sh | 22 ++++++++++++++++------ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/extras/scripts/postsubmit-helper.sh b/extras/scripts/postsubmit-helper.sh index 7a53da3..cc96928 100755 --- a/extras/scripts/postsubmit-helper.sh +++ b/extras/scripts/postsubmit-helper.sh @@ -107,7 +107,7 @@ run_make() { if [[ "${COMPILER}" != "bazel" ]] then # This is only needed in OS X but it has no effect on Linux so we can add it unconditionally. - BOOST_INCLUDE_FLAG="-I /usr/local/include/boost" + BOOST_INCLUDE_FLAG="-I /usr/local/include/boost -I /usr/local/include" COMMON_CXX_FLAGS="$STLARG $BOOST_INCLUDE_FLAG -Werror -pedantic -Winvalid-pch" echo CXX version: $($CXX --version) diff --git a/extras/scripts/travis_ci_install_osx.sh b/extras/scripts/travis_ci_install_osx.sh index 7946842..40a91fd 100755 --- a/extras/scripts/travis_ci_install_osx.sh +++ b/extras/scripts/travis_ci_install_osx.sh @@ -26,12 +26,22 @@ gcc-7) install_brew_package gcc@7 ;; gcc-8) install_brew_package gcc@8 ;; gcc-9) install_brew_package gcc@9 ;; clang-default) ;; -clang-3.9) install_brew_package llvm@3.9 ;; -clang-4.0) install_brew_package llvm@4 ;; -clang-5.0) install_brew_package llvm@5 ;; -clang-6.0) install_brew_package llvm@6 ;; -clang-7.0) install_brew_package llvm@7 ;; -clang-8.0) install_brew_package llvm@8 ;; +clang-6.0) + install_brew_package llvm@6 + ln -s /usr/local/opt/llvm@6/bin/clang++ /usr/local/bin/clang++-6 + ;; +clang-7.0) + install_brew_package llvm@7 + ln -s /usr/local/opt/llvm@7/bin/clang++ /usr/local/bin/clang++-7 + ;; +clang-8.0) + install_brew_package llvm@8 + ln -s /usr/local/opt/llvm@8/bin/clang++ /usr/local/bin/clang++-8 + ;; +clang-9.0) + install_brew_package llvm@9 + ln -s /usr/local/opt/llvm@9/bin/clang++ /usr/local/bin/clang++-9 + ;; *) echo "Compiler not supported: ${COMPILER}. See travis_ci_install_osx.sh"; exit 1 ;; esac -- cgit v1.2.3 From 577dfff6444403b7a3a4aedf6ea800dd59c49b0f Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sun, 22 Dec 2019 16:29:51 -0800 Subject: Test against Clang 9 instead of Clang 8 in OS X CI tests. --- .travis.yml | 18 +++++++++--------- extras/scripts/travis_yml_generator.py | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4ca35cf..5024b29 100644 --- a/.travis.yml +++ b/.travis.yml @@ -217,25 +217,25 @@ matrix: script: export OS=osx; export COMPILER='clang-6.0'; export STL='libc++'; extras/scripts/postsubmit.sh DebugAsanUbsan - compiler: clang - env: COMPILER=clang-8.0 STL=libc++ TEST=ReleasePlainNoPch - install: export OS=osx; export COMPILER='clang-8.0'; export STL='libc++'; extras/scripts/travis_ci_install_osx.sh + env: COMPILER=clang-9.0 STL=libc++ TEST=ReleasePlainNoPch + install: export OS=osx; export COMPILER='clang-9.0'; export STL='libc++'; extras/scripts/travis_ci_install_osx.sh os: osx osx_image: xcode11.4 - script: export OS=osx; export COMPILER='clang-8.0'; export STL='libc++'; extras/scripts/postsubmit.sh + script: export OS=osx; export COMPILER='clang-9.0'; export STL='libc++'; extras/scripts/postsubmit.sh ReleasePlainNoPch - compiler: clang - env: COMPILER=clang-8.0 STL=libc++ TEST=DebugAsanUbsanNoPch - install: export OS=osx; export COMPILER='clang-8.0'; export STL='libc++'; extras/scripts/travis_ci_install_osx.sh + env: COMPILER=clang-9.0 STL=libc++ TEST=DebugAsanUbsanNoPch + install: export OS=osx; export COMPILER='clang-9.0'; export STL='libc++'; extras/scripts/travis_ci_install_osx.sh os: osx osx_image: xcode11.4 - script: export OS=osx; export COMPILER='clang-8.0'; export STL='libc++'; extras/scripts/postsubmit.sh + script: export OS=osx; export COMPILER='clang-9.0'; export STL='libc++'; extras/scripts/postsubmit.sh DebugAsanUbsanNoPch - compiler: clang - env: COMPILER=clang-8.0 STL=libc++ TEST=DebugPlainNoPch - install: export OS=osx; export COMPILER='clang-8.0'; export STL='libc++'; extras/scripts/travis_ci_install_osx.sh + env: COMPILER=clang-9.0 STL=libc++ TEST=DebugPlainNoPch + install: export OS=osx; export COMPILER='clang-9.0'; export STL='libc++'; extras/scripts/travis_ci_install_osx.sh os: osx osx_image: xcode11.4 - script: export OS=osx; export COMPILER='clang-8.0'; export STL='libc++'; extras/scripts/postsubmit.sh + script: export OS=osx; export COMPILER='clang-9.0'; export STL='libc++'; extras/scripts/postsubmit.sh DebugPlainNoPch - compiler: clang env: COMPILER=clang-default STL=libc++ TEST=ReleasePlain diff --git a/extras/scripts/travis_yml_generator.py b/extras/scripts/travis_yml_generator.py index 76da62a..0c113dc 100755 --- a/extras/scripts/travis_yml_generator.py +++ b/extras/scripts/travis_yml_generator.py @@ -182,7 +182,7 @@ add_osx_tests(compiler='gcc-9', xcode_version='11.4', asan=False, ubsan=False, s # at different address use_precompiled_headers_in_tests=False) add_osx_tests(compiler='clang-6.0', xcode_version='11.4', stl='libc++') -add_osx_tests(compiler='clang-8.0', xcode_version='11.4', stl='libc++', smoke_tests=['DebugPlain'], +add_osx_tests(compiler='clang-9.0', xcode_version='11.4', stl='libc++', smoke_tests=['DebugPlain'], # Disabled due to https://bugs.llvm.org/show_bug.cgi?id=41625. use_precompiled_headers_in_tests=False) -- cgit v1.2.3 From a1c6c7c0067a31c3a8b1d7f563ea12241ae55279 Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sun, 22 Dec 2019 16:40:00 -0800 Subject: Use clang[++]-6.0 as symlink names on OS X too, to match the names under Ubuntu that the Fruit CI test script uses. --- extras/scripts/travis_ci_install_osx.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/extras/scripts/travis_ci_install_osx.sh b/extras/scripts/travis_ci_install_osx.sh index 40a91fd..acf668c 100755 --- a/extras/scripts/travis_ci_install_osx.sh +++ b/extras/scripts/travis_ci_install_osx.sh @@ -28,7 +28,8 @@ gcc-9) install_brew_package gcc@9 ;; clang-default) ;; clang-6.0) install_brew_package llvm@6 - ln -s /usr/local/opt/llvm@6/bin/clang++ /usr/local/bin/clang++-6 + ln -s /usr/local/opt/llvm@6/bin/clang++ /usr/local/bin/clang++-6.0 + ln -s /usr/local/opt/llvm@6/bin/clang /usr/local/bin/clang-6.0 ;; clang-7.0) install_brew_package llvm@7 -- cgit v1.2.3 From 8116f5bb338b93cba9cebf643c8514d4d198c87e Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sun, 22 Dec 2019 16:40:50 -0800 Subject: Support Clang 9 in the CI scripts. --- extras/scripts/postsubmit-helper.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/extras/scripts/postsubmit-helper.sh b/extras/scripts/postsubmit-helper.sh index cc96928..2d5d44b 100755 --- a/extras/scripts/postsubmit-helper.sh +++ b/extras/scripts/postsubmit-helper.sh @@ -87,6 +87,11 @@ clang-8.0) export CXX=clang++-8 ;; +clang-9.0) + export CC=clang-9 + export CXX=clang++-9 + ;; + clang-default) export CC=clang export CXX=clang++ -- cgit v1.2.3 From fabf779cdd16d47008ed1709ffcc55bb815a2ef5 Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sun, 22 Dec 2019 16:44:25 -0800 Subject: No longer run CI tests using XCode 10.3. 9.3 and 11.4 should be enough, and 10.3 doesn't work, it seems that the Travis CI env is affected by https://stackoverflow.com/questions/26185978/macos-wchar-h-file-not-found. --- .travis.yml | 24 ------------------------ extras/scripts/travis_yml_generator.py | 1 - 2 files changed, 25 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5024b29..f092758 100644 --- a/.travis.yml +++ b/.travis.yml @@ -48,14 +48,6 @@ matrix: os: linux script: export OS=linux; export COMPILER='bazel'; export UBUNTU='18.04'; extras/scripts/postsubmit.sh DebugPlain - - compiler: clang - env: COMPILER=clang-default STL=libc++ TEST=DebugPlain - install: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; - extras/scripts/travis_ci_install_osx.sh - os: osx - osx_image: xcode10.3 - script: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; extras/scripts/postsubmit.sh - DebugPlain - compiler: clang env: COMPILER=clang-default STL=libc++ TEST=DebugPlain install: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; @@ -253,22 +245,6 @@ matrix: osx_image: xcode9.3 script: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; extras/scripts/postsubmit.sh DebugAsanUbsan - - compiler: clang - env: COMPILER=clang-default STL=libc++ TEST=ReleasePlain - install: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; - extras/scripts/travis_ci_install_osx.sh - os: osx - osx_image: xcode10.3 - script: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; extras/scripts/postsubmit.sh - ReleasePlain - - compiler: clang - env: COMPILER=clang-default STL=libc++ TEST=DebugAsanUbsan - install: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; - extras/scripts/travis_ci_install_osx.sh - os: osx - osx_image: xcode10.3 - script: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; extras/scripts/postsubmit.sh - DebugAsanUbsan - compiler: clang env: COMPILER=clang-default STL=libc++ TEST=ReleasePlain install: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; diff --git a/extras/scripts/travis_yml_generator.py b/extras/scripts/travis_yml_generator.py index 0c113dc..f95c463 100755 --- a/extras/scripts/travis_yml_generator.py +++ b/extras/scripts/travis_yml_generator.py @@ -187,7 +187,6 @@ add_osx_tests(compiler='clang-9.0', xcode_version='11.4', stl='libc++', smoke_te use_precompiled_headers_in_tests=False) add_osx_tests(compiler='clang-default', xcode_version='9.3', stl='libc++') -add_osx_tests(compiler='clang-default', xcode_version='10.3', stl='libc++', smoke_tests=['DebugPlain']) add_osx_tests(compiler='clang-default', xcode_version='11.4', stl='libc++', smoke_tests=['DebugPlain']) # ** Disabled combinations ** -- cgit v1.2.3 From d8675705a560002944ffce2d5023557e92f5f24b Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sun, 22 Dec 2019 16:55:10 -0800 Subject: Run OS X CI tests with XCode 9.4 instead of 9.3. --- .travis.yml | 4 ++-- extras/scripts/travis_yml_generator.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index f092758..1e6b964 100644 --- a/.travis.yml +++ b/.travis.yml @@ -234,7 +234,7 @@ matrix: install: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; extras/scripts/travis_ci_install_osx.sh os: osx - osx_image: xcode9.3 + osx_image: xcode9.4 script: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; extras/scripts/postsubmit.sh ReleasePlain - compiler: clang @@ -242,7 +242,7 @@ matrix: install: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; extras/scripts/travis_ci_install_osx.sh os: osx - osx_image: xcode9.3 + osx_image: xcode9.4 script: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; extras/scripts/postsubmit.sh DebugAsanUbsan - compiler: clang diff --git a/extras/scripts/travis_yml_generator.py b/extras/scripts/travis_yml_generator.py index f95c463..a9ce34b 100755 --- a/extras/scripts/travis_yml_generator.py +++ b/extras/scripts/travis_yml_generator.py @@ -186,7 +186,7 @@ add_osx_tests(compiler='clang-9.0', xcode_version='11.4', stl='libc++', smoke_te # Disabled due to https://bugs.llvm.org/show_bug.cgi?id=41625. use_precompiled_headers_in_tests=False) -add_osx_tests(compiler='clang-default', xcode_version='9.3', stl='libc++') +add_osx_tests(compiler='clang-default', xcode_version='9.4', stl='libc++') add_osx_tests(compiler='clang-default', xcode_version='11.4', stl='libc++', smoke_tests=['DebugPlain']) # ** Disabled combinations ** -- cgit v1.2.3 From 77238f6ab6c96f927d2c99afe76204513f6e5a8a Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sun, 22 Dec 2019 17:02:55 -0800 Subject: Don't try to create a simlink that already exists in OS X CI tests with Clang 6.0. --- extras/scripts/travis_ci_install_osx.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/extras/scripts/travis_ci_install_osx.sh b/extras/scripts/travis_ci_install_osx.sh index acf668c..8563381 100755 --- a/extras/scripts/travis_ci_install_osx.sh +++ b/extras/scripts/travis_ci_install_osx.sh @@ -29,7 +29,6 @@ clang-default) ;; clang-6.0) install_brew_package llvm@6 ln -s /usr/local/opt/llvm@6/bin/clang++ /usr/local/bin/clang++-6.0 - ln -s /usr/local/opt/llvm@6/bin/clang /usr/local/bin/clang-6.0 ;; clang-7.0) install_brew_package llvm@7 -- cgit v1.2.3 From bec77bc53f2a304059a564d8d5f1a0ffc36e062e Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sun, 22 Dec 2019 17:04:48 -0800 Subject: Create an extra symlink for Clang 9 when running CI tests on OX X. --- extras/scripts/travis_ci_install_osx.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/extras/scripts/travis_ci_install_osx.sh b/extras/scripts/travis_ci_install_osx.sh index 8563381..ed5b40c 100755 --- a/extras/scripts/travis_ci_install_osx.sh +++ b/extras/scripts/travis_ci_install_osx.sh @@ -41,6 +41,7 @@ clang-8.0) clang-9.0) install_brew_package llvm@9 ln -s /usr/local/opt/llvm@9/bin/clang++ /usr/local/bin/clang++-9 + ln -s /usr/local/opt/llvm@9/bin/clang /usr/local/bin/clang-9.0 ;; *) echo "Compiler not supported: ${COMPILER}. See travis_ci_install_osx.sh"; exit 1 ;; esac -- cgit v1.2.3 From a3165eb2bc8c4bea94fac086b7d7590fad63ec1c Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sun, 22 Dec 2019 17:18:45 -0800 Subject: Fix typo in the Clang 9 symlink created when running CI tests on OS X. --- extras/scripts/travis_ci_install_osx.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/scripts/travis_ci_install_osx.sh b/extras/scripts/travis_ci_install_osx.sh index ed5b40c..bb877be 100755 --- a/extras/scripts/travis_ci_install_osx.sh +++ b/extras/scripts/travis_ci_install_osx.sh @@ -41,7 +41,7 @@ clang-8.0) clang-9.0) install_brew_package llvm@9 ln -s /usr/local/opt/llvm@9/bin/clang++ /usr/local/bin/clang++-9 - ln -s /usr/local/opt/llvm@9/bin/clang /usr/local/bin/clang-9.0 + ln -s /usr/local/opt/llvm@9/bin/clang /usr/local/bin/clang-9 ;; *) echo "Compiler not supported: ${COMPILER}. See travis_ci_install_osx.sh"; exit 1 ;; esac -- cgit v1.2.3 From 79a47c3953e84d58c267b15dae97ac256d8451fc Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sun, 22 Dec 2019 17:39:16 -0800 Subject: Switch back to testing with Clang 8 instead of Clang 9 in OS X CI tests, the brew package for Clang 9 doesn't seem to work. --- .travis.yml | 18 +++++++++--------- extras/scripts/travis_yml_generator.py | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1e6b964..ca75228 100644 --- a/.travis.yml +++ b/.travis.yml @@ -209,25 +209,25 @@ matrix: script: export OS=osx; export COMPILER='clang-6.0'; export STL='libc++'; extras/scripts/postsubmit.sh DebugAsanUbsan - compiler: clang - env: COMPILER=clang-9.0 STL=libc++ TEST=ReleasePlainNoPch - install: export OS=osx; export COMPILER='clang-9.0'; export STL='libc++'; extras/scripts/travis_ci_install_osx.sh + env: COMPILER=clang-8.0 STL=libc++ TEST=ReleasePlainNoPch + install: export OS=osx; export COMPILER='clang-8.0'; export STL='libc++'; extras/scripts/travis_ci_install_osx.sh os: osx osx_image: xcode11.4 - script: export OS=osx; export COMPILER='clang-9.0'; export STL='libc++'; extras/scripts/postsubmit.sh + script: export OS=osx; export COMPILER='clang-8.0'; export STL='libc++'; extras/scripts/postsubmit.sh ReleasePlainNoPch - compiler: clang - env: COMPILER=clang-9.0 STL=libc++ TEST=DebugAsanUbsanNoPch - install: export OS=osx; export COMPILER='clang-9.0'; export STL='libc++'; extras/scripts/travis_ci_install_osx.sh + env: COMPILER=clang-8.0 STL=libc++ TEST=DebugAsanUbsanNoPch + install: export OS=osx; export COMPILER='clang-8.0'; export STL='libc++'; extras/scripts/travis_ci_install_osx.sh os: osx osx_image: xcode11.4 - script: export OS=osx; export COMPILER='clang-9.0'; export STL='libc++'; extras/scripts/postsubmit.sh + script: export OS=osx; export COMPILER='clang-8.0'; export STL='libc++'; extras/scripts/postsubmit.sh DebugAsanUbsanNoPch - compiler: clang - env: COMPILER=clang-9.0 STL=libc++ TEST=DebugPlainNoPch - install: export OS=osx; export COMPILER='clang-9.0'; export STL='libc++'; extras/scripts/travis_ci_install_osx.sh + env: COMPILER=clang-8.0 STL=libc++ TEST=DebugPlainNoPch + install: export OS=osx; export COMPILER='clang-8.0'; export STL='libc++'; extras/scripts/travis_ci_install_osx.sh os: osx osx_image: xcode11.4 - script: export OS=osx; export COMPILER='clang-9.0'; export STL='libc++'; extras/scripts/postsubmit.sh + script: export OS=osx; export COMPILER='clang-8.0'; export STL='libc++'; extras/scripts/postsubmit.sh DebugPlainNoPch - compiler: clang env: COMPILER=clang-default STL=libc++ TEST=ReleasePlain diff --git a/extras/scripts/travis_yml_generator.py b/extras/scripts/travis_yml_generator.py index a9ce34b..288232e 100755 --- a/extras/scripts/travis_yml_generator.py +++ b/extras/scripts/travis_yml_generator.py @@ -182,7 +182,7 @@ add_osx_tests(compiler='gcc-9', xcode_version='11.4', asan=False, ubsan=False, s # at different address use_precompiled_headers_in_tests=False) add_osx_tests(compiler='clang-6.0', xcode_version='11.4', stl='libc++') -add_osx_tests(compiler='clang-9.0', xcode_version='11.4', stl='libc++', smoke_tests=['DebugPlain'], +add_osx_tests(compiler='clang-8.0', xcode_version='11.4', stl='libc++', smoke_tests=['DebugPlain'], # Disabled due to https://bugs.llvm.org/show_bug.cgi?id=41625. use_precompiled_headers_in_tests=False) -- cgit v1.2.3 From 890658eebd952300fae3444e287056f2e7a5e50b Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sun, 22 Dec 2019 17:50:19 -0800 Subject: Install absl-py when running CI tests on Appveyor. --- extras/scripts/postsubmit.bat | 1 + 1 file changed, 1 insertion(+) diff --git a/extras/scripts/postsubmit.bat b/extras/scripts/postsubmit.bat index 59fbb4c..c23dd79 100644 --- a/extras/scripts/postsubmit.bat +++ b/extras/scripts/postsubmit.bat @@ -42,6 +42,7 @@ IF "%CMAKE_GENERATOR%"=="MinGW Makefiles" ( msbuild ALL_BUILD.vcxproj || exit /b 1 ) +pip3 install absl-py pip3 install pytest pip3 install pytest-xdist -- cgit v1.2.3 From 7831fb53dd49348af0ecc649025193dc3678d9b2 Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sun, 22 Dec 2019 21:02:04 -0800 Subject: Use os.getcwd() instead of env["PWD"] in testing code so that tests also work on Windows. --- tests/fruit_test_common.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/fruit_test_common.py b/tests/fruit_test_common.py index 28ecc59..0c4018b 100644 --- a/tests/fruit_test_common.py +++ b/tests/fruit_test_common.py @@ -35,7 +35,7 @@ run_under_valgrind = RUN_TESTS_UNDER_VALGRIND.lower() not in ('false', 'off', 'n def pretty_print_command(command, env): return 'cd %s; env -i %s %s' % ( - shlex.quote(env['PWD']), + shlex.quote(os.getcwd()), ' '.join('%s=%s' % (var_name, shlex.quote(value)) for var_name, value in env.items() if var_name != 'PWD'), ' '.join(shlex.quote(x) for x in command)) -- cgit v1.2.3 From f989e0328db23236f1236829fe9fe4d71e201f64 Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sun, 22 Dec 2019 22:05:23 -0800 Subject: Set a 5min timeout for each test case. One of the tests seems to be hanging in Appveyor CI runs, but ATM it's not clear which one is it. --- tests/CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index b5cbfdb..9daaed8 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -106,4 +106,7 @@ file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/pytest.ini" [pytest] testpaths = \"${CMAKE_CURRENT_SOURCE_DIR}\" addopts = -r a + +[pytest] +timeout = 300 ") -- cgit v1.2.3 From 553d9ff17ecef1d29d4c2afba2c75a9d59e3bfb0 Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sun, 22 Dec 2019 22:11:05 -0800 Subject: Fix the pytest.ini file used for testing, apparently having two sections with the same name is forbidden. --- tests/CMakeLists.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 9daaed8..d543dca 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -106,7 +106,5 @@ file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/pytest.ini" [pytest] testpaths = \"${CMAKE_CURRENT_SOURCE_DIR}\" addopts = -r a - -[pytest] timeout = 300 ") -- cgit v1.2.3 From 2803116f9a7645871aa8892ec4f5190b26498d29 Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Mon, 23 Dec 2019 11:06:25 -0800 Subject: Fix some testing code that handles compilation failures when using MSVC. --- tests/fruit_test_common.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/fruit_test_common.py b/tests/fruit_test_common.py index 0c4018b..d4a1308 100644 --- a/tests/fruit_test_common.py +++ b/tests/fruit_test_common.py @@ -166,7 +166,7 @@ class MsvcCompiler: self._compile(include_dirs, args = args) except CommandFailedException as e: # Note that we use stdout here, unlike above. MSVC reports compilation warnings and errors on stdout. - raise CompilationFailedException(e.command, e.stdout) + raise CompilationFailedException(e.command, e.stdout, e.stderr) def compile_and_link(self, source, include_dirs, output_file_name, args=[]): self._compile( -- cgit v1.2.3 From 2c7f55cc36a4acc33cdf03eb89c5bb5746cff1a7 Mon Sep 17 00:00:00 2001 From: tt4g Date: Sun, 1 Mar 2020 11:34:14 +0900 Subject: Use GNUInstallDirs module GNUInstallDirs module define CMAKE_INSTALL_BINDIR, CMAKE_INSTALL_BINDIR and CMAKE_INSTALL_INCLUDEDIR. For Windows shared library, specify CMAKE_INSTALL_BINDIR as the installation destination. INSTALL_LIBRARY_DIR has been replaced by CMAKE_INSTALL_LIBDIR and INSTALL_INCLUDE_DIR by CMAKE_INSTALL_INCLUDEDIR/fruit. --- CMakeLists.txt | 9 ++------- configuration/CMakeLists.txt | 2 +- extras/packaging/libfruit.spec | 4 ++-- src/CMakeLists.txt | 5 +++-- 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 20e5ba0..5df3d04 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,10 +17,6 @@ option(BUILD_SHARED_LIBS "Build shared library" ON) # The Visual Studio CMake generators default to multiple configurations, but Fruit doesn't support multi-configuration build directories. set(CMAKE_CONFIGURATION_TYPES "${CMAKE_BUILD_TYPE}") -if(NOT "${RUNTIME_OUTPUT_DIRECTORY}") - set(RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") -endif() - set(FRUIT_ADDITIONAL_CXX_FLAGS "" CACHE STRING "Additional CXX compiler flags." FORCE) set(FRUIT_ADDITIONAL_COMPILE_FLAGS "${FRUIT_ADDITIONAL_CXX_FLAGS}") @@ -94,8 +90,7 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR}/include) # of the user-friendly default that hides Fruit internals). #add_definitions(-DFRUIT_DEEP_TEMPLATE_INSTANTIATION_STACKTRACES_FOR_ERRORS=1) -set(INSTALL_INCLUDE_DIR include/fruit CACHE PATH "Installation directory for headers") -set(INSTALL_LIBRARY_DIR lib CACHE PATH "Installation directory for libraries") +include(GNUInstallDirs) set(FRUIT_VERSION "3.4.0") @@ -114,7 +109,7 @@ endif() add_subdirectory(extras EXCLUDE_FROM_ALL) install(DIRECTORY include/fruit/ - DESTINATION "${INSTALL_INCLUDE_DIR}" + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/fruit FILES_MATCHING PATTERN "*.h") set(CPACK_PACKAGE_NAME "Fruit") diff --git a/configuration/CMakeLists.txt b/configuration/CMakeLists.txt index b18a463..11d8445 100644 --- a/configuration/CMakeLists.txt +++ b/configuration/CMakeLists.txt @@ -218,4 +218,4 @@ endif() configure_file(${CMAKE_CURRENT_SOURCE_DIR}/fruit-config-base.h.in ${CMAKE_CURRENT_BINARY_DIR}/../include/fruit/impl/fruit-config-base.h) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/../include/fruit/impl/fruit-config-base.h - DESTINATION ${INSTALL_INCLUDE_DIR}/impl) + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/fruit/impl) diff --git a/extras/packaging/libfruit.spec b/extras/packaging/libfruit.spec index 378abe5..c60b2e0 100644 --- a/extras/packaging/libfruit.spec +++ b/extras/packaging/libfruit.spec @@ -47,8 +47,8 @@ most injection problems at compile-time. %setup -q -n fruit-%{version} %build -cmake -DCMAKE_INSTALL_PREFIX=%{_prefix} -DINSTALL_LIBRARY_DIR=%{_libdir} -DCMAKE_BUILD_TYPE=RelWithDebInfo - +cmake -DCMAKE_INSTALL_PREFIX=%{_prefix} -DCMAKE_INSTALL_LIBDIR=%{_libdir} -DCMAKE_BUILD_TYPE=RelWithDebInfo + %{__make} %{?jobs:-j%jobs} %install diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 66bf79f..0e328cf 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -22,5 +22,6 @@ else() endif() install(TARGETS fruit - ARCHIVE DESTINATION "${INSTALL_LIBRARY_DIR}" - LIBRARY DESTINATION "${INSTALL_LIBRARY_DIR}") + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" + ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}") -- cgit v1.2.3 From b23fa35f7b576a9ed2def3e6487ddd183ed81b4a Mon Sep 17 00:00:00 2001 From: tt4g Date: Sun, 1 Mar 2020 15:44:32 +0900 Subject: Set version argument of project() _VERSION variable is defined by specifying the VERSION argument of project(). This version will automatically propagate to the CPACK_PACKAGE_VERSION variable and so on. --- CMakeLists.txt | 9 ++------- extras/packaging/CMakeLists.txt | 8 ++++---- extras/packaging/PKGBUILD | 2 +- extras/packaging/libfruit.dsc | 6 +++--- extras/packaging/libfruit.spec | 2 +- 5 files changed, 11 insertions(+), 16 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5df3d04..924b89c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,7 @@ -project(Fruit) cmake_minimum_required(VERSION 2.8) +project(Fruit VERSION 3.4.0 LANGUAGES CXX) + if (POLICY CMP0054) cmake_policy(SET CMP0054 NEW) endif() @@ -92,8 +93,6 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR}/include) include(GNUInstallDirs) -set(FRUIT_VERSION "3.4.0") - add_subdirectory(configuration) add_subdirectory(src) @@ -115,8 +114,4 @@ install(DIRECTORY include/fruit/ set(CPACK_PACKAGE_NAME "Fruit") set(CPACK_PACKAGE_VENDOR "Marco Poletti") set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Fruit - Dependency Injection Framework For C++") -string(REGEX REPLACE "([^.]*)\\.([^.]*)\\.([^.]*)" "\\1" CPACK_PACKAGE_VERSION_MAJOR "${FRUIT_VERSION}") -string(REGEX REPLACE "([^.]*)\\.([^.]*)\\.([^.]*)" "\\2" CPACK_PACKAGE_VERSION_MINOR "${FRUIT_VERSION}") -string(REGEX REPLACE "([^.]*)\\.([^.]*)\\.([^.]*)" "\\3" CPACK_PACKAGE_VERSION_PATCH "${FRUIT_VERSION}") -set(CPACK_PACKAGE_VERSION "${FRUIT_VERSION}") set(CPACK_PACKAGE_INSTALL_DIRECTORY "Fruit") diff --git a/extras/packaging/CMakeLists.txt b/extras/packaging/CMakeLists.txt index 7592bf0..09eb4d0 100644 --- a/extras/packaging/CMakeLists.txt +++ b/extras/packaging/CMakeLists.txt @@ -8,7 +8,7 @@ libfruit.install libfruit.spec ) -# This places configured files (build files with @FRUIT_VERSION@ replaced) in build/extras/packaging/built +# This places configured files (build files with @Fruit_VERSION@ replaced) in build/extras/packaging/built foreach(F ${PACKAGING_FILES}) configure_file(${F} built/${F} @ONLY) @@ -16,9 +16,9 @@ endforeach(F) configure_file(PKGBUILD PKGBUILD-template @ONLY) -add_custom_target(fruit-${FRUIT_VERSION}.tar.gz ALL +add_custom_target(fruit-${Fruit_VERSION}.tar.gz ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/PKGBUILD-template WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../.. - COMMAND git archive -o ${CMAKE_CURRENT_BINARY_DIR}/built/fruit-${FRUIT_VERSION}.tar.gz --prefix=fruit-${FRUIT_VERSION}/ HEAD - COMMAND md5sum ${CMAKE_CURRENT_BINARY_DIR}/built/fruit-${FRUIT_VERSION}.tar.gz | awk '{print $$1}' >${CMAKE_CURRENT_BINARY_DIR}/tarball-md5 + COMMAND git archive -o ${CMAKE_CURRENT_BINARY_DIR}/built/fruit-${Fruit_VERSION}.tar.gz --prefix=fruit-${Fruit_VERSION}/ HEAD + COMMAND md5sum ${CMAKE_CURRENT_BINARY_DIR}/built/fruit-${Fruit_VERSION}.tar.gz | awk '{print $$1}' >${CMAKE_CURRENT_BINARY_DIR}/tarball-md5 COMMAND sed "\"s/.*md5sums.*/md5sums=(`cat" "${CMAKE_CURRENT_BINARY_DIR}/tarball-md5`)/\"" <${CMAKE_CURRENT_BINARY_DIR}/PKGBUILD-template >${CMAKE_CURRENT_BINARY_DIR}/built/PKGBUILD) diff --git a/extras/packaging/PKGBUILD b/extras/packaging/PKGBUILD index b7b06cc..6f68971 100644 --- a/extras/packaging/PKGBUILD +++ b/extras/packaging/PKGBUILD @@ -1,6 +1,6 @@ # Maintainer: Marco Poletti pkgname=libfruit -pkgver=@FRUIT_VERSION@ +pkgver=@Fruit_VERSION@ pkgrel=0 pkgdesc="Fruit is a dependency injection framework for C++." url="https://github.com/google/fruit" diff --git a/extras/packaging/libfruit.dsc b/extras/packaging/libfruit.dsc index 07bd92e..8b58a26 100644 --- a/extras/packaging/libfruit.dsc +++ b/extras/packaging/libfruit.dsc @@ -1,10 +1,10 @@ Format: 1.0 Source: libfruit -Version: @FRUIT_VERSION@-0 +Version: @Fruit_VERSION@-0 Binary: libfruit Maintainer: Marco Poletti Architecture: any Build-Depends: debhelper (>= 4.1.16), cmake, libboost-dev, gcc (>= 4:5.0.0) Files: - d57283ebb8157ae919762c58419353c8 133282 libfruit_@FRUIT_VERSION@.orig.tar.gz - 2fecf324a32123b08cefc0f047bca5ee 63176 libfruit_@FRUIT_VERSION@-0.diff.tar.gz \ No newline at end of file + d57283ebb8157ae919762c58419353c8 133282 libfruit_@Fruit_VERSION@.orig.tar.gz + 2fecf324a32123b08cefc0f047bca5ee 63176 libfruit_@Fruit_VERSION@-0.diff.tar.gz diff --git a/extras/packaging/libfruit.spec b/extras/packaging/libfruit.spec index c60b2e0..dc63192 100644 --- a/extras/packaging/libfruit.spec +++ b/extras/packaging/libfruit.spec @@ -3,7 +3,7 @@ # Name: libfruit -Version: @FRUIT_VERSION@ +Version: @Fruit_VERSION@ Release: 0 Summary: Dependency Injection Framework For C++ License: Apache-2.0 -- cgit v1.2.3 From e13b351ec8325be768d30a3a52b45609e051f867 Mon Sep 17 00:00:00 2001 From: tt4g Date: Mon, 2 Mar 2020 09:40:28 +0900 Subject: Update cmake_minimum_required --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 924b89c..9dfd081 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 3.2) project(Fruit VERSION 3.4.0 LANGUAGES CXX) -- cgit v1.2.3 From 009c7aa883bf3a6552078cab0634ed38f581833e Mon Sep 17 00:00:00 2001 From: tt4g Date: Mon, 2 Mar 2020 11:01:57 +0900 Subject: Fix missing shared library on Windows OS --- conanfile.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/conanfile.py b/conanfile.py index 46bd1ce..cff46a5 100644 --- a/conanfile.py +++ b/conanfile.py @@ -76,5 +76,4 @@ conan_basic_setup()''') src=self._source_subfolder) def package_info(self): - self.cpp_info.includedirs = ["include"] - self.cpp_info.libs = ["fruit"] + self.cpp_info.libs = tools.collect_libs(self) -- cgit v1.2.3 From 0cecdd8a5155f3e2ba4871f1792bd1ac641aa62a Mon Sep 17 00:00:00 2001 From: tt4g Date: Sun, 1 Mar 2020 16:18:27 +0900 Subject: Don't add extra targets when building with Conan CMake directories examples, tests, and extras do not need to be built because they are not installed by Conan. --- CMakeLists.txt | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9dfd081..1219c6a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -96,16 +96,18 @@ include(GNUInstallDirs) add_subdirectory(configuration) add_subdirectory(src) -if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") - # Do not exclude these from "make all" in debug mode, they must build. - add_subdirectory(examples) - add_subdirectory(tests) -else() - add_subdirectory(examples EXCLUDE_FROM_ALL) - add_subdirectory(tests) -endif() +if(NOT "${FRUIT_IS_BEING_BUILT_BY_CONAN}") + if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") + # Do not exclude these from "make all" in debug mode, they must build. + add_subdirectory(examples) + add_subdirectory(tests) + else() + add_subdirectory(examples EXCLUDE_FROM_ALL) + add_subdirectory(tests) + endif() -add_subdirectory(extras EXCLUDE_FROM_ALL) + add_subdirectory(extras EXCLUDE_FROM_ALL) +endif() install(DIRECTORY include/fruit/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/fruit -- cgit v1.2.3 From a8d9378a0e1d057c84d19b2bf8dd6f7722d6ab15 Mon Sep 17 00:00:00 2001 From: tt4g Date: Mon, 2 Mar 2020 15:08:10 +0900 Subject: Use build_requirements() --- conanfile.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/conanfile.py b/conanfile.py index cff46a5..aea1b50 100644 --- a/conanfile.py +++ b/conanfile.py @@ -32,9 +32,9 @@ class FruitConan(ConanFile): self.settings.compiler.version, min_version)) - def requirements(self): + def build_requirements(self): if self.options.use_boost: - self.requires("boost/1.68.0@conan/stable") + self.build_requires("boost/1.68.0@conan/stable") def source(self): tools.get("{0}/archive/v{1}.tar.gz".format(self.homepage, self.version)) -- cgit v1.2.3 From 126521043698492351473220b47c4d28088f97f7 Mon Sep 17 00:00:00 2001 From: tt4g Date: Fri, 6 Mar 2020 13:31:40 +0900 Subject: Use find_package(Boost) Modern CMake uses find_package command to find libraries from the system. `BOOST_DIR` no longer works. Use `Boost_INCLUDE_DIR` instead. --- CMakeLists.txt | 11 ++++++----- CONTRIBUTING.md | 10 +++++----- appveyor.yml | 4 ++-- conanfile.py | 26 ++++++++++++++------------ tests/CMakeLists.txt | 2 +- 5 files changed, 28 insertions(+), 25 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1219c6a..c9154a7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -57,12 +57,13 @@ set(FRUIT_USES_BOOST TRUE CACHE BOOL set(FRUIT_IS_BEING_BUILT_BY_CONAN FALSE CACHE BOOL "This is set in Conan builds.") -if("${WIN32}" AND "${FRUIT_USES_BOOST}" AND NOT "${FRUIT_IS_BEING_BUILT_BY_CONAN}") - set(BOOST_DIR "" CACHE PATH "The directory where the boost library is installed, e.g. C:\\boost\\boost_1_62_0.") - if("${BOOST_DIR}" STREQUAL "") - message(FATAL_ERROR "Please re-run CMake, specifying the boost library path as BOOST_DIR, e.g. -DBOOST_DIR=C:\\boost\\boost_1_62_0, or specify -DFRUIT_USES_BOOST=False to not use boost.") +if(${FRUIT_USES_BOOST}) + find_package(Boost) + if(Boost_FOUND) + include_directories(${Boost_INCLUDE_DIRS}) + else() + message(FATAL_ERROR "Please re-run CMake, specifying the boost library path as Boost_INCLUDE_DIR, e.g. -DBoost_INCLUDE_DIR=C:\\boost\\boost_1_62_0, or specify -DFRUIT_USES_BOOST=False to not use boost.") endif() - include_directories("${BOOST_DIR}") endif() set(RUN_TESTS_UNDER_VALGRIND FALSE CACHE BOOL "Whether to run Fruit tests under valgrind") diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 89a3fca..8d9170f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -108,7 +108,7 @@ For example, if you installed Boost in `C:\boost\boost_1_62_0`, you can put this "generator": "Visual Studio 15 2017", "configurationType": "Debug", "buildRoot": "${env.LOCALAPPDATA}\\CMakeBuild\\${workspaceHash}\\build\\${name}", - "cmakeCommandArgs": "-DBOOST_DIR=C:\\boost\\boost_1_62_0 -DCMAKE_BUILD_TYPE=Debug -DFRUIT_ADDITIONAL_CXX_FLAGS=/Z7", + "cmakeCommandArgs": "-DBoost_INCLUDE_DIR=C:\\boost\\boost_1_62_0 -DCMAKE_BUILD_TYPE=Debug -DFRUIT_ADDITIONAL_CXX_FLAGS=/Z7", "buildCommandArgs": "-m -v:minimal" }, { @@ -116,7 +116,7 @@ For example, if you installed Boost in `C:\boost\boost_1_62_0`, you can put this "generator": "Visual Studio 15 2017", "configurationType": "Release", "buildRoot": "${env.LOCALAPPDATA}\\CMakeBuild\\${workspaceHash}\\build\\${name}", - "cmakeCommandArgs": "-DBOOST_DIR=C:\\boost\\boost_1_62_0 -DCMAKE_BUILD_TYPE=Release", + "cmakeCommandArgs": "-DBoost_INCLUDE_DIR=C:\\boost\\boost_1_62_0 -DCMAKE_BUILD_TYPE=Release", "buildCommandArgs": "-m -v:minimal" }, { @@ -124,7 +124,7 @@ For example, if you installed Boost in `C:\boost\boost_1_62_0`, you can put this "generator": "Visual Studio 15 2017 Win64", "configurationType": "Debug", "buildRoot": "${env.LOCALAPPDATA}\\CMakeBuild\\${workspaceHash}\\build\\${name}", - "cmakeCommandArgs": "-DBOOST_DIR=C:\\boost\\boost_1_62_0 -DCMAKE_BUILD_TYPE=Debug -DFRUIT_ADDITIONAL_CXX_FLAGS=/Z7", + "cmakeCommandArgs": "-DBoost_INCLUDE_DIR=C:\\boost\\boost_1_62_0 -DCMAKE_BUILD_TYPE=Debug -DFRUIT_ADDITIONAL_CXX_FLAGS=/Z7", "buildCommandArgs": "-m -v:minimal" }, { @@ -132,7 +132,7 @@ For example, if you installed Boost in `C:\boost\boost_1_62_0`, you can put this "generator": "Visual Studio 15 2017 Win64", "configurationType": "Release", "buildRoot": "${env.LOCALAPPDATA}\\CMakeBuild\\${workspaceHash}\\build\\${name}", - "cmakeCommandArgs": "-DBOOST_DIR=C:\\boost\\boost_1_62_0 -DCMAKE_BUILD_TYPE=Release", + "cmakeCommandArgs": "-DBoost_INCLUDE_DIR=C:\\boost\\boost_1_62_0 -DCMAKE_BUILD_TYPE=Release", "buildCommandArgs": "-m -v:minimal" } ] @@ -140,7 +140,7 @@ For example, if you installed Boost in `C:\boost\boost_1_62_0`, you can put this The `/Z7` flag instructs Visual Studio to use the C7 format for debugging information, which allows Fruit's tests to run in parallel without interfering with each other. -If you don't want to use Boost, you can replace the `-DBOOST_DIR=...` flags above with `-DFRUIT_USES_BOOST=False`. +If you don't want to use Boost, you can replace the `-DBoost_INCLUDE_DIR=...` flags above with `-DFRUIT_USES_BOOST=False`. You can now run CMake within Visual Studio (from the menu: CMake -> Cache -> Generate -> CMakeLists.txt) and build Fruit (from the menu: CMake -> Build All). diff --git a/appveyor.yml b/appveyor.yml index bc9a449..10aa397 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -30,7 +30,7 @@ environment: MINGW_PATH: 'C:\mingw-w64\x86_64-7.2.0-posix-seh-rt_v5-rev1\mingw64\bin' CMAKE_GENERATOR: 'MinGW Makefiles' VCVARSALL_DIR: '' - ADDITIONAL_CMAKE_ARGS: '-DBOOST_DIR=C:\Libraries\boost_1_64_0 -DCMAKE_CXX_FLAGS="-Werror"' + ADDITIONAL_CMAKE_ARGS: '-DBoost_INCLUDE_DIR=C:\Libraries\boost_1_64_0 -DCMAKE_CXX_FLAGS="-Werror"' CONFIGURATION: Release - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 CMAKE_GENERATOR: 'Visual Studio 15 2017 Win64' @@ -46,7 +46,7 @@ environment: MINGW_PATH: 'C:\mingw-w64\x86_64-7.2.0-posix-seh-rt_v5-rev1\mingw64\bin' CMAKE_GENERATOR: 'MinGW Makefiles' VCVARSALL_DIR: '' - ADDITIONAL_CMAKE_ARGS: '-DBOOST_DIR=C:\Libraries\boost_1_64_0 -DBUILD_SHARED_LIBS=False -DCMAKE_CXX_FLAGS="-Werror"' + ADDITIONAL_CMAKE_ARGS: '-DBoost_INCLUDE_DIR=C:\Libraries\boost_1_64_0 -DBUILD_SHARED_LIBS=False -DCMAKE_CXX_FLAGS="-Werror"' CONFIGURATION: Release - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 CMAKE_GENERATOR: 'Visual Studio 15 2017 Win64' diff --git a/conanfile.py b/conanfile.py index aea1b50..203372b 100644 --- a/conanfile.py +++ b/conanfile.py @@ -16,6 +16,7 @@ class FruitConan(ConanFile): generators = "cmake" exports = "COPYING" _source_subfolder = "source_subfolder" + _cmake = None def configure(self): min_version = { @@ -50,19 +51,20 @@ include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup()''') def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["FRUIT_IS_BEING_BUILT_BY_CONAN"] = "YES" - cmake.definitions["BUILD_SHARED_LIBS"] = "YES" if self.options.shared else "NO" - if self.options.use_boost: + if not self._cmake: + self._cmake = CMake(self) + self._cmake.definitions["FRUIT_IS_BEING_BUILT_BY_CONAN"] = "YES" + self._cmake.definitions["BUILD_SHARED_LIBS"] = "YES" if self.options.shared else "NO" + self._cmake.definitions["FRUIT_USES_BOOST"] = self.options.use_boost + if self.options.use_boost: + self._cmake.definitions["Boost_INCLUDE_DIR"] = os.path.join( + self.deps_cpp_info["boost"].rootpath, "include") if self.settings.os == "Windows": - cmake.definitions["BOOST_DIR"] = "." - else: - cmake.definitions["FRUIT_USES_BOOST"] = "NO" - if self.settings.os == "Windows": - cmake.definitions["FRUIT_TESTS_USE_PRECOMPILED_HEADERS"] = "NO" - cmake.definitions["CMAKE_BUILD_TYPE"] = self.settings.build_type - cmake.configure(source_folder=self._source_subfolder) - return cmake + self._cmake.definitions["FRUIT_TESTS_USE_PRECOMPILED_HEADERS"] = "NO" + self._cmake.definitions["CMAKE_BUILD_TYPE"] = self.settings.build_type + self._cmake.configure(source_folder=self._source_subfolder) + + return self._cmake def build(self): cmake = self._configure_cmake() diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index d543dca..6444023 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -87,7 +87,7 @@ CXX='${CMAKE_CXX_COMPILER}' CXX_COMPILER_NAME='${CMAKE_CXX_COMPILER_ID}' CXX_COMPILER_VERSION='${CMAKE_CXX_COMPILER_VERSION}' FRUIT_COMPILE_FLAGS='${FRUIT_COMPILE_FLAGS} ${FRUIT_TESTONLY_CXXFLAGS}' -ADDITIONAL_INCLUDE_DIRS='${BOOST_DIR}' +ADDITIONAL_INCLUDE_DIRS='${Boost_INCLUDE_DIRS}' ADDITIONAL_LINKER_FLAGS='${CMAKE_EXE_LINKER_FLAGS}' RUN_TESTS_UNDER_VALGRIND='${RUN_TESTS_UNDER_VALGRIND_FLAG}' VALGRIND_FLAGS='${VALGRIND_FLAGS_STR}' -- cgit v1.2.3 From 86df2d1718aa049cb836fa4e7c7304eaa142b3f9 Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sat, 7 Mar 2020 17:21:46 -0800 Subject: Remove extras/bazel_root/third_party/fruit/build, that causes errors when unpacking the Fruit archive on Windows due to case-insensitive names (since there's also a extras/bazel_root/third_party/fruit/BUILD file). --- extras/bazel_root/third_party/fruit/build | 1 - 1 file changed, 1 deletion(-) delete mode 120000 extras/bazel_root/third_party/fruit/build diff --git a/extras/bazel_root/third_party/fruit/build b/extras/bazel_root/third_party/fruit/build deleted file mode 120000 index 388dc92..0000000 --- a/extras/bazel_root/third_party/fruit/build +++ /dev/null @@ -1 +0,0 @@ -../../../../BUILD \ No newline at end of file -- cgit v1.2.3 From e85c88edfcdf67faf8209a3ff2f6b3193f532e1c Mon Sep 17 00:00:00 2001 From: tt4g Date: Sat, 7 Mar 2020 12:46:03 +0900 Subject: Set CMAKE_CXX_STANDARD 11 --- CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1219c6a..149d6c5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,6 +6,9 @@ if (POLICY CMP0054) cmake_policy(SET CMP0054 NEW) endif() +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + # CMake on OSX likes to see this set explicitly, otherwise it outputs a warning. set(CMAKE_MACOSX_RPATH 1) -- cgit v1.2.3 From 17c56a6657842f87e70d17c7a330de59f7f1ec15 Mon Sep 17 00:00:00 2001 From: tt4g Date: Sun, 8 Mar 2020 11:20:37 +0900 Subject: Support BOOST_DIR --- CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index c9154a7..f918cc9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -58,6 +58,12 @@ set(FRUIT_USES_BOOST TRUE CACHE BOOL set(FRUIT_IS_BEING_BUILT_BY_CONAN FALSE CACHE BOOL "This is set in Conan builds.") if(${FRUIT_USES_BOOST}) + + if(DEFINED BOOST_DIR) + message("BOOST_DIR is deprecated. Use Boost_INCLUDE_DIR instead.") + set(Boost_INCLUDE_DIR "${BOOST_DIR}" CACHE PATH "") + endif() + find_package(Boost) if(Boost_FOUND) include_directories(${Boost_INCLUDE_DIRS}) -- cgit v1.2.3 From c1d802a4a054438614fa90bb5d419c110d4324e2 Mon Sep 17 00:00:00 2001 From: tt4g Date: Sun, 8 Mar 2020 12:45:03 +0900 Subject: Update BOOST_DIR deprecation message --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f918cc9..fa68336 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -60,7 +60,7 @@ set(FRUIT_IS_BEING_BUILT_BY_CONAN FALSE CACHE BOOL "This is set in Conan builds. if(${FRUIT_USES_BOOST}) if(DEFINED BOOST_DIR) - message("BOOST_DIR is deprecated. Use Boost_INCLUDE_DIR instead.") + message(DEPRECATION "BOOST_DIR is deprecated. Use Boost_INCLUDE_DIR instead.") set(Boost_INCLUDE_DIR "${BOOST_DIR}" CACHE PATH "") endif() -- cgit v1.2.3 From ff48522def02df6de465c76658bab8c8b8b155fe Mon Sep 17 00:00:00 2001 From: tt4g Date: Fri, 6 Mar 2020 21:10:32 +0900 Subject: Fix conan tools.replace_in_file() patch --- conanfile.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/conanfile.py b/conanfile.py index aea1b50..7e2bb5d 100644 --- a/conanfile.py +++ b/conanfile.py @@ -43,11 +43,12 @@ class FruitConan(ConanFile): # This small hack might be useful to guarantee proper /MT /MD linkage # in MSVC if the packaged project doesn't have variables to set it # properly + cmake_project = "project(Fruit VERSION %s LANGUAGES CXX)" % (self.version,) tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), - "project(Fruit)", - '''PROJECT(Myfruit) + cmake_project, + (cmake_project + ''' include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup()''') +conan_basic_setup()''')) def _configure_cmake(self): cmake = CMake(self) -- cgit v1.2.3 From 7d72dce02a7236b42811ec986086df109522f1c3 Mon Sep 17 00:00:00 2001 From: tt4g Date: Sun, 8 Mar 2020 11:42:12 +0900 Subject: Remove conans.tools.replace_in_file() --- CMakeLists.txt | 8 ++++++-- conanfile.py | 9 --------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 149d6c5..b357c1c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,12 @@ cmake_minimum_required(VERSION 3.2) project(Fruit VERSION 3.4.0 LANGUAGES CXX) +set(FRUIT_IS_BEING_BUILT_BY_CONAN FALSE CACHE BOOL "This is set in Conan builds.") +if("${FRUIT_IS_BEING_BUILT_BY_CONAN}") + include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) + conan_basic_setup() +endif() + if (POLICY CMP0054) cmake_policy(SET CMP0054 NEW) endif() @@ -58,8 +64,6 @@ set(FRUIT_USES_BOOST TRUE CACHE BOOL "Whether to use Boost (specifically, boost::unordered_set and boost::unordered_map). If this is false, Fruit will use std::unordered_set and std::unordered_map instead (however this causes injection to be a bit slower).") -set(FRUIT_IS_BEING_BUILT_BY_CONAN FALSE CACHE BOOL "This is set in Conan builds.") - if("${WIN32}" AND "${FRUIT_USES_BOOST}" AND NOT "${FRUIT_IS_BEING_BUILT_BY_CONAN}") set(BOOST_DIR "" CACHE PATH "The directory where the boost library is installed, e.g. C:\\boost\\boost_1_62_0.") if("${BOOST_DIR}" STREQUAL "") diff --git a/conanfile.py b/conanfile.py index 7e2bb5d..d5ebdaf 100644 --- a/conanfile.py +++ b/conanfile.py @@ -40,15 +40,6 @@ class FruitConan(ConanFile): tools.get("{0}/archive/v{1}.tar.gz".format(self.homepage, self.version)) extracted_dir = self.name + "-" + self.version os.rename(extracted_dir, self._source_subfolder) - # This small hack might be useful to guarantee proper /MT /MD linkage - # in MSVC if the packaged project doesn't have variables to set it - # properly - cmake_project = "project(Fruit VERSION %s LANGUAGES CXX)" % (self.version,) - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), - cmake_project, - (cmake_project + ''' -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup()''')) def _configure_cmake(self): cmake = CMake(self) -- cgit v1.2.3 From 2a69ef6c302a3057153972f2464de6f6ce4b2989 Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sun, 8 Mar 2020 10:32:28 -0700 Subject: Reorder Appveyor tests, putting currently-failing tests first (to save time when re-running after the next commits). --- appveyor.yml | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 10aa397..42a227d 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -13,13 +13,33 @@ environment: VCVARSALL_DIR: 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build' ADDITIONAL_CMAKE_ARGS: '-DFRUIT_USES_BOOST=False -DCMAKE_CXX_FLAGS="/WX /DFRUIT_DEBUG /DFRUIT_EXTRA_DEBUG /D_ITERATOR_DEBUG_LEVEL=2" -T host=x64' CONFIGURATION: Debug + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 + CMAKE_GENERATOR: 'Visual Studio 15 2017 Win64' + VCVARSALL_DIR: 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build' + ADDITIONAL_CMAKE_ARGS: '-DFRUIT_USES_BOOST=False -DCMAKE_CXX_FLAGS="/WX" -T host=x64' + CONFIGURATION: Release + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 + CMAKE_GENERATOR: 'Visual Studio 14 2015 Win64' + VCVARSALL_DIR: 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC' + ADDITIONAL_CMAKE_ARGS: '-DFRUIT_USES_BOOST=False -DCMAKE_CXX_FLAGS="/WX" -T host=x64' + CONFIGURATION: Release + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 + CMAKE_GENERATOR: 'Visual Studio 15 2017 Win64' + VCVARSALL_DIR: 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build' + ADDITIONAL_CMAKE_ARGS: '-DFRUIT_USES_BOOST=False -DBUILD_SHARED_LIBS=False -DCMAKE_CXX_FLAGS="/WX" -T host=x64' + CONFIGURATION: Release + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 + CMAKE_GENERATOR: 'Visual Studio 14 2015 Win64' + VCVARSALL_DIR: 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC' + ADDITIONAL_CMAKE_ARGS: '-DFRUIT_USES_BOOST=False -DBUILD_SHARED_LIBS=False -DCMAKE_CXX_FLAGS="/WX" -T host=x64' + CONFIGURATION: Release + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 MINGW_PATH: 'C:\mingw-w64\x86_64-7.2.0-posix-seh-rt_v5-rev1\mingw64\bin' CMAKE_GENERATOR: 'MinGW Makefiles' VCVARSALL_DIR: '' ADDITIONAL_CMAKE_ARGS: '-DFRUIT_USES_BOOST=False -DCMAKE_CXX_FLAGS="-Werror -DFRUIT_DEBUG=1 -DFRUIT_EXTRA_DEBUG=1 -D_GLIBCXX_DEBUG=1"' CONFIGURATION: Debug - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 MINGW_PATH: 'C:\mingw-w64\x86_64-7.2.0-posix-seh-rt_v5-rev1\mingw64\bin' CMAKE_GENERATOR: 'MinGW Makefiles' @@ -32,31 +52,11 @@ environment: VCVARSALL_DIR: '' ADDITIONAL_CMAKE_ARGS: '-DBoost_INCLUDE_DIR=C:\Libraries\boost_1_64_0 -DCMAKE_CXX_FLAGS="-Werror"' CONFIGURATION: Release - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 - CMAKE_GENERATOR: 'Visual Studio 15 2017 Win64' - VCVARSALL_DIR: 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build' - ADDITIONAL_CMAKE_ARGS: '-DFRUIT_USES_BOOST=False -DCMAKE_CXX_FLAGS="/WX" -T host=x64' - CONFIGURATION: Release - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - CMAKE_GENERATOR: 'Visual Studio 14 2015 Win64' - VCVARSALL_DIR: 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC' - ADDITIONAL_CMAKE_ARGS: '-DFRUIT_USES_BOOST=False -DCMAKE_CXX_FLAGS="/WX" -T host=x64' - CONFIGURATION: Release - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 MINGW_PATH: 'C:\mingw-w64\x86_64-7.2.0-posix-seh-rt_v5-rev1\mingw64\bin' CMAKE_GENERATOR: 'MinGW Makefiles' VCVARSALL_DIR: '' ADDITIONAL_CMAKE_ARGS: '-DBoost_INCLUDE_DIR=C:\Libraries\boost_1_64_0 -DBUILD_SHARED_LIBS=False -DCMAKE_CXX_FLAGS="-Werror"' CONFIGURATION: Release - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 - CMAKE_GENERATOR: 'Visual Studio 15 2017 Win64' - VCVARSALL_DIR: 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build' - ADDITIONAL_CMAKE_ARGS: '-DFRUIT_USES_BOOST=False -DBUILD_SHARED_LIBS=False -DCMAKE_CXX_FLAGS="/WX" -T host=x64' - CONFIGURATION: Release - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - CMAKE_GENERATOR: 'Visual Studio 14 2015 Win64' - VCVARSALL_DIR: 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC' - ADDITIONAL_CMAKE_ARGS: '-DFRUIT_USES_BOOST=False -DBUILD_SHARED_LIBS=False -DCMAKE_CXX_FLAGS="/WX" -T host=x64' - CONFIGURATION: Release build_script: - cmd: cmd /c C:\Fruit\extras\scripts\postsubmit.bat -- cgit v1.2.3 From 9feb2e6e139cf361327dfdf120733123f7947193 Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sun, 8 Mar 2020 10:37:45 -0700 Subject: Add Visual Studio 2019 to the Appveyor CI config. --- appveyor.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/appveyor.yml b/appveyor.yml index 42a227d..6c6e594 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -3,6 +3,11 @@ clone_folder: C:\Fruit environment: PYTHON3_PATH: C:\Python36 matrix: + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 + CMAKE_GENERATOR: 'Visual Studio 16 2019 Win64' + VCVARSALL_DIR: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build' + ADDITIONAL_CMAKE_ARGS: '-DFRUIT_USES_BOOST=False -DCMAKE_CXX_FLAGS="/WX /DFRUIT_DEBUG /DFRUIT_EXTRA_DEBUG /D_ITERATOR_DEBUG_LEVEL=2" -T host=x64' + CONFIGURATION: Debug - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 CMAKE_GENERATOR: 'Visual Studio 14 2015 Win64' VCVARSALL_DIR: 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC' @@ -13,6 +18,11 @@ environment: VCVARSALL_DIR: 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build' ADDITIONAL_CMAKE_ARGS: '-DFRUIT_USES_BOOST=False -DCMAKE_CXX_FLAGS="/WX /DFRUIT_DEBUG /DFRUIT_EXTRA_DEBUG /D_ITERATOR_DEBUG_LEVEL=2" -T host=x64' CONFIGURATION: Debug + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 + CMAKE_GENERATOR: 'Visual Studio 15 2017 Win64' + VCVARSALL_DIR: 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build' + ADDITIONAL_CMAKE_ARGS: '-DFRUIT_USES_BOOST=False -DCMAKE_CXX_FLAGS="/WX" -T host=x64' + CONFIGURATION: Release - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 CMAKE_GENERATOR: 'Visual Studio 15 2017 Win64' VCVARSALL_DIR: 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build' @@ -23,6 +33,11 @@ environment: VCVARSALL_DIR: 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC' ADDITIONAL_CMAKE_ARGS: '-DFRUIT_USES_BOOST=False -DCMAKE_CXX_FLAGS="/WX" -T host=x64' CONFIGURATION: Release + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 + CMAKE_GENERATOR: 'Visual Studio 15 2017 Win64' + VCVARSALL_DIR: 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build' + ADDITIONAL_CMAKE_ARGS: '-DFRUIT_USES_BOOST=False -DBUILD_SHARED_LIBS=False -DCMAKE_CXX_FLAGS="/WX" -T host=x64' + CONFIGURATION: Release - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 CMAKE_GENERATOR: 'Visual Studio 15 2017 Win64' VCVARSALL_DIR: 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build' -- cgit v1.2.3 From 987068416ff606121b8c6fca637ba23c4ee271c2 Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sun, 8 Mar 2020 10:38:32 -0700 Subject: Test against Boost 1.69 in Appveyor (last version available in images with Mingw). --- appveyor.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 6c6e594..bde2a94 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -65,13 +65,13 @@ environment: MINGW_PATH: 'C:\mingw-w64\x86_64-7.2.0-posix-seh-rt_v5-rev1\mingw64\bin' CMAKE_GENERATOR: 'MinGW Makefiles' VCVARSALL_DIR: '' - ADDITIONAL_CMAKE_ARGS: '-DBoost_INCLUDE_DIR=C:\Libraries\boost_1_64_0 -DCMAKE_CXX_FLAGS="-Werror"' + ADDITIONAL_CMAKE_ARGS: '-DBoost_INCLUDE_DIR=C:\Libraries\boost_1_69_0 -DCMAKE_CXX_FLAGS="-Werror"' CONFIGURATION: Release - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 MINGW_PATH: 'C:\mingw-w64\x86_64-7.2.0-posix-seh-rt_v5-rev1\mingw64\bin' CMAKE_GENERATOR: 'MinGW Makefiles' VCVARSALL_DIR: '' - ADDITIONAL_CMAKE_ARGS: '-DBoost_INCLUDE_DIR=C:\Libraries\boost_1_64_0 -DBUILD_SHARED_LIBS=False -DCMAKE_CXX_FLAGS="-Werror"' + ADDITIONAL_CMAKE_ARGS: '-DBoost_INCLUDE_DIR=C:\Libraries\boost_1_69_0 -DBUILD_SHARED_LIBS=False -DCMAKE_CXX_FLAGS="-Werror"' CONFIGURATION: Release build_script: - cmd: cmd /c C:\Fruit\extras\scripts\postsubmit.bat -- cgit v1.2.3 From b6d78adfbceb66b621f0f9949a3a392bcc1d780c Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sun, 8 Mar 2020 10:53:49 -0700 Subject: Don't upgrade postgis and its transitive deps in OS X CI builds, it takes too long. --- extras/scripts/travis_ci_install_osx.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/extras/scripts/travis_ci_install_osx.sh b/extras/scripts/travis_ci_install_osx.sh index bb877be..905b2e0 100755 --- a/extras/scripts/travis_ci_install_osx.sh +++ b/extras/scripts/travis_ci_install_osx.sh @@ -2,6 +2,10 @@ set -e +# This package has lots of transitive deps, upgrading this takes a lot of time, slowing down the CI run or even causing +# timeouts. +brew pin postgis + install_brew_package() { time (brew install "$@" || brew outdated "$1" || brew upgrade "$@") # Some formulas are not linked into /usr/local by default, make sure they are. -- cgit v1.2.3 From c892da645c837319efc52a9c7b8630bdc9aa8fe1 Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sun, 8 Mar 2020 11:03:02 -0700 Subject: Pin more packages to speed up OS X CI runs and avoid timeouts. --- extras/scripts/travis_ci_install_osx.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/extras/scripts/travis_ci_install_osx.sh b/extras/scripts/travis_ci_install_osx.sh index 905b2e0..ce49358 100755 --- a/extras/scripts/travis_ci_install_osx.sh +++ b/extras/scripts/travis_ci_install_osx.sh @@ -2,9 +2,12 @@ set -e -# This package has lots of transitive deps, upgrading this takes a lot of time, slowing down the CI run or even causing -# timeouts. -brew pin postgis +# These packages depend on the ones that we update but we don't care about these, we don't want to waste time upgrading +# them. +for p in postgis ansible libdap libspatialite gdal mercurial poppler +do + brew pin $p +done install_brew_package() { time (brew install "$@" || brew outdated "$1" || brew upgrade "$@") -- cgit v1.2.3 From 515891aaa5e1ba83bdec7a3435fda92365edc8e0 Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sun, 8 Mar 2020 11:06:23 -0700 Subject: Fix CI setup for Visual Studio 2019. --- appveyor.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index bde2a94..2fe6846 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -4,9 +4,9 @@ environment: PYTHON3_PATH: C:\Python36 matrix: - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 - CMAKE_GENERATOR: 'Visual Studio 16 2019 Win64' + CMAKE_GENERATOR: 'Visual Studio 16 2019' VCVARSALL_DIR: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build' - ADDITIONAL_CMAKE_ARGS: '-DFRUIT_USES_BOOST=False -DCMAKE_CXX_FLAGS="/WX /DFRUIT_DEBUG /DFRUIT_EXTRA_DEBUG /D_ITERATOR_DEBUG_LEVEL=2" -T host=x64' + ADDITIONAL_CMAKE_ARGS: '-DFRUIT_USES_BOOST=False -DCMAKE_CXX_FLAGS="/WX /DFRUIT_DEBUG /DFRUIT_EXTRA_DEBUG /D_ITERATOR_DEBUG_LEVEL=2" -T host=x64 -A Win64' CONFIGURATION: Debug - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 CMAKE_GENERATOR: 'Visual Studio 14 2015 Win64' @@ -19,9 +19,9 @@ environment: ADDITIONAL_CMAKE_ARGS: '-DFRUIT_USES_BOOST=False -DCMAKE_CXX_FLAGS="/WX /DFRUIT_DEBUG /DFRUIT_EXTRA_DEBUG /D_ITERATOR_DEBUG_LEVEL=2" -T host=x64' CONFIGURATION: Debug - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 - CMAKE_GENERATOR: 'Visual Studio 15 2017 Win64' - VCVARSALL_DIR: 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build' - ADDITIONAL_CMAKE_ARGS: '-DFRUIT_USES_BOOST=False -DCMAKE_CXX_FLAGS="/WX" -T host=x64' + CMAKE_GENERATOR: 'Visual Studio 16 2019' + VCVARSALL_DIR: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build' + ADDITIONAL_CMAKE_ARGS: '-DFRUIT_USES_BOOST=False -DCMAKE_CXX_FLAGS="/WX" -T host=x64 -A Win64' CONFIGURATION: Release - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 CMAKE_GENERATOR: 'Visual Studio 15 2017 Win64' @@ -34,9 +34,9 @@ environment: ADDITIONAL_CMAKE_ARGS: '-DFRUIT_USES_BOOST=False -DCMAKE_CXX_FLAGS="/WX" -T host=x64' CONFIGURATION: Release - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 - CMAKE_GENERATOR: 'Visual Studio 15 2017 Win64' - VCVARSALL_DIR: 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build' - ADDITIONAL_CMAKE_ARGS: '-DFRUIT_USES_BOOST=False -DBUILD_SHARED_LIBS=False -DCMAKE_CXX_FLAGS="/WX" -T host=x64' + CMAKE_GENERATOR: 'Visual Studio 16 2019' + VCVARSALL_DIR: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build' + ADDITIONAL_CMAKE_ARGS: '-DFRUIT_USES_BOOST=False -DBUILD_SHARED_LIBS=False -DCMAKE_CXX_FLAGS="/WX" -T host=x64 -A Win64' CONFIGURATION: Release - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 CMAKE_GENERATOR: 'Visual Studio 15 2017 Win64' -- cgit v1.2.3 From 90640a101dcd0030a904a06a992f709c84c14bec Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sun, 8 Mar 2020 11:10:50 -0700 Subject: Ignore failure codes from "brew upgrade", it can succeed but exit with a non-0 code. --- extras/scripts/travis_ci_install_osx.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/scripts/travis_ci_install_osx.sh b/extras/scripts/travis_ci_install_osx.sh index ce49358..d616fee 100755 --- a/extras/scripts/travis_ci_install_osx.sh +++ b/extras/scripts/travis_ci_install_osx.sh @@ -10,7 +10,7 @@ do done install_brew_package() { - time (brew install "$@" || brew outdated "$1" || brew upgrade "$@") + time (brew install "$@" || brew outdated "$1" || brew upgrade "$@" || true) # Some formulas are not linked into /usr/local by default, make sure they are. time (brew link --force "$@" || true) } -- cgit v1.2.3 From 78f914f72e477018070e4530edcc6df90829d26c Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sun, 8 Mar 2020 11:14:39 -0700 Subject: Fix the format of a flag in the Windows CI config. --- appveyor.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 2fe6846..74c8c1f 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -6,7 +6,7 @@ environment: - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 CMAKE_GENERATOR: 'Visual Studio 16 2019' VCVARSALL_DIR: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build' - ADDITIONAL_CMAKE_ARGS: '-DFRUIT_USES_BOOST=False -DCMAKE_CXX_FLAGS="/WX /DFRUIT_DEBUG /DFRUIT_EXTRA_DEBUG /D_ITERATOR_DEBUG_LEVEL=2" -T host=x64 -A Win64' + ADDITIONAL_CMAKE_ARGS: '-DFRUIT_USES_BOOST=False -DCMAKE_CXX_FLAGS="/WX /DFRUIT_DEBUG /DFRUIT_EXTRA_DEBUG /D_ITERATOR_DEBUG_LEVEL=2" -T host=x64 -A x64' CONFIGURATION: Debug - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 CMAKE_GENERATOR: 'Visual Studio 14 2015 Win64' @@ -21,7 +21,7 @@ environment: - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 CMAKE_GENERATOR: 'Visual Studio 16 2019' VCVARSALL_DIR: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build' - ADDITIONAL_CMAKE_ARGS: '-DFRUIT_USES_BOOST=False -DCMAKE_CXX_FLAGS="/WX" -T host=x64 -A Win64' + ADDITIONAL_CMAKE_ARGS: '-DFRUIT_USES_BOOST=False -DCMAKE_CXX_FLAGS="/WX" -T host=x64 -A x64' CONFIGURATION: Release - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 CMAKE_GENERATOR: 'Visual Studio 15 2017 Win64' @@ -36,7 +36,7 @@ environment: - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 CMAKE_GENERATOR: 'Visual Studio 16 2019' VCVARSALL_DIR: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build' - ADDITIONAL_CMAKE_ARGS: '-DFRUIT_USES_BOOST=False -DBUILD_SHARED_LIBS=False -DCMAKE_CXX_FLAGS="/WX" -T host=x64 -A Win64' + ADDITIONAL_CMAKE_ARGS: '-DFRUIT_USES_BOOST=False -DBUILD_SHARED_LIBS=False -DCMAKE_CXX_FLAGS="/WX" -T host=x64 -A x64' CONFIGURATION: Release - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 CMAKE_GENERATOR: 'Visual Studio 15 2017 Win64' -- cgit v1.2.3 From 112d3fb2d7c34d13ed1a7cdeda8d146de4490acc Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sun, 8 Mar 2020 11:21:44 -0700 Subject: Unlink python2 in the OS X CI script, so that we can then link python3. --- extras/scripts/travis_ci_install_osx.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/extras/scripts/travis_ci_install_osx.sh b/extras/scripts/travis_ci_install_osx.sh index d616fee..2cbd357 100755 --- a/extras/scripts/travis_ci_install_osx.sh +++ b/extras/scripts/travis_ci_install_osx.sh @@ -53,6 +53,9 @@ clang-9.0) *) echo "Compiler not supported: ${COMPILER}. See travis_ci_install_osx.sh"; exit 1 ;; esac +# So that we can "brew link" python@3 instead. +brew unlink python@2 + install_brew_package boost install_brew_package python time pip3 install absl-py -- cgit v1.2.3 From d2a8b44a8ddbed59f03ca08da63504c0204a4b4e Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Mon, 9 Mar 2020 01:15:59 -0700 Subject: Fix a test expectation to allow MSVC 2019's type name format. --- tests/util/test_type_info.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/util/test_type_info.py b/tests/util/test_type_info.py index b67f197..d433d60 100644 --- a/tests/util/test_type_info.py +++ b/tests/util/test_type_info.py @@ -51,7 +51,7 @@ class TestTypeInfo(parameterized.TestCase): @parameterized.parameters([ ('MyStruct', '{"MyStruct", "struct MyStruct"}'), - ('std::pair', '{"std::pair", "std::__1::pair"}'), + ('std::pair', '{"std::pair", "std::__1::pair", "struct std::pair"}'), ]) def test_name(self, T, Expected): source = ''' -- cgit v1.2.3 From a82ef89c2fa6f50af62a76bf7152a8fbb9cea802 Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Mon, 9 Mar 2020 01:17:22 -0700 Subject: Fix test helpers for MSVC, there was a bug that caused most tests to fail. --- tests/fruit_test_common.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/fruit_test_common.py b/tests/fruit_test_common.py index d4a1308..faae820 100644 --- a/tests/fruit_test_common.py +++ b/tests/fruit_test_common.py @@ -166,7 +166,7 @@ class MsvcCompiler: self._compile(include_dirs, args = args) except CommandFailedException as e: # Note that we use stdout here, unlike above. MSVC reports compilation warnings and errors on stdout. - raise CompilationFailedException(e.command, e.stdout, e.stderr) + raise CompilationFailedException(e.command, e.env, e.stdout) def compile_and_link(self, source, include_dirs, output_file_name, args=[]): self._compile( -- cgit v1.2.3 From 0f4cd2c7305356b069a3499032b2e9d396d02b72 Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Mon, 9 Mar 2020 01:17:52 -0700 Subject: Remove a redundant line from testing code. --- tests/fruit_test_common.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/fruit_test_common.py b/tests/fruit_test_common.py index faae820..064dc82 100644 --- a/tests/fruit_test_common.py +++ b/tests/fruit_test_common.py @@ -298,7 +298,6 @@ def expect_compile_error_helper( error_message = e.error_message error_message_lines = error_message.splitlines() - error_message_lines = error_message.splitlines() error_message_head = _cap_to_lines(error_message, 40) check_error_fun(e, error_message_lines, error_message_head) -- cgit v1.2.3 From 0427ec43330720c7f1a7211c60c156527ad0e0d5 Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Mon, 9 Mar 2020 01:20:10 -0700 Subject: Add the default Visual Studio build dir name to .gitignore. --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 128e3cd..4370085 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,4 @@ bench_results /*.vcxproj.filters /CMakeSettings.json /*.vcxproj.user +/out/build/x64-Debug -- cgit v1.2.3 From fa3726d52c490321f3c0ef10935dce0497e8f83c Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Mon, 9 Mar 2020 01:25:42 -0700 Subject: Update the Windows instructions in CONTRIBUTING.md to work with MSVC 2019. --- CONTRIBUTING.md | 46 +++++++++++++++++----------------------------- 1 file changed, 17 insertions(+), 29 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8d9170f..83bb23a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -104,37 +104,24 @@ For example, if you installed Boost in `C:\boost\boost_1_62_0`, you can put this // See https://go.microsoft.com//fwlink//?linkid=834763 for more information about this file. "configurations": [ { - "name": "x86-Debug", - "generator": "Visual Studio 15 2017", - "configurationType": "Debug", - "buildRoot": "${env.LOCALAPPDATA}\\CMakeBuild\\${workspaceHash}\\build\\${name}", - "cmakeCommandArgs": "-DBoost_INCLUDE_DIR=C:\\boost\\boost_1_62_0 -DCMAKE_BUILD_TYPE=Debug -DFRUIT_ADDITIONAL_CXX_FLAGS=/Z7", - "buildCommandArgs": "-m -v:minimal" + "name": "x64-Debug", + "generator": "Visual Studio 16 2019 Win64", + "configurationType": "Debug", + "buildRoot": "${projectDir}\\out\\build\\${name}", + "cmakeCommandArgs": "-DBoost_INCLUDE_DIR=C:\\boost\\boost_1_62_0 -DCMAKE_BUILD_TYPE=Debug -DFRUIT_ADDITIONAL_CXX_FLAGS=/Z7", + "buildCommandArgs": "-m -v:minimal", + "intelliSenseMode": "windows-msvc-x64" }, { - "name": "x86-Release", - "generator": "Visual Studio 15 2017", - "configurationType": "Release", - "buildRoot": "${env.LOCALAPPDATA}\\CMakeBuild\\${workspaceHash}\\build\\${name}", - "cmakeCommandArgs": "-DBoost_INCLUDE_DIR=C:\\boost\\boost_1_62_0 -DCMAKE_BUILD_TYPE=Release", - "buildCommandArgs": "-m -v:minimal" - }, - { - "name": "x64-Debug", - "generator": "Visual Studio 15 2017 Win64", - "configurationType": "Debug", - "buildRoot": "${env.LOCALAPPDATA}\\CMakeBuild\\${workspaceHash}\\build\\${name}", - "cmakeCommandArgs": "-DBoost_INCLUDE_DIR=C:\\boost\\boost_1_62_0 -DCMAKE_BUILD_TYPE=Debug -DFRUIT_ADDITIONAL_CXX_FLAGS=/Z7", - "buildCommandArgs": "-m -v:minimal" - }, - { - "name": "x64-Release", - "generator": "Visual Studio 15 2017 Win64", - "configurationType": "Release", - "buildRoot": "${env.LOCALAPPDATA}\\CMakeBuild\\${workspaceHash}\\build\\${name}", - "cmakeCommandArgs": "-DBoost_INCLUDE_DIR=C:\\boost\\boost_1_62_0 -DCMAKE_BUILD_TYPE=Release", - "buildCommandArgs": "-m -v:minimal" + "name": "x64-Debug-noboost", + "generator": "Visual Studio 16 2019 Win64", + "configurationType": "Debug", + "buildRoot": "${projectDir}\\out\\build\\${name}", + "cmakeCommandArgs": "-DFRUIT_USES_BOOST=False -DCMAKE_BUILD_TYPE=Debug -DFRUIT_ADDITIONAL_CXX_FLAGS=/Z7", + "buildCommandArgs": "-m -v:minimal", + "intelliSenseMode": "windows-msvc-x64" } + ] } @@ -148,8 +135,9 @@ You can also run tests, but *only* from the command-line (after building Fruit f To do that, you'll need python3 installed (you can download it [here](https://www.python.org/downloads/)). -You'll also the `pytest` and `pytest-xdist` packages. You can install them with: +You'll also some Python packages. You can install them with: + pip install absl-py pip install pytest pip install pytest-xdist -- cgit v1.2.3 From 074c1a32b28fd48c60c09693d44abfd89e68dfe4 Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Mon, 9 Mar 2020 02:45:34 -0700 Subject: Various fixes so that Fruit compiles in C++17 mode with MSVC. Some tests still fail though; I'll fix them in a follow-up commit. --- .gitignore | 1 + CMakeLists.txt | 4 +++- include/fruit/impl/component_functors.defn.h | 5 +++-- include/fruit/impl/util/lambda_invoker.h | 16 +++++++++++++--- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 4370085..098e886 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,4 @@ bench_results /CMakeSettings.json /*.vcxproj.user /out/build/x64-Debug +/out/build/x64-Debug cxx-17 diff --git a/CMakeLists.txt b/CMakeLists.txt index 6f2c5a5..122a822 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,7 +12,9 @@ if (POLICY CMP0054) cmake_policy(SET CMP0054 NEW) endif() -set(CMAKE_CXX_STANDARD 11) +if ("${CMAKE_CXX_STANDARD}" STREQUAL "") + set(CMAKE_CXX_STANDARD 11) +endif() set(CMAKE_CXX_STANDARD_REQUIRED ON) # CMake on OSX likes to see this set explicitly, otherwise it outputs a warning. diff --git a/include/fruit/impl/component_functors.defn.h b/include/fruit/impl/component_functors.defn.h index e03b0a8..ccc5555 100644 --- a/include/fruit/impl/component_functors.defn.h +++ b/include/fruit/impl/component_functors.defn.h @@ -921,8 +921,9 @@ struct AutoRegisterFactoryHelper { return std::unique_ptr(i); }); }; - using RealF2 = ComponentFunctor(PreProcessRegisterProvider, ProvidedSignature, Type); - using RealF3 = ComponentFunctor(PostProcessRegisterProvider, ProvidedSignature, Type); + using ProviderDecltype = Type(UnwrapType...)>(const std::function>>(UnwrapType...)>&)>; + using RealF2 = ComponentFunctor(PreProcessRegisterProvider, ProvidedSignature, ProviderDecltype); + using RealF3 = ComponentFunctor(PostProcessRegisterProvider, ProvidedSignature, ProviderDecltype); using RealOp = Call(ComposeFunctors(F1, RealF2, RealF3), Comp); FruitStaticAssert(IsSame(GetResult(RealOp), GetResult(R))); Eval()(entries); diff --git a/include/fruit/impl/util/lambda_invoker.h b/include/fruit/impl/util/lambda_invoker.h index 2c8d63e..afe0a19 100644 --- a/include/fruit/impl/util/lambda_invoker.h +++ b/include/fruit/impl/util/lambda_invoker.h @@ -31,21 +31,31 @@ namespace fruit { namespace impl { +template +struct SafeAlignmentOf { + constexpr static const std::size_t value = alignof(T); +}; + +template +struct SafeAlignmentOf { + constexpr static const std::size_t value = alignof(int); +}; + class LambdaInvoker { public: template - FRUIT_ALWAYS_INLINE static auto invoke(Args&&... args) + FRUIT_ALWAYS_INLINE static auto invoke(Args&&... args) -> decltype(std::declval()(std::declval()...)) { // We reinterpret-cast a char[] to avoid de-referencing nullptr, which would technically be // undefined behavior (even though we would not access any data there anyway). // Sharing this buffer for different types F would also be undefined behavior since we'd break // strict aliasing between those types. - alignas(alignof(F)) static char buf[1]; + alignas(SafeAlignmentOf::value) static char buf[1]; FruitStaticAssert(fruit::impl::meta::IsEmpty(fruit::impl::meta::Type)); FruitStaticAssert(fruit::impl::meta::IsTriviallyCopyable(fruit::impl::meta::Type)); // Since `F' is empty, a valid value of type F is already stored at the beginning of buf. - F* f = reinterpret_cast(buf); + F* f = reinterpret_cast((char*)buf); return (*f)(std::forward(args)...); } }; -- cgit v1.2.3 From 71801d61788c85647126d943a6a411fc5a08bc06 Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Mon, 9 Mar 2020 03:02:25 -0700 Subject: Run MSVC 2019 CI tests in C++17 mode too. --- appveyor.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/appveyor.yml b/appveyor.yml index 74c8c1f..eceb425 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -3,6 +3,11 @@ clone_folder: C:\Fruit environment: PYTHON3_PATH: C:\Python36 matrix: + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 + CMAKE_GENERATOR: 'Visual Studio 16 2019' + VCVARSALL_DIR: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build' + ADDITIONAL_CMAKE_ARGS: '-DFRUIT_USES_BOOST=False -DCMAKE_CXX_FLAGS="/WX /DFRUIT_DEBUG /DFRUIT_EXTRA_DEBUG /D_ITERATOR_DEBUG_LEVEL=2" -T host=x64 -A x64 -DCMAKE_CXX_STANDARD=17' + CONFIGURATION: Debug - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 CMAKE_GENERATOR: 'Visual Studio 16 2019' VCVARSALL_DIR: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build' -- cgit v1.2.3 From 874ca5c0c012f8a8f17a5b441b8dc16ae8e7b3b6 Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Mon, 9 Mar 2020 03:05:22 -0700 Subject: Remove a now-unused variable. --- include/fruit/impl/component_functors.defn.h | 7 ------- 1 file changed, 7 deletions(-) diff --git a/include/fruit/impl/component_functors.defn.h b/include/fruit/impl/component_functors.defn.h index ccc5555..87ad682 100644 --- a/include/fruit/impl/component_functors.defn.h +++ b/include/fruit/impl/component_functors.defn.h @@ -914,13 +914,6 @@ struct AutoRegisterFactoryHelper { using Result = Eval; void operator()(FixedSizeVector& entries) { using NakedC = UnwrapType>; - auto provider = [](const UnwrapType>& fun) { - return UnwrapType>([=](typename TypeUnwrapper::type... args) { - NakedC* c = fun(args...).release(); - NakedI* i = static_cast(c); - return std::unique_ptr(i); - }); - }; using ProviderDecltype = Type(UnwrapType...)>(const std::function>>(UnwrapType...)>&)>; using RealF2 = ComponentFunctor(PreProcessRegisterProvider, ProvidedSignature, ProviderDecltype); using RealF3 = ComponentFunctor(PostProcessRegisterProvider, ProvidedSignature, ProviderDecltype); -- cgit v1.2.3 From 2ee42c563243fe884db2178f321bc8dc3398f77f Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Mon, 9 Mar 2020 03:42:39 -0700 Subject: Remove a now-unused typedef. --- include/fruit/impl/component_functors.defn.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/fruit/impl/component_functors.defn.h b/include/fruit/impl/component_functors.defn.h index 87ad682..aac0838 100644 --- a/include/fruit/impl/component_functors.defn.h +++ b/include/fruit/impl/component_functors.defn.h @@ -913,7 +913,6 @@ struct AutoRegisterFactoryHelper { struct Op { using Result = Eval; void operator()(FixedSizeVector& entries) { - using NakedC = UnwrapType>; using ProviderDecltype = Type(UnwrapType...)>(const std::function>>(UnwrapType...)>&)>; using RealF2 = ComponentFunctor(PreProcessRegisterProvider, ProvidedSignature, ProviderDecltype); using RealF3 = ComponentFunctor(PostProcessRegisterProvider, ProvidedSignature, ProviderDecltype); -- cgit v1.2.3 From 43b45c7dc066e882b45bbc78fb07ab051fdc9055 Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Mon, 9 Mar 2020 03:46:40 -0700 Subject: Fix a compile error that occurred when using MSVC 2019, C++17 and -DFRUIT_EXTRA_DEBUG. --- include/fruit/impl/component_functors.defn.h | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/include/fruit/impl/component_functors.defn.h b/include/fruit/impl/component_functors.defn.h index aac0838..68bcc6b 100644 --- a/include/fruit/impl/component_functors.defn.h +++ b/include/fruit/impl/component_functors.defn.h @@ -912,27 +912,17 @@ struct AutoRegisterFactoryHelper { using R = Call(ComposeFunctors(F1, F2, F3), Comp); struct Op { using Result = Eval; + using ProviderDecltype = Type(UnwrapType...)>( + const std::function>>(UnwrapType...)>&)>; + using RealF2 = ComponentFunctor(PreProcessRegisterProvider, ProvidedSignature, ProviderDecltype); + using RealF3 = ComponentFunctor(PostProcessRegisterProvider, ProvidedSignature, ProviderDecltype); + using RealOp = Call(ComposeFunctors(F1, RealF2, RealF3), Comp); void operator()(FixedSizeVector& entries) { - using ProviderDecltype = Type(UnwrapType...)>(const std::function>>(UnwrapType...)>&)>; - using RealF2 = ComponentFunctor(PreProcessRegisterProvider, ProvidedSignature, ProviderDecltype); - using RealF3 = ComponentFunctor(PostProcessRegisterProvider, ProvidedSignature, ProviderDecltype); - using RealOp = Call(ComposeFunctors(F1, RealF2, RealF3), Comp); FruitStaticAssert(IsSame(GetResult(RealOp), GetResult(R))); Eval()(entries); } std::size_t numEntries() { #if FRUIT_EXTRA_DEBUG - using NakedC = UnwrapType>; - auto provider = [](const UnwrapType>& fun) { - return UnwrapType>([=](typename TypeUnwrapper::type... args) { - NakedC* c = fun(args...).release(); - NakedI* i = static_cast(c); - return std::unique_ptr(i); - }); - }; - using RealF2 = ComponentFunctor(PreProcessRegisterProvider, ProvidedSignature, Type); - using RealF3 = ComponentFunctor(PostProcessRegisterProvider, ProvidedSignature, Type); - using RealOp = Call(ComposeFunctors(F1, RealF2, RealF3), Comp); FruitAssert(Eval().numEntries() == Eval().numEntries()); #endif return Eval().numEntries(); -- cgit v1.2.3 From 08a350a553f6f198b55312e5efb05c55e4977481 Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sun, 8 Mar 2020 21:29:17 -0700 Subject: Revert some recent changes to component_functors.defn.h, they don't work. --- include/fruit/impl/component_functors.defn.h | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/include/fruit/impl/component_functors.defn.h b/include/fruit/impl/component_functors.defn.h index 68bcc6b..e03b0a8 100644 --- a/include/fruit/impl/component_functors.defn.h +++ b/include/fruit/impl/component_functors.defn.h @@ -912,17 +912,34 @@ struct AutoRegisterFactoryHelper { using R = Call(ComposeFunctors(F1, F2, F3), Comp); struct Op { using Result = Eval; - using ProviderDecltype = Type(UnwrapType...)>( - const std::function>>(UnwrapType...)>&)>; - using RealF2 = ComponentFunctor(PreProcessRegisterProvider, ProvidedSignature, ProviderDecltype); - using RealF3 = ComponentFunctor(PostProcessRegisterProvider, ProvidedSignature, ProviderDecltype); - using RealOp = Call(ComposeFunctors(F1, RealF2, RealF3), Comp); void operator()(FixedSizeVector& entries) { + using NakedC = UnwrapType>; + auto provider = [](const UnwrapType>& fun) { + return UnwrapType>([=](typename TypeUnwrapper::type... args) { + NakedC* c = fun(args...).release(); + NakedI* i = static_cast(c); + return std::unique_ptr(i); + }); + }; + using RealF2 = ComponentFunctor(PreProcessRegisterProvider, ProvidedSignature, Type); + using RealF3 = ComponentFunctor(PostProcessRegisterProvider, ProvidedSignature, Type); + using RealOp = Call(ComposeFunctors(F1, RealF2, RealF3), Comp); FruitStaticAssert(IsSame(GetResult(RealOp), GetResult(R))); Eval()(entries); } std::size_t numEntries() { #if FRUIT_EXTRA_DEBUG + using NakedC = UnwrapType>; + auto provider = [](const UnwrapType>& fun) { + return UnwrapType>([=](typename TypeUnwrapper::type... args) { + NakedC* c = fun(args...).release(); + NakedI* i = static_cast(c); + return std::unique_ptr(i); + }); + }; + using RealF2 = ComponentFunctor(PreProcessRegisterProvider, ProvidedSignature, Type); + using RealF3 = ComponentFunctor(PostProcessRegisterProvider, ProvidedSignature, Type); + using RealOp = Call(ComposeFunctors(F1, RealF2, RealF3), Comp); FruitAssert(Eval().numEntries() == Eval().numEntries()); #endif return Eval().numEntries(); -- cgit v1.2.3 From 4244937dfd027111ef00ed6e123e41de72812f18 Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Mon, 9 Mar 2020 07:33:29 -0700 Subject: Fix the build with MSVC 2019 when using C++17 mode (2nd attempt). --- include/fruit/impl/component_functors.defn.h | 36 ++++++++++++++++++---------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/include/fruit/impl/component_functors.defn.h b/include/fruit/impl/component_functors.defn.h index e03b0a8..b12f723 100644 --- a/include/fruit/impl/component_functors.defn.h +++ b/include/fruit/impl/component_functors.defn.h @@ -912,35 +912,45 @@ struct AutoRegisterFactoryHelper { using R = Call(ComposeFunctors(F1, F2, F3), Comp); struct Op { using Result = Eval; + using NakedC = UnwrapType>; void operator()(FixedSizeVector& entries) { - using NakedC = UnwrapType>; auto provider = [](const UnwrapType>& fun) { - return UnwrapType>([=](typename TypeUnwrapper::type... args) { + return UnwrapType>([=](typename Args::type... args) { NakedC* c = fun(args...).release(); NakedI* i = static_cast(c); return std::unique_ptr(i); }); }; - using RealF2 = ComponentFunctor(PreProcessRegisterProvider, ProvidedSignature, Type); - using RealF3 = ComponentFunctor(PostProcessRegisterProvider, ProvidedSignature, Type); - using RealOp = Call(ComposeFunctors(F1, RealF2, RealF3), Comp); - FruitStaticAssert(IsSame(GetResult(RealOp), GetResult(R))); - Eval()(entries); + FruitStaticAssert(IsSame( + GetResult( + Call(ComposeFunctors( + F1, + ComponentFunctor(PreProcessRegisterProvider, ProvidedSignature, Type), + ComponentFunctor(PostProcessRegisterProvider, ProvidedSignature, Type)), + Comp)), + GetResult(R))); + Eval), + ComponentFunctor(PostProcessRegisterProvider, ProvidedSignature, Type)), + Comp)>()(entries); } std::size_t numEntries() { #if FRUIT_EXTRA_DEBUG - using NakedC = UnwrapType>; auto provider = [](const UnwrapType>& fun) { - return UnwrapType>([=](typename TypeUnwrapper::type... args) { + return UnwrapType>([=](typename Args::type... args) { NakedC* c = fun(args...).release(); NakedI* i = static_cast(c); return std::unique_ptr(i); }); }; - using RealF2 = ComponentFunctor(PreProcessRegisterProvider, ProvidedSignature, Type); - using RealF3 = ComponentFunctor(PostProcessRegisterProvider, ProvidedSignature, Type); - using RealOp = Call(ComposeFunctors(F1, RealF2, RealF3), Comp); - FruitAssert(Eval().numEntries() == Eval().numEntries()); + FruitAssert( + Eval().numEntries() == + Eval), + ComponentFunctor(PostProcessRegisterProvider, ProvidedSignature, Type)), + Comp)>() + .numEntries()); #endif return Eval().numEntries(); } -- cgit v1.2.3 From 1dfb55315b226266722289279248c32518a5b4a7 Mon Sep 17 00:00:00 2001 From: tt4g Date: Tue, 10 Mar 2020 12:45:19 +0900 Subject: Escape ADDITIONAL_INCLUDE_DIRS --- tests/CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 6444023..bf78890 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -81,13 +81,16 @@ if("${CMAKE_CXX_COMPILER_ID}" MATCHES "^(MSVC)$") set(FRUIT_TESTONLY_CXXFLAGS "${FRUIT_TESTONLY_CXXFLAGS} /wd4702 /wd4503") endif() +# Escape the backslash which is a Windows path separator. +string(REPLACE "\\" "\\\\" ADDITIONAL_INCLUDE_DIRS "${Boost_INCLUDE_DIRS}") + file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/fruit_test_config.py" CONTENT " CXX='${CMAKE_CXX_COMPILER}' CXX_COMPILER_NAME='${CMAKE_CXX_COMPILER_ID}' CXX_COMPILER_VERSION='${CMAKE_CXX_COMPILER_VERSION}' FRUIT_COMPILE_FLAGS='${FRUIT_COMPILE_FLAGS} ${FRUIT_TESTONLY_CXXFLAGS}' -ADDITIONAL_INCLUDE_DIRS='${Boost_INCLUDE_DIRS}' +ADDITIONAL_INCLUDE_DIRS='${ADDITIONAL_INCLUDE_DIRS}' ADDITIONAL_LINKER_FLAGS='${CMAKE_EXE_LINKER_FLAGS}' RUN_TESTS_UNDER_VALGRIND='${RUN_TESTS_UNDER_VALGRIND_FLAG}' VALGRIND_FLAGS='${VALGRIND_FLAGS_STR}' -- cgit v1.2.3 From 54d62be3cd807ab4720dfba46999681fe311b642 Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Wed, 11 Mar 2020 23:29:28 -0700 Subject: Skip updating (pin) some more packages in OS X CI runs, they take a long time to update and are causing CI timeouts sometimes. --- extras/scripts/travis_ci_install_osx.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/extras/scripts/travis_ci_install_osx.sh b/extras/scripts/travis_ci_install_osx.sh index 2cbd357..addf02e 100755 --- a/extras/scripts/travis_ci_install_osx.sh +++ b/extras/scripts/travis_ci_install_osx.sh @@ -9,6 +9,13 @@ do brew pin $p done +# These packages are dependencies of the ones that we update but we don't care about these, we don't want to waste time +# upgrading them. +for p in readline sqlite +do + brew pin $p +done + install_brew_package() { time (brew install "$@" || brew outdated "$1" || brew upgrade "$@" || true) # Some formulas are not linked into /usr/local by default, make sure they are. -- cgit v1.2.3 From 54877f7d299e81e05b92dd43e00bd0d291260344 Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Wed, 11 Mar 2020 23:40:27 -0700 Subject: Use Ubuntu xenial as base OS for CI test runs (this is the OS that runs docker, not the OS in which tests are run, so it mostly doesn't matter). --- .travis.yml | 2 +- extras/scripts/travis_yml_generator.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index ca75228..9f60e51 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,7 @@ branches: only: - master -dist: trusty +dist: xenial language: cpp matrix: fast_finish: true diff --git a/extras/scripts/travis_yml_generator.py b/extras/scripts/travis_yml_generator.py index 288232e..d68f4c6 100755 --- a/extras/scripts/travis_yml_generator.py +++ b/extras/scripts/travis_yml_generator.py @@ -222,7 +222,7 @@ add_osx_tests(compiler='clang-default', xcode_version='11.4', stl='libc++', smok yaml_file = { 'sudo': 'required', - 'dist': 'trusty', + 'dist': 'xenial', 'services': ['docker'], 'language': 'cpp', 'branches': { -- cgit v1.2.3 From c5667c9ed24a6a49a37a074fb6a053f79758cb2d Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Wed, 11 Mar 2020 23:43:45 -0700 Subject: Revert "Skip updating (pin) some more packages in OS X CI runs, they take a long time to update and are causing CI timeouts sometimes." Pinning these causes the llvm installation to fail. This reverts commit 54d62be3cd807ab4720dfba46999681fe311b642. --- extras/scripts/travis_ci_install_osx.sh | 7 ------- 1 file changed, 7 deletions(-) diff --git a/extras/scripts/travis_ci_install_osx.sh b/extras/scripts/travis_ci_install_osx.sh index addf02e..2cbd357 100755 --- a/extras/scripts/travis_ci_install_osx.sh +++ b/extras/scripts/travis_ci_install_osx.sh @@ -9,13 +9,6 @@ do brew pin $p done -# These packages are dependencies of the ones that we update but we don't care about these, we don't want to waste time -# upgrading them. -for p in readline sqlite -do - brew pin $p -done - install_brew_package() { time (brew install "$@" || brew outdated "$1" || brew upgrade "$@" || true) # Some formulas are not linked into /usr/local by default, make sure they are. -- cgit v1.2.3 From 2543c961299569c13ba11515ccad459f878f30f8 Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Wed, 11 Mar 2020 23:47:31 -0700 Subject: Use travis_wait when installing brew packages in OS X CI builds, to avoid occasional timeouts. --- .travis.yml | 33 +++++++++++++++++++-------------- extras/scripts/travis_yml_generator.py | 2 +- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9f60e51..e4ad672 100644 --- a/.travis.yml +++ b/.travis.yml @@ -51,7 +51,7 @@ matrix: - compiler: clang env: COMPILER=clang-default STL=libc++ TEST=DebugPlain install: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; - extras/scripts/travis_ci_install_osx.sh + travis_wait extras/scripts/travis_ci_install_osx.sh os: osx osx_image: xcode11.4 script: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; extras/scripts/postsubmit.sh @@ -172,59 +172,64 @@ matrix: export UBUNTU='16.04'; extras/scripts/postsubmit.sh DebugPlain - compiler: gcc env: COMPILER=gcc-6 TEST=ReleasePlain - install: export OS=osx; export COMPILER='gcc-6'; extras/scripts/travis_ci_install_osx.sh + install: export OS=osx; export COMPILER='gcc-6'; travis_wait extras/scripts/travis_ci_install_osx.sh os: osx osx_image: xcode11.4 script: export OS=osx; export COMPILER='gcc-6'; extras/scripts/postsubmit.sh ReleasePlain - compiler: gcc env: COMPILER=gcc-6 TEST=DebugPlain - install: export OS=osx; export COMPILER='gcc-6'; extras/scripts/travis_ci_install_osx.sh + install: export OS=osx; export COMPILER='gcc-6'; travis_wait extras/scripts/travis_ci_install_osx.sh os: osx osx_image: xcode11.4 script: export OS=osx; export COMPILER='gcc-6'; extras/scripts/postsubmit.sh DebugPlain - compiler: gcc env: COMPILER=gcc-9 TEST=ReleasePlainNoPch - install: export OS=osx; export COMPILER='gcc-9'; extras/scripts/travis_ci_install_osx.sh + install: export OS=osx; export COMPILER='gcc-9'; travis_wait extras/scripts/travis_ci_install_osx.sh os: osx osx_image: xcode11.4 script: export OS=osx; export COMPILER='gcc-9'; extras/scripts/postsubmit.sh ReleasePlainNoPch - compiler: gcc env: COMPILER=gcc-9 TEST=DebugPlainNoPch - install: export OS=osx; export COMPILER='gcc-9'; extras/scripts/travis_ci_install_osx.sh + install: export OS=osx; export COMPILER='gcc-9'; travis_wait extras/scripts/travis_ci_install_osx.sh os: osx osx_image: xcode11.4 script: export OS=osx; export COMPILER='gcc-9'; extras/scripts/postsubmit.sh DebugPlainNoPch - compiler: clang env: COMPILER=clang-6.0 STL=libc++ TEST=ReleasePlain - install: export OS=osx; export COMPILER='clang-6.0'; export STL='libc++'; extras/scripts/travis_ci_install_osx.sh + install: export OS=osx; export COMPILER='clang-6.0'; export STL='libc++'; travis_wait + extras/scripts/travis_ci_install_osx.sh os: osx osx_image: xcode11.4 script: export OS=osx; export COMPILER='clang-6.0'; export STL='libc++'; extras/scripts/postsubmit.sh ReleasePlain - compiler: clang env: COMPILER=clang-6.0 STL=libc++ TEST=DebugAsanUbsan - install: export OS=osx; export COMPILER='clang-6.0'; export STL='libc++'; extras/scripts/travis_ci_install_osx.sh + install: export OS=osx; export COMPILER='clang-6.0'; export STL='libc++'; travis_wait + extras/scripts/travis_ci_install_osx.sh os: osx osx_image: xcode11.4 script: export OS=osx; export COMPILER='clang-6.0'; export STL='libc++'; extras/scripts/postsubmit.sh DebugAsanUbsan - compiler: clang env: COMPILER=clang-8.0 STL=libc++ TEST=ReleasePlainNoPch - install: export OS=osx; export COMPILER='clang-8.0'; export STL='libc++'; extras/scripts/travis_ci_install_osx.sh + install: export OS=osx; export COMPILER='clang-8.0'; export STL='libc++'; travis_wait + extras/scripts/travis_ci_install_osx.sh os: osx osx_image: xcode11.4 script: export OS=osx; export COMPILER='clang-8.0'; export STL='libc++'; extras/scripts/postsubmit.sh ReleasePlainNoPch - compiler: clang env: COMPILER=clang-8.0 STL=libc++ TEST=DebugAsanUbsanNoPch - install: export OS=osx; export COMPILER='clang-8.0'; export STL='libc++'; extras/scripts/travis_ci_install_osx.sh + install: export OS=osx; export COMPILER='clang-8.0'; export STL='libc++'; travis_wait + extras/scripts/travis_ci_install_osx.sh os: osx osx_image: xcode11.4 script: export OS=osx; export COMPILER='clang-8.0'; export STL='libc++'; extras/scripts/postsubmit.sh DebugAsanUbsanNoPch - compiler: clang env: COMPILER=clang-8.0 STL=libc++ TEST=DebugPlainNoPch - install: export OS=osx; export COMPILER='clang-8.0'; export STL='libc++'; extras/scripts/travis_ci_install_osx.sh + install: export OS=osx; export COMPILER='clang-8.0'; export STL='libc++'; travis_wait + extras/scripts/travis_ci_install_osx.sh os: osx osx_image: xcode11.4 script: export OS=osx; export COMPILER='clang-8.0'; export STL='libc++'; extras/scripts/postsubmit.sh @@ -232,7 +237,7 @@ matrix: - compiler: clang env: COMPILER=clang-default STL=libc++ TEST=ReleasePlain install: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; - extras/scripts/travis_ci_install_osx.sh + travis_wait extras/scripts/travis_ci_install_osx.sh os: osx osx_image: xcode9.4 script: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; extras/scripts/postsubmit.sh @@ -240,7 +245,7 @@ matrix: - compiler: clang env: COMPILER=clang-default STL=libc++ TEST=DebugAsanUbsan install: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; - extras/scripts/travis_ci_install_osx.sh + travis_wait extras/scripts/travis_ci_install_osx.sh os: osx osx_image: xcode9.4 script: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; extras/scripts/postsubmit.sh @@ -248,7 +253,7 @@ matrix: - compiler: clang env: COMPILER=clang-default STL=libc++ TEST=ReleasePlain install: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; - extras/scripts/travis_ci_install_osx.sh + travis_wait extras/scripts/travis_ci_install_osx.sh os: osx osx_image: xcode11.4 script: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; extras/scripts/postsubmit.sh @@ -256,7 +261,7 @@ matrix: - compiler: clang env: COMPILER=clang-default STL=libc++ TEST=DebugAsanUbsan install: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; - extras/scripts/travis_ci_install_osx.sh + travis_wait extras/scripts/travis_ci_install_osx.sh os: osx osx_image: xcode11.4 script: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; extras/scripts/postsubmit.sh diff --git a/extras/scripts/travis_yml_generator.py b/extras/scripts/travis_yml_generator.py index d68f4c6..10721a6 100755 --- a/extras/scripts/travis_yml_generator.py +++ b/extras/scripts/travis_yml_generator.py @@ -107,7 +107,7 @@ def add_osx_tests(compiler, xcode_version=None, stl=None, asan=True, ubsan=True, compiler_kind = determine_compiler_kind(compiler) export_statements = 'export OS=osx; ' + generate_export_statements_for_env(env=env) test_environment_template = {'os': 'osx', 'compiler': compiler_kind, - 'install': '%s extras/scripts/travis_ci_install_osx.sh' % export_statements} + 'install': '%s travis_wait extras/scripts/travis_ci_install_osx.sh' % export_statements} if xcode_version is not None: test_environment_template['osx_image'] = 'xcode%s' % xcode_version -- cgit v1.2.3 From d62daefc44809a69edd85bef26a17ac3b43aa38f Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Wed, 11 Mar 2020 23:54:32 -0700 Subject: Use travis_wait for each brew call instead of wrapping the entire install script with it, otherwise there's no indication of progress when watching the log of a running build. --- .travis.yml | 33 ++++++++++++++------------------- extras/scripts/travis_ci_install_osx.sh | 2 +- extras/scripts/travis_yml_generator.py | 2 +- 3 files changed, 16 insertions(+), 21 deletions(-) diff --git a/.travis.yml b/.travis.yml index e4ad672..9f60e51 100644 --- a/.travis.yml +++ b/.travis.yml @@ -51,7 +51,7 @@ matrix: - compiler: clang env: COMPILER=clang-default STL=libc++ TEST=DebugPlain install: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; - travis_wait extras/scripts/travis_ci_install_osx.sh + extras/scripts/travis_ci_install_osx.sh os: osx osx_image: xcode11.4 script: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; extras/scripts/postsubmit.sh @@ -172,64 +172,59 @@ matrix: export UBUNTU='16.04'; extras/scripts/postsubmit.sh DebugPlain - compiler: gcc env: COMPILER=gcc-6 TEST=ReleasePlain - install: export OS=osx; export COMPILER='gcc-6'; travis_wait extras/scripts/travis_ci_install_osx.sh + install: export OS=osx; export COMPILER='gcc-6'; extras/scripts/travis_ci_install_osx.sh os: osx osx_image: xcode11.4 script: export OS=osx; export COMPILER='gcc-6'; extras/scripts/postsubmit.sh ReleasePlain - compiler: gcc env: COMPILER=gcc-6 TEST=DebugPlain - install: export OS=osx; export COMPILER='gcc-6'; travis_wait extras/scripts/travis_ci_install_osx.sh + install: export OS=osx; export COMPILER='gcc-6'; extras/scripts/travis_ci_install_osx.sh os: osx osx_image: xcode11.4 script: export OS=osx; export COMPILER='gcc-6'; extras/scripts/postsubmit.sh DebugPlain - compiler: gcc env: COMPILER=gcc-9 TEST=ReleasePlainNoPch - install: export OS=osx; export COMPILER='gcc-9'; travis_wait extras/scripts/travis_ci_install_osx.sh + install: export OS=osx; export COMPILER='gcc-9'; extras/scripts/travis_ci_install_osx.sh os: osx osx_image: xcode11.4 script: export OS=osx; export COMPILER='gcc-9'; extras/scripts/postsubmit.sh ReleasePlainNoPch - compiler: gcc env: COMPILER=gcc-9 TEST=DebugPlainNoPch - install: export OS=osx; export COMPILER='gcc-9'; travis_wait extras/scripts/travis_ci_install_osx.sh + install: export OS=osx; export COMPILER='gcc-9'; extras/scripts/travis_ci_install_osx.sh os: osx osx_image: xcode11.4 script: export OS=osx; export COMPILER='gcc-9'; extras/scripts/postsubmit.sh DebugPlainNoPch - compiler: clang env: COMPILER=clang-6.0 STL=libc++ TEST=ReleasePlain - install: export OS=osx; export COMPILER='clang-6.0'; export STL='libc++'; travis_wait - extras/scripts/travis_ci_install_osx.sh + install: export OS=osx; export COMPILER='clang-6.0'; export STL='libc++'; extras/scripts/travis_ci_install_osx.sh os: osx osx_image: xcode11.4 script: export OS=osx; export COMPILER='clang-6.0'; export STL='libc++'; extras/scripts/postsubmit.sh ReleasePlain - compiler: clang env: COMPILER=clang-6.0 STL=libc++ TEST=DebugAsanUbsan - install: export OS=osx; export COMPILER='clang-6.0'; export STL='libc++'; travis_wait - extras/scripts/travis_ci_install_osx.sh + install: export OS=osx; export COMPILER='clang-6.0'; export STL='libc++'; extras/scripts/travis_ci_install_osx.sh os: osx osx_image: xcode11.4 script: export OS=osx; export COMPILER='clang-6.0'; export STL='libc++'; extras/scripts/postsubmit.sh DebugAsanUbsan - compiler: clang env: COMPILER=clang-8.0 STL=libc++ TEST=ReleasePlainNoPch - install: export OS=osx; export COMPILER='clang-8.0'; export STL='libc++'; travis_wait - extras/scripts/travis_ci_install_osx.sh + install: export OS=osx; export COMPILER='clang-8.0'; export STL='libc++'; extras/scripts/travis_ci_install_osx.sh os: osx osx_image: xcode11.4 script: export OS=osx; export COMPILER='clang-8.0'; export STL='libc++'; extras/scripts/postsubmit.sh ReleasePlainNoPch - compiler: clang env: COMPILER=clang-8.0 STL=libc++ TEST=DebugAsanUbsanNoPch - install: export OS=osx; export COMPILER='clang-8.0'; export STL='libc++'; travis_wait - extras/scripts/travis_ci_install_osx.sh + install: export OS=osx; export COMPILER='clang-8.0'; export STL='libc++'; extras/scripts/travis_ci_install_osx.sh os: osx osx_image: xcode11.4 script: export OS=osx; export COMPILER='clang-8.0'; export STL='libc++'; extras/scripts/postsubmit.sh DebugAsanUbsanNoPch - compiler: clang env: COMPILER=clang-8.0 STL=libc++ TEST=DebugPlainNoPch - install: export OS=osx; export COMPILER='clang-8.0'; export STL='libc++'; travis_wait - extras/scripts/travis_ci_install_osx.sh + install: export OS=osx; export COMPILER='clang-8.0'; export STL='libc++'; extras/scripts/travis_ci_install_osx.sh os: osx osx_image: xcode11.4 script: export OS=osx; export COMPILER='clang-8.0'; export STL='libc++'; extras/scripts/postsubmit.sh @@ -237,7 +232,7 @@ matrix: - compiler: clang env: COMPILER=clang-default STL=libc++ TEST=ReleasePlain install: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; - travis_wait extras/scripts/travis_ci_install_osx.sh + extras/scripts/travis_ci_install_osx.sh os: osx osx_image: xcode9.4 script: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; extras/scripts/postsubmit.sh @@ -245,7 +240,7 @@ matrix: - compiler: clang env: COMPILER=clang-default STL=libc++ TEST=DebugAsanUbsan install: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; - travis_wait extras/scripts/travis_ci_install_osx.sh + extras/scripts/travis_ci_install_osx.sh os: osx osx_image: xcode9.4 script: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; extras/scripts/postsubmit.sh @@ -253,7 +248,7 @@ matrix: - compiler: clang env: COMPILER=clang-default STL=libc++ TEST=ReleasePlain install: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; - travis_wait extras/scripts/travis_ci_install_osx.sh + extras/scripts/travis_ci_install_osx.sh os: osx osx_image: xcode11.4 script: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; extras/scripts/postsubmit.sh @@ -261,7 +256,7 @@ matrix: - compiler: clang env: COMPILER=clang-default STL=libc++ TEST=DebugAsanUbsan install: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; - travis_wait extras/scripts/travis_ci_install_osx.sh + extras/scripts/travis_ci_install_osx.sh os: osx osx_image: xcode11.4 script: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; extras/scripts/postsubmit.sh diff --git a/extras/scripts/travis_ci_install_osx.sh b/extras/scripts/travis_ci_install_osx.sh index 2cbd357..ab241d9 100755 --- a/extras/scripts/travis_ci_install_osx.sh +++ b/extras/scripts/travis_ci_install_osx.sh @@ -10,7 +10,7 @@ do done install_brew_package() { - time (brew install "$@" || brew outdated "$1" || brew upgrade "$@" || true) + time (travis_wait brew install "$@" || brew outdated "$1" || travis_wait brew upgrade "$@" || true) # Some formulas are not linked into /usr/local by default, make sure they are. time (brew link --force "$@" || true) } diff --git a/extras/scripts/travis_yml_generator.py b/extras/scripts/travis_yml_generator.py index 10721a6..d68f4c6 100755 --- a/extras/scripts/travis_yml_generator.py +++ b/extras/scripts/travis_yml_generator.py @@ -107,7 +107,7 @@ def add_osx_tests(compiler, xcode_version=None, stl=None, asan=True, ubsan=True, compiler_kind = determine_compiler_kind(compiler) export_statements = 'export OS=osx; ' + generate_export_statements_for_env(env=env) test_environment_template = {'os': 'osx', 'compiler': compiler_kind, - 'install': '%s travis_wait extras/scripts/travis_ci_install_osx.sh' % export_statements} + 'install': '%s extras/scripts/travis_ci_install_osx.sh' % export_statements} if xcode_version is not None: test_environment_template['osx_image'] = 'xcode%s' % xcode_version -- cgit v1.2.3 From f9b7b4e333915977b2a934ecd534e2e2dde907da Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Wed, 11 Mar 2020 23:57:11 -0700 Subject: Revert "Use travis_wait for each brew call instead of wrapping the entire install script with it, otherwise there's no indication of progress when watching the log of a running build." travis_wait is not available inside the install script. This reverts commit d62daefc44809a69edd85bef26a17ac3b43aa38f. --- .travis.yml | 33 +++++++++++++++++++-------------- extras/scripts/travis_ci_install_osx.sh | 2 +- extras/scripts/travis_yml_generator.py | 2 +- 3 files changed, 21 insertions(+), 16 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9f60e51..e4ad672 100644 --- a/.travis.yml +++ b/.travis.yml @@ -51,7 +51,7 @@ matrix: - compiler: clang env: COMPILER=clang-default STL=libc++ TEST=DebugPlain install: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; - extras/scripts/travis_ci_install_osx.sh + travis_wait extras/scripts/travis_ci_install_osx.sh os: osx osx_image: xcode11.4 script: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; extras/scripts/postsubmit.sh @@ -172,59 +172,64 @@ matrix: export UBUNTU='16.04'; extras/scripts/postsubmit.sh DebugPlain - compiler: gcc env: COMPILER=gcc-6 TEST=ReleasePlain - install: export OS=osx; export COMPILER='gcc-6'; extras/scripts/travis_ci_install_osx.sh + install: export OS=osx; export COMPILER='gcc-6'; travis_wait extras/scripts/travis_ci_install_osx.sh os: osx osx_image: xcode11.4 script: export OS=osx; export COMPILER='gcc-6'; extras/scripts/postsubmit.sh ReleasePlain - compiler: gcc env: COMPILER=gcc-6 TEST=DebugPlain - install: export OS=osx; export COMPILER='gcc-6'; extras/scripts/travis_ci_install_osx.sh + install: export OS=osx; export COMPILER='gcc-6'; travis_wait extras/scripts/travis_ci_install_osx.sh os: osx osx_image: xcode11.4 script: export OS=osx; export COMPILER='gcc-6'; extras/scripts/postsubmit.sh DebugPlain - compiler: gcc env: COMPILER=gcc-9 TEST=ReleasePlainNoPch - install: export OS=osx; export COMPILER='gcc-9'; extras/scripts/travis_ci_install_osx.sh + install: export OS=osx; export COMPILER='gcc-9'; travis_wait extras/scripts/travis_ci_install_osx.sh os: osx osx_image: xcode11.4 script: export OS=osx; export COMPILER='gcc-9'; extras/scripts/postsubmit.sh ReleasePlainNoPch - compiler: gcc env: COMPILER=gcc-9 TEST=DebugPlainNoPch - install: export OS=osx; export COMPILER='gcc-9'; extras/scripts/travis_ci_install_osx.sh + install: export OS=osx; export COMPILER='gcc-9'; travis_wait extras/scripts/travis_ci_install_osx.sh os: osx osx_image: xcode11.4 script: export OS=osx; export COMPILER='gcc-9'; extras/scripts/postsubmit.sh DebugPlainNoPch - compiler: clang env: COMPILER=clang-6.0 STL=libc++ TEST=ReleasePlain - install: export OS=osx; export COMPILER='clang-6.0'; export STL='libc++'; extras/scripts/travis_ci_install_osx.sh + install: export OS=osx; export COMPILER='clang-6.0'; export STL='libc++'; travis_wait + extras/scripts/travis_ci_install_osx.sh os: osx osx_image: xcode11.4 script: export OS=osx; export COMPILER='clang-6.0'; export STL='libc++'; extras/scripts/postsubmit.sh ReleasePlain - compiler: clang env: COMPILER=clang-6.0 STL=libc++ TEST=DebugAsanUbsan - install: export OS=osx; export COMPILER='clang-6.0'; export STL='libc++'; extras/scripts/travis_ci_install_osx.sh + install: export OS=osx; export COMPILER='clang-6.0'; export STL='libc++'; travis_wait + extras/scripts/travis_ci_install_osx.sh os: osx osx_image: xcode11.4 script: export OS=osx; export COMPILER='clang-6.0'; export STL='libc++'; extras/scripts/postsubmit.sh DebugAsanUbsan - compiler: clang env: COMPILER=clang-8.0 STL=libc++ TEST=ReleasePlainNoPch - install: export OS=osx; export COMPILER='clang-8.0'; export STL='libc++'; extras/scripts/travis_ci_install_osx.sh + install: export OS=osx; export COMPILER='clang-8.0'; export STL='libc++'; travis_wait + extras/scripts/travis_ci_install_osx.sh os: osx osx_image: xcode11.4 script: export OS=osx; export COMPILER='clang-8.0'; export STL='libc++'; extras/scripts/postsubmit.sh ReleasePlainNoPch - compiler: clang env: COMPILER=clang-8.0 STL=libc++ TEST=DebugAsanUbsanNoPch - install: export OS=osx; export COMPILER='clang-8.0'; export STL='libc++'; extras/scripts/travis_ci_install_osx.sh + install: export OS=osx; export COMPILER='clang-8.0'; export STL='libc++'; travis_wait + extras/scripts/travis_ci_install_osx.sh os: osx osx_image: xcode11.4 script: export OS=osx; export COMPILER='clang-8.0'; export STL='libc++'; extras/scripts/postsubmit.sh DebugAsanUbsanNoPch - compiler: clang env: COMPILER=clang-8.0 STL=libc++ TEST=DebugPlainNoPch - install: export OS=osx; export COMPILER='clang-8.0'; export STL='libc++'; extras/scripts/travis_ci_install_osx.sh + install: export OS=osx; export COMPILER='clang-8.0'; export STL='libc++'; travis_wait + extras/scripts/travis_ci_install_osx.sh os: osx osx_image: xcode11.4 script: export OS=osx; export COMPILER='clang-8.0'; export STL='libc++'; extras/scripts/postsubmit.sh @@ -232,7 +237,7 @@ matrix: - compiler: clang env: COMPILER=clang-default STL=libc++ TEST=ReleasePlain install: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; - extras/scripts/travis_ci_install_osx.sh + travis_wait extras/scripts/travis_ci_install_osx.sh os: osx osx_image: xcode9.4 script: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; extras/scripts/postsubmit.sh @@ -240,7 +245,7 @@ matrix: - compiler: clang env: COMPILER=clang-default STL=libc++ TEST=DebugAsanUbsan install: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; - extras/scripts/travis_ci_install_osx.sh + travis_wait extras/scripts/travis_ci_install_osx.sh os: osx osx_image: xcode9.4 script: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; extras/scripts/postsubmit.sh @@ -248,7 +253,7 @@ matrix: - compiler: clang env: COMPILER=clang-default STL=libc++ TEST=ReleasePlain install: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; - extras/scripts/travis_ci_install_osx.sh + travis_wait extras/scripts/travis_ci_install_osx.sh os: osx osx_image: xcode11.4 script: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; extras/scripts/postsubmit.sh @@ -256,7 +261,7 @@ matrix: - compiler: clang env: COMPILER=clang-default STL=libc++ TEST=DebugAsanUbsan install: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; - extras/scripts/travis_ci_install_osx.sh + travis_wait extras/scripts/travis_ci_install_osx.sh os: osx osx_image: xcode11.4 script: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; extras/scripts/postsubmit.sh diff --git a/extras/scripts/travis_ci_install_osx.sh b/extras/scripts/travis_ci_install_osx.sh index ab241d9..2cbd357 100755 --- a/extras/scripts/travis_ci_install_osx.sh +++ b/extras/scripts/travis_ci_install_osx.sh @@ -10,7 +10,7 @@ do done install_brew_package() { - time (travis_wait brew install "$@" || brew outdated "$1" || travis_wait brew upgrade "$@" || true) + time (brew install "$@" || brew outdated "$1" || brew upgrade "$@" || true) # Some formulas are not linked into /usr/local by default, make sure they are. time (brew link --force "$@" || true) } diff --git a/extras/scripts/travis_yml_generator.py b/extras/scripts/travis_yml_generator.py index d68f4c6..10721a6 100755 --- a/extras/scripts/travis_yml_generator.py +++ b/extras/scripts/travis_yml_generator.py @@ -107,7 +107,7 @@ def add_osx_tests(compiler, xcode_version=None, stl=None, asan=True, ubsan=True, compiler_kind = determine_compiler_kind(compiler) export_statements = 'export OS=osx; ' + generate_export_statements_for_env(env=env) test_environment_template = {'os': 'osx', 'compiler': compiler_kind, - 'install': '%s extras/scripts/travis_ci_install_osx.sh' % export_statements} + 'install': '%s travis_wait extras/scripts/travis_ci_install_osx.sh' % export_statements} if xcode_version is not None: test_environment_template['osx_image'] = 'xcode%s' % xcode_version -- cgit v1.2.3 From d74ff9f98a80a0d9cd0da82fdb6a98ca258407f0 Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sat, 28 Mar 2020 10:35:53 -0700 Subject: Use Ubuntu 19.10 instead of 19.04 for Fruit CI tests. --- .travis.yml | 54 +++++++++++++++++----------------- extras/scripts/travis_yml_generator.py | 8 ++--- 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/.travis.yml b/.travis.yml index e4ad672..c8f129d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,38 +10,38 @@ matrix: fast_finish: true include: - compiler: gcc - env: COMPILER=gcc-9 UBUNTU=19.04 TEST=ReleasePlain - install: export OS=linux; export COMPILER='gcc-9'; export UBUNTU='19.04'; extras/scripts/travis_ci_install_linux.sh + env: COMPILER=gcc-9 UBUNTU=19.10 TEST=ReleasePlain + install: export OS=linux; export COMPILER='gcc-9'; export UBUNTU='19.10'; extras/scripts/travis_ci_install_linux.sh os: linux - script: export OS=linux; export COMPILER='gcc-9'; export UBUNTU='19.04'; extras/scripts/postsubmit.sh + script: export OS=linux; export COMPILER='gcc-9'; export UBUNTU='19.10'; extras/scripts/postsubmit.sh ReleasePlain - compiler: gcc - env: COMPILER=gcc-9 UBUNTU=19.04 TEST=DebugPlain - install: export OS=linux; export COMPILER='gcc-9'; export UBUNTU='19.04'; extras/scripts/travis_ci_install_linux.sh + env: COMPILER=gcc-9 UBUNTU=19.10 TEST=DebugPlain + install: export OS=linux; export COMPILER='gcc-9'; export UBUNTU='19.10'; extras/scripts/travis_ci_install_linux.sh os: linux - script: export OS=linux; export COMPILER='gcc-9'; export UBUNTU='19.04'; extras/scripts/postsubmit.sh + script: export OS=linux; export COMPILER='gcc-9'; export UBUNTU='19.10'; extras/scripts/postsubmit.sh DebugPlain - compiler: clang - env: COMPILER=clang-6.0 STL=libstdc++ UBUNTU=19.04 TEST=ReleasePlain + env: COMPILER=clang-6.0 STL=libstdc++ UBUNTU=19.10 TEST=ReleasePlain install: export OS=linux; export COMPILER='clang-6.0'; export STL='libstdc++'; - export UBUNTU='19.04'; extras/scripts/travis_ci_install_linux.sh + export UBUNTU='19.10'; extras/scripts/travis_ci_install_linux.sh os: linux script: export OS=linux; export COMPILER='clang-6.0'; export STL='libstdc++'; - export UBUNTU='19.04'; extras/scripts/postsubmit.sh ReleasePlain + export UBUNTU='19.10'; extras/scripts/postsubmit.sh ReleasePlain - compiler: clang - env: COMPILER=clang-6.0 STL=libstdc++ UBUNTU=19.04 TEST=DebugAsanUbsan + env: COMPILER=clang-6.0 STL=libstdc++ UBUNTU=19.10 TEST=DebugAsanUbsan install: export OS=linux; export COMPILER='clang-6.0'; export STL='libstdc++'; - export UBUNTU='19.04'; extras/scripts/travis_ci_install_linux.sh + export UBUNTU='19.10'; extras/scripts/travis_ci_install_linux.sh os: linux script: export OS=linux; export COMPILER='clang-6.0'; export STL='libstdc++'; - export UBUNTU='19.04'; extras/scripts/postsubmit.sh DebugAsanUbsan + export UBUNTU='19.10'; extras/scripts/postsubmit.sh DebugAsanUbsan - compiler: clang - env: COMPILER=clang-6.0 STL=libstdc++ UBUNTU=19.04 TEST=DebugPlain + env: COMPILER=clang-6.0 STL=libstdc++ UBUNTU=19.10 TEST=DebugPlain install: export OS=linux; export COMPILER='clang-6.0'; export STL='libstdc++'; - export UBUNTU='19.04'; extras/scripts/travis_ci_install_linux.sh + export UBUNTU='19.10'; extras/scripts/travis_ci_install_linux.sh os: linux script: export OS=linux; export COMPILER='clang-6.0'; export STL='libstdc++'; - export UBUNTU='19.04'; extras/scripts/postsubmit.sh DebugPlain + export UBUNTU='19.10'; extras/scripts/postsubmit.sh DebugPlain - compiler: gcc env: COMPILER=bazel UBUNTU=18.04 install: export OS=linux; export COMPILER='bazel'; export UBUNTU='18.04'; extras/scripts/travis_ci_install_linux.sh @@ -57,33 +57,33 @@ matrix: script: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; extras/scripts/postsubmit.sh DebugPlain - compiler: clang - env: COMPILER=clang-8.0 STL=libstdc++ UBUNTU=19.04 TEST=ReleasePlainNoPch + env: COMPILER=clang-8.0 STL=libstdc++ UBUNTU=19.10 TEST=ReleasePlainNoPch install: export OS=linux; export COMPILER='clang-8.0'; export STL='libstdc++'; - export UBUNTU='19.04'; extras/scripts/travis_ci_install_linux.sh + export UBUNTU='19.10'; extras/scripts/travis_ci_install_linux.sh os: linux script: export OS=linux; export COMPILER='clang-8.0'; export STL='libstdc++'; - export UBUNTU='19.04'; extras/scripts/postsubmit.sh ReleasePlainNoPch + export UBUNTU='19.10'; extras/scripts/postsubmit.sh ReleasePlainNoPch - compiler: clang - env: COMPILER=clang-8.0 STL=libstdc++ UBUNTU=19.04 TEST=DebugAsanUbsanNoPch + env: COMPILER=clang-8.0 STL=libstdc++ UBUNTU=19.10 TEST=DebugAsanUbsanNoPch install: export OS=linux; export COMPILER='clang-8.0'; export STL='libstdc++'; - export UBUNTU='19.04'; extras/scripts/travis_ci_install_linux.sh + export UBUNTU='19.10'; extras/scripts/travis_ci_install_linux.sh os: linux script: export OS=linux; export COMPILER='clang-8.0'; export STL='libstdc++'; - export UBUNTU='19.04'; extras/scripts/postsubmit.sh DebugAsanUbsanNoPch + export UBUNTU='19.10'; extras/scripts/postsubmit.sh DebugAsanUbsanNoPch - compiler: clang - env: COMPILER=clang-8.0 STL=libc++ UBUNTU=19.04 TEST=ReleasePlainNoPch + env: COMPILER=clang-8.0 STL=libc++ UBUNTU=19.10 TEST=ReleasePlainNoPch install: export OS=linux; export COMPILER='clang-8.0'; export STL='libc++'; export - UBUNTU='19.04'; extras/scripts/travis_ci_install_linux.sh + UBUNTU='19.10'; extras/scripts/travis_ci_install_linux.sh os: linux script: export OS=linux; export COMPILER='clang-8.0'; export STL='libc++'; export - UBUNTU='19.04'; extras/scripts/postsubmit.sh ReleasePlainNoPch + UBUNTU='19.10'; extras/scripts/postsubmit.sh ReleasePlainNoPch - compiler: clang - env: COMPILER=clang-8.0 STL=libc++ UBUNTU=19.04 TEST=DebugAsanUbsanNoPch + env: COMPILER=clang-8.0 STL=libc++ UBUNTU=19.10 TEST=DebugAsanUbsanNoPch install: export OS=linux; export COMPILER='clang-8.0'; export STL='libc++'; export - UBUNTU='19.04'; extras/scripts/travis_ci_install_linux.sh + UBUNTU='19.10'; extras/scripts/travis_ci_install_linux.sh os: linux script: export OS=linux; export COMPILER='clang-8.0'; export STL='libc++'; export - UBUNTU='19.04'; extras/scripts/postsubmit.sh DebugAsanUbsanNoPch + UBUNTU='19.10'; extras/scripts/postsubmit.sh DebugAsanUbsanNoPch - compiler: gcc env: COMPILER=gcc-8 UBUNTU=18.10 TEST=ReleasePlain install: export OS=linux; export COMPILER='gcc-8'; export UBUNTU='18.10'; extras/scripts/travis_ci_install_linux.sh diff --git a/extras/scripts/travis_yml_generator.py b/extras/scripts/travis_yml_generator.py index 10721a6..b221ac0 100755 --- a/extras/scripts/travis_yml_generator.py +++ b/extras/scripts/travis_yml_generator.py @@ -144,14 +144,14 @@ def add_bazel_tests(ubuntu_version, smoke_tests=[]): # TODO: re-enable ASan/UBSan once they work in Travis CI. ATM (as of 18 November 2017) they fail due to https://github.com/google/sanitizers/issues/837 -add_ubuntu_tests(ubuntu_version='19.04', compiler='gcc-9', asan=False, ubsan=False, +add_ubuntu_tests(ubuntu_version='19.10', compiler='gcc-9', asan=False, ubsan=False, smoke_tests=['DebugPlain', 'ReleasePlain']) -add_ubuntu_tests(ubuntu_version='19.04', compiler='clang-6.0', stl='libstdc++', +add_ubuntu_tests(ubuntu_version='19.10', compiler='clang-6.0', stl='libstdc++', smoke_tests=['DebugPlain', 'DebugAsanUbsan', 'ReleasePlain']) -add_ubuntu_tests(ubuntu_version='19.04', compiler='clang-8.0', stl='libstdc++', +add_ubuntu_tests(ubuntu_version='19.10', compiler='clang-8.0', stl='libstdc++', # Disabled due to https://bugs.llvm.org/show_bug.cgi?id=41625. use_precompiled_headers_in_tests=False) -add_ubuntu_tests(ubuntu_version='19.04', compiler='clang-8.0', stl='libc++', +add_ubuntu_tests(ubuntu_version='19.10', compiler='clang-8.0', stl='libc++', # Disabled due to https://bugs.llvm.org/show_bug.cgi?id=41625. use_precompiled_headers_in_tests=False) -- cgit v1.2.3 From 8325561dac8c99e43130201a941a54cde602da09 Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sat, 28 Mar 2020 15:41:11 -0700 Subject: Run clang-tidy checks in CMake builds. --- CMakeLists.txt | 9 +++++++++ CONTRIBUTING.md | 2 +- extras/scripts/postsubmit-helper.sh | 24 ++++++++++++------------ 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 122a822..d5d3d1d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -100,6 +100,15 @@ else() set(FRUIT_COMPILE_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG} ${FRUIT_ADDITIONAL_COMPILE_FLAGS}") endif() +set(FRUIT_ENABLE_CLANG_TIDY FALSE CACHE BOOL "Whether to run clang-tidy on the Fruit codebase during the build") +if(${FRUIT_ENABLE_CLANG_TIDY}) + set(CMAKE_CXX_CLANG_TIDY + clang-tidy; + -header-filter=fruit; + -checks=bugprone*,clang-analyzer*,-bugprone-reserved-identifier,-clang-diagnostic-dtor-name; + -warnings-as-errors=*;) +endif() + include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) include_directories(${CMAKE_CURRENT_BINARY_DIR}/include) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 83bb23a..1415516 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -27,7 +27,7 @@ Example commands to build a development version of Fruit using CMake (with all a cd $PATH_TO_FRUIT mkdir build-debug cd build-debug -cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="-Werror -DFRUIT_DEBUG=1 -DFRUIT_EXTRA_DEBUG=1 -D_GLIBCXX_DEBUG=1" +cmake .. -DCMAKE_BUILD_TYPE=Debug -DFRUIT_ENABLE_CLANG_TIDY=TRUE -DCMAKE_CXX_FLAGS="-Werror -DFRUIT_DEBUG=1 -DFRUIT_EXTRA_DEBUG=1 -D_GLIBCXX_DEBUG=1" make -j 16 cd tests py.test-3 -n auto diff --git a/extras/scripts/postsubmit-helper.sh b/extras/scripts/postsubmit-helper.sh index 2d5d44b..1bc0cdd 100755 --- a/extras/scripts/postsubmit-helper.sh +++ b/extras/scripts/postsubmit-helper.sh @@ -120,18 +120,18 @@ then echo Normalized C++ Standard library location: $(readlink -f $(echo '#include ' | $CXX -x c++ -E - | grep 'vector\"' | awk '{print $3}' | sed 's@/vector@@;s@\"@@g' | head -n 1)) case "$1" in - DebugPlain) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="$COMMON_CXX_FLAGS -DFRUIT_DEBUG=1 -DFRUIT_EXTRA_DEBUG=1 -D_GLIBCXX_DEBUG=1 -O2") ;; - DebugPlainNoPch) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="$COMMON_CXX_FLAGS -DFRUIT_DEBUG=1 -DFRUIT_EXTRA_DEBUG=1 -D_GLIBCXX_DEBUG=1 -O2" -DFRUIT_TESTS_USE_PRECOMPILED_HEADERS=OFF) ;; - DebugAsan) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="$COMMON_CXX_FLAGS -DFRUIT_DEBUG=1 -DFRUIT_EXTRA_DEBUG=1 -D_GLIBCXX_DEBUG=1 -O0 -fsanitize=address") ;; - DebugAsanNoPch) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="$COMMON_CXX_FLAGS -DFRUIT_DEBUG=1 -DFRUIT_EXTRA_DEBUG=1 -D_GLIBCXX_DEBUG=1 -O0 -fsanitize=address" -DFRUIT_TESTS_USE_PRECOMPILED_HEADERS=OFF) ;; - DebugAsanUbsan) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="$COMMON_CXX_FLAGS -DFRUIT_DEBUG=1 -DFRUIT_EXTRA_DEBUG=1 -D_GLIBCXX_DEBUG=1 -O0 -fsanitize=address,undefined") ;; - DebugAsanUbsanNoPch) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="$COMMON_CXX_FLAGS -DFRUIT_DEBUG=1 -DFRUIT_EXTRA_DEBUG=1 -D_GLIBCXX_DEBUG=1 -O0 -fsanitize=address,undefined" -DFRUIT_TESTS_USE_PRECOMPILED_HEADERS=OFF) ;; - DebugValgrind) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="$COMMON_CXX_FLAGS -DFRUIT_DEBUG=1 -DFRUIT_EXTRA_DEBUG=1 -D_GLIBCXX_DEBUG=1 -O2" -DRUN_TESTS_UNDER_VALGRIND=TRUE) ;; - DebugValgrindNoPch) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="$COMMON_CXX_FLAGS -DFRUIT_DEBUG=1 -DFRUIT_EXTRA_DEBUG=1 -D_GLIBCXX_DEBUG=1 -O2" -DRUN_TESTS_UNDER_VALGRIND=TRUE -DFRUIT_TESTS_USE_PRECOMPILED_HEADERS=OFF) ;; - ReleasePlain) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="$COMMON_CXX_FLAGS") ;; - ReleasePlainNoPch) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="$COMMON_CXX_FLAGS" -DFRUIT_TESTS_USE_PRECOMPILED_HEADERS=OFF) ;; - ReleaseValgrind) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="$COMMON_CXX_FLAGS" -DRUN_TESTS_UNDER_VALGRIND=TRUE) ;; - ReleaseValgrindNoPch) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="$COMMON_CXX_FLAGS" -DRUN_TESTS_UNDER_VALGRIND=TRUE -DFRUIT_TESTS_USE_PRECOMPILED_HEADERS=OFF) ;; + DebugPlain) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Debug -DFRUIT_ENABLE_CLANG_TIDY=TRUE -DCMAKE_CXX_FLAGS="$COMMON_CXX_FLAGS -DFRUIT_DEBUG=1 -DFRUIT_EXTRA_DEBUG=1 -D_GLIBCXX_DEBUG=1 -O2") ;; + DebugPlainNoPch) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Debug -DFRUIT_ENABLE_CLANG_TIDY=TRUE -DCMAKE_CXX_FLAGS="$COMMON_CXX_FLAGS -DFRUIT_DEBUG=1 -DFRUIT_EXTRA_DEBUG=1 -D_GLIBCXX_DEBUG=1 -O2" -DFRUIT_TESTS_USE_PRECOMPILED_HEADERS=OFF) ;; + DebugAsan) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Debug -DFRUIT_ENABLE_CLANG_TIDY=TRUE -DCMAKE_CXX_FLAGS="$COMMON_CXX_FLAGS -DFRUIT_DEBUG=1 -DFRUIT_EXTRA_DEBUG=1 -D_GLIBCXX_DEBUG=1 -O0 -fsanitize=address") ;; + DebugAsanNoPch) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Debug -DFRUIT_ENABLE_CLANG_TIDY=TRUE -DCMAKE_CXX_FLAGS="$COMMON_CXX_FLAGS -DFRUIT_DEBUG=1 -DFRUIT_EXTRA_DEBUG=1 -D_GLIBCXX_DEBUG=1 -O0 -fsanitize=address" -DFRUIT_TESTS_USE_PRECOMPILED_HEADERS=OFF) ;; + DebugAsanUbsan) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Debug -DFRUIT_ENABLE_CLANG_TIDY=TRUE -DCMAKE_CXX_FLAGS="$COMMON_CXX_FLAGS -DFRUIT_DEBUG=1 -DFRUIT_EXTRA_DEBUG=1 -D_GLIBCXX_DEBUG=1 -O0 -fsanitize=address,undefined") ;; + DebugAsanUbsanNoPch) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Debug -DFRUIT_ENABLE_CLANG_TIDY=TRUE -DCMAKE_CXX_FLAGS="$COMMON_CXX_FLAGS -DFRUIT_DEBUG=1 -DFRUIT_EXTRA_DEBUG=1 -D_GLIBCXX_DEBUG=1 -O0 -fsanitize=address,undefined" -DFRUIT_TESTS_USE_PRECOMPILED_HEADERS=OFF) ;; + DebugValgrind) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Debug -DFRUIT_ENABLE_CLANG_TIDY=TRUE -DCMAKE_CXX_FLAGS="$COMMON_CXX_FLAGS -DFRUIT_DEBUG=1 -DFRUIT_EXTRA_DEBUG=1 -D_GLIBCXX_DEBUG=1 -O2" -DRUN_TESTS_UNDER_VALGRIND=TRUE) ;; + DebugValgrindNoPch) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Debug -DFRUIT_ENABLE_CLANG_TIDY=TRUE -DCMAKE_CXX_FLAGS="$COMMON_CXX_FLAGS -DFRUIT_DEBUG=1 -DFRUIT_EXTRA_DEBUG=1 -D_GLIBCXX_DEBUG=1 -O2" -DRUN_TESTS_UNDER_VALGRIND=TRUE -DFRUIT_TESTS_USE_PRECOMPILED_HEADERS=OFF) ;; + ReleasePlain) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Release -DFRUIT_ENABLE_CLANG_TIDY=TRUE -DCMAKE_CXX_FLAGS="$COMMON_CXX_FLAGS") ;; + ReleasePlainNoPch) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Release -DFRUIT_ENABLE_CLANG_TIDY=TRUE -DCMAKE_CXX_FLAGS="$COMMON_CXX_FLAGS" -DFRUIT_TESTS_USE_PRECOMPILED_HEADERS=OFF) ;; + ReleaseValgrind) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Release -DFRUIT_ENABLE_CLANG_TIDY=TRUE -DCMAKE_CXX_FLAGS="$COMMON_CXX_FLAGS" -DRUN_TESTS_UNDER_VALGRIND=TRUE) ;; + ReleaseValgrindNoPch) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Release -DFRUIT_ENABLE_CLANG_TIDY=TRUE -DCMAKE_CXX_FLAGS="$COMMON_CXX_FLAGS" -DRUN_TESTS_UNDER_VALGRIND=TRUE -DFRUIT_TESTS_USE_PRECOMPILED_HEADERS=OFF) ;; *) echo "Error: you need to specify one of the supported postsubmit modes (see postsubmit.sh)."; exit 1 ;; esac -- cgit v1.2.3 From 9e4b9c1c7df06f989806d9d2719ea634150ec6ac Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sat, 28 Mar 2020 16:36:57 -0700 Subject: Fix some use-after-move issues caused by clang-tidy. These didn't cause problems in practice, but that's just due to how boost::unordered_map is implemented, and Fruit should not rely on that. --- .../binding_normalization.templates.h | 12 ++++++------ src/binding_normalization.cpp | 16 ++++++++-------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/include/fruit/impl/normalized_component_storage/binding_normalization.templates.h b/include/fruit/impl/normalized_component_storage/binding_normalization.templates.h index 1c9b485..6710ea0 100644 --- a/include/fruit/impl/normalized_component_storage/binding_normalization.templates.h +++ b/include/fruit/impl/normalized_component_storage/binding_normalization.templates.h @@ -343,10 +343,10 @@ void BindingNormalization::handleReplacedLazyComponentWithArgs(BindingNormalizat ComponentStorageEntry::Kind::REPLACEMENT_LAZY_COMPONENT_WITH_NO_ARGS || replacement_component_entry.kind == ComponentStorageEntry::Kind::REPLACEMENT_LAZY_COMPONENT_WITH_ARGS); - if (context.components_with_args_with_expansion_in_progress.count(entry.lazy_component_with_args) != 0 || - context.fully_expanded_components_with_args.count(entry.lazy_component_with_args) != 0 || + if (context.components_with_args_with_expansion_in_progress.count(replaced_component_entry.lazy_component_with_args) != 0 || + context.fully_expanded_components_with_args.count(replaced_component_entry.lazy_component_with_args) != 0 || context.functors.is_component_with_args_already_expanded_in_normalized_component( - entry.lazy_component_with_args)) { + replaced_component_entry.lazy_component_with_args)) { printComponentReplacementFailedBecauseTargetAlreadyExpanded(replaced_component_entry, replacement_component_entry); FRUIT_UNREACHABLE; // LCOV_EXCL_LINE } @@ -389,10 +389,10 @@ void BindingNormalization::handleReplacedLazyComponentWithNoArgs(BindingNormaliz ComponentStorageEntry::Kind::REPLACEMENT_LAZY_COMPONENT_WITH_NO_ARGS || replacement_component_entry.kind == ComponentStorageEntry::Kind::REPLACEMENT_LAZY_COMPONENT_WITH_ARGS); - if (context.components_with_no_args_with_expansion_in_progress.count(entry.lazy_component_with_no_args) != 0 || - context.fully_expanded_components_with_no_args.count(entry.lazy_component_with_no_args) != 0 || + if (context.components_with_no_args_with_expansion_in_progress.count(replaced_component_entry.lazy_component_with_no_args) != 0 || + context.fully_expanded_components_with_no_args.count(replaced_component_entry.lazy_component_with_no_args) != 0 || context.functors.is_component_with_no_args_already_expanded_in_normalized_component( - entry.lazy_component_with_no_args)) { + replaced_component_entry.lazy_component_with_no_args)) { printComponentReplacementFailedBecauseTargetAlreadyExpanded(replaced_component_entry, replacement_component_entry); FRUIT_UNREACHABLE; // LCOV_EXCL_LINE } diff --git a/src/binding_normalization.cpp b/src/binding_normalization.cpp index c353687..843ee34 100644 --- a/src/binding_normalization.cpp +++ b/src/binding_normalization.cpp @@ -292,21 +292,21 @@ void BindingNormalization::normalizeBindingsWithUndoableBindingCompression( [&bindingCompressionInfoMap](TypeId c_type_id, NormalizedComponentStorage::CompressedBindingUndoInfo undo_info) { bindingCompressionInfoMap[c_type_id] = undo_info; }, - [&fully_expanded_components_with_no_args](LazyComponentWithNoArgsSet& fully_expanded_components) { + [&fully_expanded_components_with_no_args, &memory_pool](LazyComponentWithNoArgsSet& fully_expanded_components) { fully_expanded_components_with_no_args = std::move(fully_expanded_components); - fully_expanded_components.clear(); + fully_expanded_components = NormalizedComponentStorage::createLazyComponentWithNoArgsSet(0, memory_pool); }, - [&fully_expanded_components_with_args](LazyComponentWithArgsSet& fully_expanded_components) { + [&fully_expanded_components_with_args, &memory_pool](LazyComponentWithArgsSet& fully_expanded_components) { fully_expanded_components_with_args = std::move(fully_expanded_components); - fully_expanded_components.clear(); + fully_expanded_components = NormalizedComponentStorage::createLazyComponentWithArgsSet(0, memory_pool); }, - [&component_with_no_args_replacements](LazyComponentWithNoArgsReplacementMap& component_replacements) { + [&component_with_no_args_replacements, &memory_pool](LazyComponentWithNoArgsReplacementMap& component_replacements) { component_with_no_args_replacements = std::move(component_replacements); - component_replacements.clear(); + component_replacements = NormalizedComponentStorage::createLazyComponentWithNoArgsReplacementMap(0, memory_pool); }, - [&component_with_args_replacements](LazyComponentWithArgsReplacementMap& component_replacements) { + [&component_with_args_replacements, &memory_pool](LazyComponentWithArgsReplacementMap& component_replacements) { component_with_args_replacements = std::move(component_replacements); - component_replacements.clear(); + component_replacements = NormalizedComponentStorage::createLazyComponentWithArgsReplacementMap(0, memory_pool); }); } -- cgit v1.2.3 From e30c93b9825e645255c81fa10f3bb6abb9858d31 Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sat, 28 Mar 2020 17:25:23 -0700 Subject: Run CI tests using Clang 10 instead of Clang 8 with Ubuntu 19.10. --- .travis.yml | 24 ++++++++++++------------ extras/scripts/travis_yml_generator.py | 4 ++-- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.travis.yml b/.travis.yml index c8f129d..2a6c3f2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -57,32 +57,32 @@ matrix: script: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; extras/scripts/postsubmit.sh DebugPlain - compiler: clang - env: COMPILER=clang-8.0 STL=libstdc++ UBUNTU=19.10 TEST=ReleasePlainNoPch - install: export OS=linux; export COMPILER='clang-8.0'; export STL='libstdc++'; + env: COMPILER=clang-10.0 STL=libstdc++ UBUNTU=19.10 TEST=ReleasePlainNoPch + install: export OS=linux; export COMPILER='clang-10.0'; export STL='libstdc++'; export UBUNTU='19.10'; extras/scripts/travis_ci_install_linux.sh os: linux - script: export OS=linux; export COMPILER='clang-8.0'; export STL='libstdc++'; + script: export OS=linux; export COMPILER='clang-10.0'; export STL='libstdc++'; export UBUNTU='19.10'; extras/scripts/postsubmit.sh ReleasePlainNoPch - compiler: clang - env: COMPILER=clang-8.0 STL=libstdc++ UBUNTU=19.10 TEST=DebugAsanUbsanNoPch - install: export OS=linux; export COMPILER='clang-8.0'; export STL='libstdc++'; + env: COMPILER=clang-10.0 STL=libstdc++ UBUNTU=19.10 TEST=DebugAsanUbsanNoPch + install: export OS=linux; export COMPILER='clang-10.0'; export STL='libstdc++'; export UBUNTU='19.10'; extras/scripts/travis_ci_install_linux.sh os: linux - script: export OS=linux; export COMPILER='clang-8.0'; export STL='libstdc++'; + script: export OS=linux; export COMPILER='clang-10.0'; export STL='libstdc++'; export UBUNTU='19.10'; extras/scripts/postsubmit.sh DebugAsanUbsanNoPch - compiler: clang - env: COMPILER=clang-8.0 STL=libc++ UBUNTU=19.10 TEST=ReleasePlainNoPch - install: export OS=linux; export COMPILER='clang-8.0'; export STL='libc++'; export + env: COMPILER=clang-10.0 STL=libc++ UBUNTU=19.10 TEST=ReleasePlainNoPch + install: export OS=linux; export COMPILER='clang-10.0'; export STL='libc++'; export UBUNTU='19.10'; extras/scripts/travis_ci_install_linux.sh os: linux - script: export OS=linux; export COMPILER='clang-8.0'; export STL='libc++'; export + script: export OS=linux; export COMPILER='clang-10.0'; export STL='libc++'; export UBUNTU='19.10'; extras/scripts/postsubmit.sh ReleasePlainNoPch - compiler: clang - env: COMPILER=clang-8.0 STL=libc++ UBUNTU=19.10 TEST=DebugAsanUbsanNoPch - install: export OS=linux; export COMPILER='clang-8.0'; export STL='libc++'; export + env: COMPILER=clang-10.0 STL=libc++ UBUNTU=19.10 TEST=DebugAsanUbsanNoPch + install: export OS=linux; export COMPILER='clang-10.0'; export STL='libc++'; export UBUNTU='19.10'; extras/scripts/travis_ci_install_linux.sh os: linux - script: export OS=linux; export COMPILER='clang-8.0'; export STL='libc++'; export + script: export OS=linux; export COMPILER='clang-10.0'; export STL='libc++'; export UBUNTU='19.10'; extras/scripts/postsubmit.sh DebugAsanUbsanNoPch - compiler: gcc env: COMPILER=gcc-8 UBUNTU=18.10 TEST=ReleasePlain diff --git a/extras/scripts/travis_yml_generator.py b/extras/scripts/travis_yml_generator.py index b221ac0..e7993c3 100755 --- a/extras/scripts/travis_yml_generator.py +++ b/extras/scripts/travis_yml_generator.py @@ -148,10 +148,10 @@ add_ubuntu_tests(ubuntu_version='19.10', compiler='gcc-9', asan=False, ubsan=Fal smoke_tests=['DebugPlain', 'ReleasePlain']) add_ubuntu_tests(ubuntu_version='19.10', compiler='clang-6.0', stl='libstdc++', smoke_tests=['DebugPlain', 'DebugAsanUbsan', 'ReleasePlain']) -add_ubuntu_tests(ubuntu_version='19.10', compiler='clang-8.0', stl='libstdc++', +add_ubuntu_tests(ubuntu_version='19.10', compiler='clang-10.0', stl='libstdc++', # Disabled due to https://bugs.llvm.org/show_bug.cgi?id=41625. use_precompiled_headers_in_tests=False) -add_ubuntu_tests(ubuntu_version='19.10', compiler='clang-8.0', stl='libc++', +add_ubuntu_tests(ubuntu_version='19.10', compiler='clang-10.0', stl='libc++', # Disabled due to https://bugs.llvm.org/show_bug.cgi?id=41625. use_precompiled_headers_in_tests=False) -- cgit v1.2.3 From a2df2fdb4d65e72af162a25ebf906651a1c09ac2 Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sat, 28 Mar 2020 17:42:50 -0700 Subject: Add support for disabling clang-tidy in each CI test, and disable it in OS X CI tests. clang-tidy is not installed there. --- .travis.yml | 68 +++++++++++++++++----------------- extras/scripts/postsubmit-helper.sh | 36 ++++++++++++------ extras/scripts/travis_yml_generator.py | 25 +++++++------ 3 files changed, 72 insertions(+), 57 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2a6c3f2..2e61406 100644 --- a/.travis.yml +++ b/.travis.yml @@ -48,14 +48,6 @@ matrix: os: linux script: export OS=linux; export COMPILER='bazel'; export UBUNTU='18.04'; extras/scripts/postsubmit.sh DebugPlain - - compiler: clang - env: COMPILER=clang-default STL=libc++ TEST=DebugPlain - install: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; - travis_wait extras/scripts/travis_ci_install_osx.sh - os: osx - osx_image: xcode11.4 - script: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; extras/scripts/postsubmit.sh - DebugPlain - compiler: clang env: COMPILER=clang-10.0 STL=libstdc++ UBUNTU=19.10 TEST=ReleasePlainNoPch install: export OS=linux; export COMPILER='clang-10.0'; export STL='libstdc++'; @@ -171,101 +163,109 @@ matrix: script: export OS=linux; export COMPILER='clang-3.9'; export STL='libstdc++'; export UBUNTU='16.04'; extras/scripts/postsubmit.sh DebugPlain - compiler: gcc - env: COMPILER=gcc-6 TEST=ReleasePlain + env: COMPILER=gcc-6 TEST=ReleasePlainNoClangTidy install: export OS=osx; export COMPILER='gcc-6'; travis_wait extras/scripts/travis_ci_install_osx.sh os: osx osx_image: xcode11.4 - script: export OS=osx; export COMPILER='gcc-6'; extras/scripts/postsubmit.sh ReleasePlain + script: export OS=osx; export COMPILER='gcc-6'; extras/scripts/postsubmit.sh ReleasePlainNoClangTidy - compiler: gcc - env: COMPILER=gcc-6 TEST=DebugPlain + env: COMPILER=gcc-6 TEST=DebugPlainNoClangTidy install: export OS=osx; export COMPILER='gcc-6'; travis_wait extras/scripts/travis_ci_install_osx.sh os: osx osx_image: xcode11.4 - script: export OS=osx; export COMPILER='gcc-6'; extras/scripts/postsubmit.sh DebugPlain + script: export OS=osx; export COMPILER='gcc-6'; extras/scripts/postsubmit.sh DebugPlainNoClangTidy - compiler: gcc - env: COMPILER=gcc-9 TEST=ReleasePlainNoPch + env: COMPILER=gcc-9 TEST=ReleasePlainNoPchNoClangTidy install: export OS=osx; export COMPILER='gcc-9'; travis_wait extras/scripts/travis_ci_install_osx.sh os: osx osx_image: xcode11.4 - script: export OS=osx; export COMPILER='gcc-9'; extras/scripts/postsubmit.sh ReleasePlainNoPch + script: export OS=osx; export COMPILER='gcc-9'; extras/scripts/postsubmit.sh ReleasePlainNoPchNoClangTidy - compiler: gcc - env: COMPILER=gcc-9 TEST=DebugPlainNoPch + env: COMPILER=gcc-9 TEST=DebugPlainNoPchNoClangTidy install: export OS=osx; export COMPILER='gcc-9'; travis_wait extras/scripts/travis_ci_install_osx.sh os: osx osx_image: xcode11.4 - script: export OS=osx; export COMPILER='gcc-9'; extras/scripts/postsubmit.sh DebugPlainNoPch + script: export OS=osx; export COMPILER='gcc-9'; extras/scripts/postsubmit.sh DebugPlainNoPchNoClangTidy - compiler: clang - env: COMPILER=clang-6.0 STL=libc++ TEST=ReleasePlain + env: COMPILER=clang-6.0 STL=libc++ TEST=ReleasePlainNoClangTidy install: export OS=osx; export COMPILER='clang-6.0'; export STL='libc++'; travis_wait extras/scripts/travis_ci_install_osx.sh os: osx osx_image: xcode11.4 script: export OS=osx; export COMPILER='clang-6.0'; export STL='libc++'; extras/scripts/postsubmit.sh - ReleasePlain + ReleasePlainNoClangTidy - compiler: clang - env: COMPILER=clang-6.0 STL=libc++ TEST=DebugAsanUbsan + env: COMPILER=clang-6.0 STL=libc++ TEST=DebugAsanUbsanNoClangTidy install: export OS=osx; export COMPILER='clang-6.0'; export STL='libc++'; travis_wait extras/scripts/travis_ci_install_osx.sh os: osx osx_image: xcode11.4 script: export OS=osx; export COMPILER='clang-6.0'; export STL='libc++'; extras/scripts/postsubmit.sh - DebugAsanUbsan + DebugAsanUbsanNoClangTidy - compiler: clang - env: COMPILER=clang-8.0 STL=libc++ TEST=ReleasePlainNoPch + env: COMPILER=clang-8.0 STL=libc++ TEST=ReleasePlainNoPchNoClangTidy install: export OS=osx; export COMPILER='clang-8.0'; export STL='libc++'; travis_wait extras/scripts/travis_ci_install_osx.sh os: osx osx_image: xcode11.4 script: export OS=osx; export COMPILER='clang-8.0'; export STL='libc++'; extras/scripts/postsubmit.sh - ReleasePlainNoPch + ReleasePlainNoPchNoClangTidy - compiler: clang - env: COMPILER=clang-8.0 STL=libc++ TEST=DebugAsanUbsanNoPch + env: COMPILER=clang-8.0 STL=libc++ TEST=DebugAsanUbsanNoPchNoClangTidy install: export OS=osx; export COMPILER='clang-8.0'; export STL='libc++'; travis_wait extras/scripts/travis_ci_install_osx.sh os: osx osx_image: xcode11.4 script: export OS=osx; export COMPILER='clang-8.0'; export STL='libc++'; extras/scripts/postsubmit.sh - DebugAsanUbsanNoPch + DebugAsanUbsanNoPchNoClangTidy - compiler: clang - env: COMPILER=clang-8.0 STL=libc++ TEST=DebugPlainNoPch + env: COMPILER=clang-8.0 STL=libc++ TEST=DebugPlainNoPchNoClangTidy install: export OS=osx; export COMPILER='clang-8.0'; export STL='libc++'; travis_wait extras/scripts/travis_ci_install_osx.sh os: osx osx_image: xcode11.4 script: export OS=osx; export COMPILER='clang-8.0'; export STL='libc++'; extras/scripts/postsubmit.sh - DebugPlainNoPch + DebugPlainNoPchNoClangTidy - compiler: clang - env: COMPILER=clang-default STL=libc++ TEST=ReleasePlain + env: COMPILER=clang-default STL=libc++ TEST=ReleasePlainNoClangTidy install: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; travis_wait extras/scripts/travis_ci_install_osx.sh os: osx osx_image: xcode9.4 script: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; extras/scripts/postsubmit.sh - ReleasePlain + ReleasePlainNoClangTidy - compiler: clang - env: COMPILER=clang-default STL=libc++ TEST=DebugAsanUbsan + env: COMPILER=clang-default STL=libc++ TEST=DebugAsanUbsanNoClangTidy install: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; travis_wait extras/scripts/travis_ci_install_osx.sh os: osx osx_image: xcode9.4 script: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; extras/scripts/postsubmit.sh - DebugAsanUbsan + DebugAsanUbsanNoClangTidy - compiler: clang - env: COMPILER=clang-default STL=libc++ TEST=ReleasePlain + env: COMPILER=clang-default STL=libc++ TEST=ReleasePlainNoClangTidy install: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; travis_wait extras/scripts/travis_ci_install_osx.sh os: osx osx_image: xcode11.4 script: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; extras/scripts/postsubmit.sh - ReleasePlain + ReleasePlainNoClangTidy + - compiler: clang + env: COMPILER=clang-default STL=libc++ TEST=DebugAsanUbsanNoClangTidy + install: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; + travis_wait extras/scripts/travis_ci_install_osx.sh + os: osx + osx_image: xcode11.4 + script: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; extras/scripts/postsubmit.sh + DebugAsanUbsanNoClangTidy - compiler: clang - env: COMPILER=clang-default STL=libc++ TEST=DebugAsanUbsan + env: COMPILER=clang-default STL=libc++ TEST=DebugPlainNoClangTidy install: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; travis_wait extras/scripts/travis_ci_install_osx.sh os: osx osx_image: xcode11.4 script: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; extras/scripts/postsubmit.sh - DebugAsanUbsan + DebugPlainNoClangTidy services: - docker sudo: required diff --git a/extras/scripts/postsubmit-helper.sh b/extras/scripts/postsubmit-helper.sh index 1bc0cdd..6d4336a 100755 --- a/extras/scripts/postsubmit-helper.sh +++ b/extras/scripts/postsubmit-helper.sh @@ -120,18 +120,30 @@ then echo Normalized C++ Standard library location: $(readlink -f $(echo '#include ' | $CXX -x c++ -E - | grep 'vector\"' | awk '{print $3}' | sed 's@/vector@@;s@\"@@g' | head -n 1)) case "$1" in - DebugPlain) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Debug -DFRUIT_ENABLE_CLANG_TIDY=TRUE -DCMAKE_CXX_FLAGS="$COMMON_CXX_FLAGS -DFRUIT_DEBUG=1 -DFRUIT_EXTRA_DEBUG=1 -D_GLIBCXX_DEBUG=1 -O2") ;; - DebugPlainNoPch) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Debug -DFRUIT_ENABLE_CLANG_TIDY=TRUE -DCMAKE_CXX_FLAGS="$COMMON_CXX_FLAGS -DFRUIT_DEBUG=1 -DFRUIT_EXTRA_DEBUG=1 -D_GLIBCXX_DEBUG=1 -O2" -DFRUIT_TESTS_USE_PRECOMPILED_HEADERS=OFF) ;; - DebugAsan) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Debug -DFRUIT_ENABLE_CLANG_TIDY=TRUE -DCMAKE_CXX_FLAGS="$COMMON_CXX_FLAGS -DFRUIT_DEBUG=1 -DFRUIT_EXTRA_DEBUG=1 -D_GLIBCXX_DEBUG=1 -O0 -fsanitize=address") ;; - DebugAsanNoPch) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Debug -DFRUIT_ENABLE_CLANG_TIDY=TRUE -DCMAKE_CXX_FLAGS="$COMMON_CXX_FLAGS -DFRUIT_DEBUG=1 -DFRUIT_EXTRA_DEBUG=1 -D_GLIBCXX_DEBUG=1 -O0 -fsanitize=address" -DFRUIT_TESTS_USE_PRECOMPILED_HEADERS=OFF) ;; - DebugAsanUbsan) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Debug -DFRUIT_ENABLE_CLANG_TIDY=TRUE -DCMAKE_CXX_FLAGS="$COMMON_CXX_FLAGS -DFRUIT_DEBUG=1 -DFRUIT_EXTRA_DEBUG=1 -D_GLIBCXX_DEBUG=1 -O0 -fsanitize=address,undefined") ;; - DebugAsanUbsanNoPch) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Debug -DFRUIT_ENABLE_CLANG_TIDY=TRUE -DCMAKE_CXX_FLAGS="$COMMON_CXX_FLAGS -DFRUIT_DEBUG=1 -DFRUIT_EXTRA_DEBUG=1 -D_GLIBCXX_DEBUG=1 -O0 -fsanitize=address,undefined" -DFRUIT_TESTS_USE_PRECOMPILED_HEADERS=OFF) ;; - DebugValgrind) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Debug -DFRUIT_ENABLE_CLANG_TIDY=TRUE -DCMAKE_CXX_FLAGS="$COMMON_CXX_FLAGS -DFRUIT_DEBUG=1 -DFRUIT_EXTRA_DEBUG=1 -D_GLIBCXX_DEBUG=1 -O2" -DRUN_TESTS_UNDER_VALGRIND=TRUE) ;; - DebugValgrindNoPch) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Debug -DFRUIT_ENABLE_CLANG_TIDY=TRUE -DCMAKE_CXX_FLAGS="$COMMON_CXX_FLAGS -DFRUIT_DEBUG=1 -DFRUIT_EXTRA_DEBUG=1 -D_GLIBCXX_DEBUG=1 -O2" -DRUN_TESTS_UNDER_VALGRIND=TRUE -DFRUIT_TESTS_USE_PRECOMPILED_HEADERS=OFF) ;; - ReleasePlain) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Release -DFRUIT_ENABLE_CLANG_TIDY=TRUE -DCMAKE_CXX_FLAGS="$COMMON_CXX_FLAGS") ;; - ReleasePlainNoPch) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Release -DFRUIT_ENABLE_CLANG_TIDY=TRUE -DCMAKE_CXX_FLAGS="$COMMON_CXX_FLAGS" -DFRUIT_TESTS_USE_PRECOMPILED_HEADERS=OFF) ;; - ReleaseValgrind) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Release -DFRUIT_ENABLE_CLANG_TIDY=TRUE -DCMAKE_CXX_FLAGS="$COMMON_CXX_FLAGS" -DRUN_TESTS_UNDER_VALGRIND=TRUE) ;; - ReleaseValgrindNoPch) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Release -DFRUIT_ENABLE_CLANG_TIDY=TRUE -DCMAKE_CXX_FLAGS="$COMMON_CXX_FLAGS" -DRUN_TESTS_UNDER_VALGRIND=TRUE -DFRUIT_TESTS_USE_PRECOMPILED_HEADERS=OFF) ;; + DebugPlain) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Debug -DFRUIT_ENABLE_CLANG_TIDY=TRUE -DCMAKE_CXX_FLAGS="$COMMON_CXX_FLAGS -DFRUIT_DEBUG=1 -DFRUIT_EXTRA_DEBUG=1 -D_GLIBCXX_DEBUG=1 -O2") ;; + DebugPlainNoClangTidy) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Debug -DFRUIT_ENABLE_CLANG_TIDY=FALSE -DCMAKE_CXX_FLAGS="$COMMON_CXX_FLAGS -DFRUIT_DEBUG=1 -DFRUIT_EXTRA_DEBUG=1 -D_GLIBCXX_DEBUG=1 -O2") ;; + DebugPlainNoPch) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Debug -DFRUIT_ENABLE_CLANG_TIDY=TRUE -DCMAKE_CXX_FLAGS="$COMMON_CXX_FLAGS -DFRUIT_DEBUG=1 -DFRUIT_EXTRA_DEBUG=1 -D_GLIBCXX_DEBUG=1 -O2" -DFRUIT_TESTS_USE_PRECOMPILED_HEADERS=OFF) ;; + DebugPlainNoPchNoClangTidy) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Debug -DFRUIT_ENABLE_CLANG_TIDY=FALSE -DCMAKE_CXX_FLAGS="$COMMON_CXX_FLAGS -DFRUIT_DEBUG=1 -DFRUIT_EXTRA_DEBUG=1 -D_GLIBCXX_DEBUG=1 -O2" -DFRUIT_TESTS_USE_PRECOMPILED_HEADERS=OFF) ;; + DebugAsan) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Debug -DFRUIT_ENABLE_CLANG_TIDY=TRUE -DCMAKE_CXX_FLAGS="$COMMON_CXX_FLAGS -DFRUIT_DEBUG=1 -DFRUIT_EXTRA_DEBUG=1 -D_GLIBCXX_DEBUG=1 -O0 -fsanitize=address") ;; + DebugAsanNoClangTidy) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Debug -DFRUIT_ENABLE_CLANG_TIDY=FALSE -DCMAKE_CXX_FLAGS="$COMMON_CXX_FLAGS -DFRUIT_DEBUG=1 -DFRUIT_EXTRA_DEBUG=1 -D_GLIBCXX_DEBUG=1 -O0 -fsanitize=address") ;; + DebugAsanNoPch) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Debug -DFRUIT_ENABLE_CLANG_TIDY=TRUE -DCMAKE_CXX_FLAGS="$COMMON_CXX_FLAGS -DFRUIT_DEBUG=1 -DFRUIT_EXTRA_DEBUG=1 -D_GLIBCXX_DEBUG=1 -O0 -fsanitize=address" -DFRUIT_TESTS_USE_PRECOMPILED_HEADERS=OFF) ;; + DebugAsanNoPchNoClangTidy) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Debug -DFRUIT_ENABLE_CLANG_TIDY=FALSE -DCMAKE_CXX_FLAGS="$COMMON_CXX_FLAGS -DFRUIT_DEBUG=1 -DFRUIT_EXTRA_DEBUG=1 -D_GLIBCXX_DEBUG=1 -O0 -fsanitize=address" -DFRUIT_TESTS_USE_PRECOMPILED_HEADERS=OFF) ;; + DebugAsanUbsan) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Debug -DFRUIT_ENABLE_CLANG_TIDY=TRUE -DCMAKE_CXX_FLAGS="$COMMON_CXX_FLAGS -DFRUIT_DEBUG=1 -DFRUIT_EXTRA_DEBUG=1 -D_GLIBCXX_DEBUG=1 -O0 -fsanitize=address,undefined") ;; + DebugAsanUbsanNoClangTidy) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Debug -DFRUIT_ENABLE_CLANG_TIDY=FALSE -DCMAKE_CXX_FLAGS="$COMMON_CXX_FLAGS -DFRUIT_DEBUG=1 -DFRUIT_EXTRA_DEBUG=1 -D_GLIBCXX_DEBUG=1 -O0 -fsanitize=address,undefined") ;; + DebugAsanUbsanNoPch) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Debug -DFRUIT_ENABLE_CLANG_TIDY=TRUE -DCMAKE_CXX_FLAGS="$COMMON_CXX_FLAGS -DFRUIT_DEBUG=1 -DFRUIT_EXTRA_DEBUG=1 -D_GLIBCXX_DEBUG=1 -O0 -fsanitize=address,undefined" -DFRUIT_TESTS_USE_PRECOMPILED_HEADERS=OFF) ;; + DebugAsanUbsanNoPchNoClangTidy) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Debug -DFRUIT_ENABLE_CLANG_TIDY=FALSE -DCMAKE_CXX_FLAGS="$COMMON_CXX_FLAGS -DFRUIT_DEBUG=1 -DFRUIT_EXTRA_DEBUG=1 -D_GLIBCXX_DEBUG=1 -O0 -fsanitize=address,undefined" -DFRUIT_TESTS_USE_PRECOMPILED_HEADERS=OFF) ;; + DebugValgrind) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Debug -DFRUIT_ENABLE_CLANG_TIDY=TRUE -DCMAKE_CXX_FLAGS="$COMMON_CXX_FLAGS -DFRUIT_DEBUG=1 -DFRUIT_EXTRA_DEBUG=1 -D_GLIBCXX_DEBUG=1 -O2" -DRUN_TESTS_UNDER_VALGRIND=TRUE) ;; + DebugValgrindNoClangTidy) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Debug -DFRUIT_ENABLE_CLANG_TIDY=FALSE -DCMAKE_CXX_FLAGS="$COMMON_CXX_FLAGS -DFRUIT_DEBUG=1 -DFRUIT_EXTRA_DEBUG=1 -D_GLIBCXX_DEBUG=1 -O2" -DRUN_TESTS_UNDER_VALGRIND=TRUE) ;; + DebugValgrindNoPch) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Debug -DFRUIT_ENABLE_CLANG_TIDY=TRUE -DCMAKE_CXX_FLAGS="$COMMON_CXX_FLAGS -DFRUIT_DEBUG=1 -DFRUIT_EXTRA_DEBUG=1 -D_GLIBCXX_DEBUG=1 -O2" -DRUN_TESTS_UNDER_VALGRIND=TRUE -DFRUIT_TESTS_USE_PRECOMPILED_HEADERS=OFF) ;; + DebugValgrindNoPchNoClangTidy) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Debug -DFRUIT_ENABLE_CLANG_TIDY=FALSE -DCMAKE_CXX_FLAGS="$COMMON_CXX_FLAGS -DFRUIT_DEBUG=1 -DFRUIT_EXTRA_DEBUG=1 -D_GLIBCXX_DEBUG=1 -O2" -DRUN_TESTS_UNDER_VALGRIND=TRUE -DFRUIT_TESTS_USE_PRECOMPILED_HEADERS=OFF) ;; + ReleasePlain) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Release -DFRUIT_ENABLE_CLANG_TIDY=TRUE -DCMAKE_CXX_FLAGS="$COMMON_CXX_FLAGS") ;; + ReleasePlainNoClangTidy) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Release -DFRUIT_ENABLE_CLANG_TIDY=FALSE -DCMAKE_CXX_FLAGS="$COMMON_CXX_FLAGS") ;; + ReleasePlainNoPch) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Release -DFRUIT_ENABLE_CLANG_TIDY=TRUE -DCMAKE_CXX_FLAGS="$COMMON_CXX_FLAGS" -DFRUIT_TESTS_USE_PRECOMPILED_HEADERS=OFF) ;; + ReleasePlainNoPchNoClangTidy) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Release -DFRUIT_ENABLE_CLANG_TIDY=FALSE -DCMAKE_CXX_FLAGS="$COMMON_CXX_FLAGS" -DFRUIT_TESTS_USE_PRECOMPILED_HEADERS=OFF) ;; + ReleaseValgrind) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Release -DFRUIT_ENABLE_CLANG_TIDY=TRUE -DCMAKE_CXX_FLAGS="$COMMON_CXX_FLAGS" -DRUN_TESTS_UNDER_VALGRIND=TRUE) ;; + ReleaseValgrindNoClangTidy) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Release -DFRUIT_ENABLE_CLANG_TIDY=FALSE -DCMAKE_CXX_FLAGS="$COMMON_CXX_FLAGS" -DRUN_TESTS_UNDER_VALGRIND=TRUE) ;; + ReleaseValgrindNoPch) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Release -DFRUIT_ENABLE_CLANG_TIDY=TRUE -DCMAKE_CXX_FLAGS="$COMMON_CXX_FLAGS" -DRUN_TESTS_UNDER_VALGRIND=TRUE -DFRUIT_TESTS_USE_PRECOMPILED_HEADERS=OFF) ;; + ReleaseValgrindNoPchNoClangTidy) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Release -DFRUIT_ENABLE_CLANG_TIDY=FALSE -DCMAKE_CXX_FLAGS="$COMMON_CXX_FLAGS" -DRUN_TESTS_UNDER_VALGRIND=TRUE -DFRUIT_TESTS_USE_PRECOMPILED_HEADERS=OFF) ;; *) echo "Error: you need to specify one of the supported postsubmit modes (see postsubmit.sh)."; exit 1 ;; esac diff --git a/extras/scripts/travis_yml_generator.py b/extras/scripts/travis_yml_generator.py index e7993c3..f02e279 100755 --- a/extras/scripts/travis_yml_generator.py +++ b/extras/scripts/travis_yml_generator.py @@ -29,7 +29,7 @@ def determine_compiler_kind(compiler): raise Exception('Unexpected compiler: %s' % compiler) -def determine_tests(asan, ubsan, smoke_tests, use_precompiled_headers_in_tests, exclude_tests, +def determine_tests(asan, ubsan, clang_tidy, smoke_tests, use_precompiled_headers_in_tests, exclude_tests, include_only_tests): tests = [] has_debug_build = False @@ -51,7 +51,7 @@ def determine_tests(asan, ubsan, smoke_tests, use_precompiled_headers_in_tests, if excessive_excluded_tests: raise Exception( 'Some tests were excluded but were not going to run anyway: %s. ' - 'Tests to run (ignoring the possible NoPch prefix): %s' + 'Tests to run (ignoring the possible NoPch/NoClangTidy prefixes): %s' % (excessive_excluded_tests, tests)) if include_only_tests is not None: if exclude_tests != []: @@ -61,6 +61,8 @@ def determine_tests(asan, ubsan, smoke_tests, use_precompiled_headers_in_tests, tests = [test for test in tests if test not in exclude_tests] if not use_precompiled_headers_in_tests: tests = [test + 'NoPch' for test in tests] + if not clang_tidy: + tests = [test + 'NoClangTidy' for test in tests] return tests @@ -72,7 +74,7 @@ def generate_env_string_for_env(env): return ' '.join(['%s=%s' % (var_name, value) for (var_name, value) in sorted(env.items())]) -def add_ubuntu_tests(ubuntu_version, compiler, os='linux', stl=None, asan=True, ubsan=True, +def add_ubuntu_tests(ubuntu_version, compiler, os='linux', stl=None, asan=True, ubsan=True, clang_tidy=True, use_precompiled_headers_in_tests=True, smoke_tests=[], exclude_tests=[], include_only_tests=None): env = { 'UBUNTU': ubuntu_version, @@ -84,7 +86,7 @@ def add_ubuntu_tests(ubuntu_version, compiler, os='linux', stl=None, asan=True, export_statements = 'export OS=' + os + '; ' + generate_export_statements_for_env(env=env) test_environment_template = {'os': 'linux', 'compiler': compiler_kind, 'install': '%s extras/scripts/travis_ci_install_linux.sh' % export_statements} - tests = determine_tests(asan, ubsan, smoke_tests, + tests = determine_tests(asan, ubsan, clang_tidy, smoke_tests, use_precompiled_headers_in_tests=use_precompiled_headers_in_tests, exclude_tests=exclude_tests, include_only_tests=include_only_tests) @@ -99,7 +101,7 @@ def add_ubuntu_tests(ubuntu_version, compiler, os='linux', stl=None, asan=True, build_matrix_rows.append(test_environment) -def add_osx_tests(compiler, xcode_version=None, stl=None, asan=True, ubsan=True, +def add_osx_tests(compiler, xcode_version=None, stl=None, asan=True, ubsan=True, clang_tidy=True, use_precompiled_headers_in_tests=True, smoke_tests=[], exclude_tests=[], include_only_tests=None): env = {'COMPILER': compiler} if stl is not None: @@ -111,7 +113,7 @@ def add_osx_tests(compiler, xcode_version=None, stl=None, asan=True, ubsan=True, if xcode_version is not None: test_environment_template['osx_image'] = 'xcode%s' % xcode_version - tests = determine_tests(asan, ubsan, smoke_tests, + tests = determine_tests(asan, ubsan, clang_tidy, smoke_tests, use_precompiled_headers_in_tests=use_precompiled_headers_in_tests, exclude_tests=exclude_tests, include_only_tests=include_only_tests) for test in tests: @@ -175,19 +177,20 @@ add_ubuntu_tests(ubuntu_version='16.04', compiler='clang-3.9', stl='libstdc++', # overridden at runtime. This was likely caused by different translation units being compiled with different # visibility settings. # and the build eventually fails or times out. -add_osx_tests(compiler='gcc-6', xcode_version='11.4', asan=False, ubsan=False) -add_osx_tests(compiler='gcc-9', xcode_version='11.4', asan=False, ubsan=False, smoke_tests=['DebugPlain'], +add_osx_tests(compiler='gcc-6', xcode_version='11.4', asan=False, ubsan=False, clang_tidy=False) +add_osx_tests(compiler='gcc-9', xcode_version='11.4', asan=False, ubsan=False, clang_tidy=False, smoke_tests=['DebugPlain'], # Using PCHs fails with this error: # error: /Users/travis/build/google/fruit/build/tests/test_common-precompiled.h.gch: had text segment # at different address use_precompiled_headers_in_tests=False) -add_osx_tests(compiler='clang-6.0', xcode_version='11.4', stl='libc++') +add_osx_tests(compiler='clang-6.0', xcode_version='11.4', stl='libc++', clang_tidy=False) add_osx_tests(compiler='clang-8.0', xcode_version='11.4', stl='libc++', smoke_tests=['DebugPlain'], + clang_tidy=False, # Disabled due to https://bugs.llvm.org/show_bug.cgi?id=41625. use_precompiled_headers_in_tests=False) -add_osx_tests(compiler='clang-default', xcode_version='9.4', stl='libc++') -add_osx_tests(compiler='clang-default', xcode_version='11.4', stl='libc++', smoke_tests=['DebugPlain']) +add_osx_tests(compiler='clang-default', xcode_version='9.4', stl='libc++', clang_tidy=False) +add_osx_tests(compiler='clang-default', xcode_version='11.4', stl='libc++', clang_tidy=False, smoke_tests=['DebugPlain']) # ** Disabled combinations ** # -- cgit v1.2.3 From 57ae0e21351ad43ceb595714bb55986872d62061 Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sat, 28 Mar 2020 17:43:08 -0700 Subject: Add support for Clang 10 in CI tests. --- extras/scripts/postsubmit-helper.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/extras/scripts/postsubmit-helper.sh b/extras/scripts/postsubmit-helper.sh index 6d4336a..9b463bc 100755 --- a/extras/scripts/postsubmit-helper.sh +++ b/extras/scripts/postsubmit-helper.sh @@ -92,6 +92,11 @@ clang-9.0) export CXX=clang++-9 ;; +clang-10.0) + export CC=clang-10 + export CXX=clang++-10 + ;; + clang-default) export CC=clang export CXX=clang++ -- cgit v1.2.3 From a4a0f05af85fd108c3e599abde63aab7a272eb54 Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sat, 28 Mar 2020 17:52:21 -0700 Subject: Retire Bazel tests for Ubuntu 16.04, the Docker image now fails to build (and we have CI tests for 18.04 anyway). --- .travis.yml | 6 ------ extras/scripts/travis_yml_generator.py | 1 - 2 files changed, 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2e61406..8517f90 100644 --- a/.travis.yml +++ b/.travis.yml @@ -116,12 +116,6 @@ matrix: os: linux script: export OS=linux; export COMPILER='clang-7.0'; export STL='libstdc++'; export UBUNTU='18.10'; extras/scripts/postsubmit.sh DebugAsanUbsanNoPch - - compiler: gcc - env: COMPILER=bazel UBUNTU=16.04 - install: export OS=linux; export COMPILER='bazel'; export UBUNTU='16.04'; extras/scripts/travis_ci_install_linux.sh - os: linux - script: export OS=linux; export COMPILER='bazel'; export UBUNTU='16.04'; extras/scripts/postsubmit.sh - DebugPlain - compiler: gcc env: COMPILER=gcc-5 UBUNTU=16.04 TEST=ReleasePlain install: export OS=linux; export COMPILER='gcc-5'; export UBUNTU='16.04'; extras/scripts/travis_ci_install_linux.sh diff --git a/extras/scripts/travis_yml_generator.py b/extras/scripts/travis_yml_generator.py index f02e279..48bdc7a 100755 --- a/extras/scripts/travis_yml_generator.py +++ b/extras/scripts/travis_yml_generator.py @@ -164,7 +164,6 @@ add_ubuntu_tests(ubuntu_version='18.10', compiler='clang-7.0', stl='libstdc++', use_precompiled_headers_in_tests=False) add_bazel_tests(ubuntu_version='18.04', smoke_tests=['DebugPlain']) -add_bazel_tests(ubuntu_version='16.04') # ASan/UBSan are disabled for all these, the analysis on later versions is better anyway. # Also, in some combinations they wouldn't work. -- cgit v1.2.3 From 452ff1cfc31035dc36f253449b5cbb89b3f2e43d Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sat, 28 Mar 2020 18:24:20 -0700 Subject: No longer run CI tests on Ubuntu 18.10, use 16.04 instead. Also run tests with additional GCC versions. --- .travis.yml | 80 ++++++++++++++++++++++++---------- extras/scripts/travis_yml_generator.py | 9 ++-- 2 files changed, 64 insertions(+), 25 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8517f90..ff3458d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -48,6 +48,18 @@ matrix: os: linux script: export OS=linux; export COMPILER='bazel'; export UBUNTU='18.04'; extras/scripts/postsubmit.sh DebugPlain + - compiler: gcc + env: COMPILER=gcc-7 UBUNTU=19.10 TEST=ReleasePlain + install: export OS=linux; export COMPILER='gcc-7'; export UBUNTU='19.10'; extras/scripts/travis_ci_install_linux.sh + os: linux + script: export OS=linux; export COMPILER='gcc-7'; export UBUNTU='19.10'; extras/scripts/postsubmit.sh + ReleasePlain + - compiler: gcc + env: COMPILER=gcc-7 UBUNTU=19.10 TEST=DebugPlain + install: export OS=linux; export COMPILER='gcc-7'; export UBUNTU='19.10'; extras/scripts/travis_ci_install_linux.sh + os: linux + script: export OS=linux; export COMPILER='gcc-7'; export UBUNTU='19.10'; extras/scripts/postsubmit.sh + DebugPlain - compiler: clang env: COMPILER=clang-10.0 STL=libstdc++ UBUNTU=19.10 TEST=ReleasePlainNoPch install: export OS=linux; export COMPILER='clang-10.0'; export STL='libstdc++'; @@ -77,45 +89,69 @@ matrix: script: export OS=linux; export COMPILER='clang-10.0'; export STL='libc++'; export UBUNTU='19.10'; extras/scripts/postsubmit.sh DebugAsanUbsanNoPch - compiler: gcc - env: COMPILER=gcc-8 UBUNTU=18.10 TEST=ReleasePlain - install: export OS=linux; export COMPILER='gcc-8'; export UBUNTU='18.10'; extras/scripts/travis_ci_install_linux.sh + env: COMPILER=gcc-5 UBUNTU=18.04 TEST=ReleasePlain + install: export OS=linux; export COMPILER='gcc-5'; export UBUNTU='18.04'; extras/scripts/travis_ci_install_linux.sh + os: linux + script: export OS=linux; export COMPILER='gcc-5'; export UBUNTU='18.04'; extras/scripts/postsubmit.sh + ReleasePlain + - compiler: gcc + env: COMPILER=gcc-5 UBUNTU=18.04 TEST=DebugPlain + install: export OS=linux; export COMPILER='gcc-5'; export UBUNTU='18.04'; extras/scripts/travis_ci_install_linux.sh + os: linux + script: export OS=linux; export COMPILER='gcc-5'; export UBUNTU='18.04'; extras/scripts/postsubmit.sh + DebugPlain + - compiler: gcc + env: COMPILER=gcc-8 UBUNTU=18.04 TEST=ReleasePlain + install: export OS=linux; export COMPILER='gcc-8'; export UBUNTU='18.04'; extras/scripts/travis_ci_install_linux.sh os: linux - script: export OS=linux; export COMPILER='gcc-8'; export UBUNTU='18.10'; extras/scripts/postsubmit.sh + script: export OS=linux; export COMPILER='gcc-8'; export UBUNTU='18.04'; extras/scripts/postsubmit.sh ReleasePlain - compiler: gcc - env: COMPILER=gcc-8 UBUNTU=18.10 TEST=DebugPlain - install: export OS=linux; export COMPILER='gcc-8'; export UBUNTU='18.10'; extras/scripts/travis_ci_install_linux.sh + env: COMPILER=gcc-8 UBUNTU=18.04 TEST=DebugPlain + install: export OS=linux; export COMPILER='gcc-8'; export UBUNTU='18.04'; extras/scripts/travis_ci_install_linux.sh os: linux - script: export OS=linux; export COMPILER='gcc-8'; export UBUNTU='18.10'; extras/scripts/postsubmit.sh + script: export OS=linux; export COMPILER='gcc-8'; export UBUNTU='18.04'; extras/scripts/postsubmit.sh DebugPlain - compiler: clang - env: COMPILER=clang-4.0 STL=libstdc++ UBUNTU=18.10 TEST=ReleasePlain - install: export OS=linux; export COMPILER='clang-4.0'; export STL='libstdc++'; - export UBUNTU='18.10'; extras/scripts/travis_ci_install_linux.sh + env: COMPILER=clang-3.9 STL=libstdc++ UBUNTU=18.04 TEST=ReleasePlain + install: export OS=linux; export COMPILER='clang-3.9'; export STL='libstdc++'; + export UBUNTU='18.04'; extras/scripts/travis_ci_install_linux.sh os: linux - script: export OS=linux; export COMPILER='clang-4.0'; export STL='libstdc++'; - export UBUNTU='18.10'; extras/scripts/postsubmit.sh ReleasePlain + script: export OS=linux; export COMPILER='clang-3.9'; export STL='libstdc++'; + export UBUNTU='18.04'; extras/scripts/postsubmit.sh ReleasePlain - compiler: clang - env: COMPILER=clang-4.0 STL=libstdc++ UBUNTU=18.10 TEST=DebugAsanUbsan - install: export OS=linux; export COMPILER='clang-4.0'; export STL='libstdc++'; - export UBUNTU='18.10'; extras/scripts/travis_ci_install_linux.sh + env: COMPILER=clang-3.9 STL=libstdc++ UBUNTU=18.04 TEST=DebugAsanUbsan + install: export OS=linux; export COMPILER='clang-3.9'; export STL='libstdc++'; + export UBUNTU='18.04'; extras/scripts/travis_ci_install_linux.sh os: linux - script: export OS=linux; export COMPILER='clang-4.0'; export STL='libstdc++'; - export UBUNTU='18.10'; extras/scripts/postsubmit.sh DebugAsanUbsan + script: export OS=linux; export COMPILER='clang-3.9'; export STL='libstdc++'; + export UBUNTU='18.04'; extras/scripts/postsubmit.sh DebugAsanUbsan - compiler: clang - env: COMPILER=clang-7.0 STL=libstdc++ UBUNTU=18.10 TEST=ReleasePlainNoPch + env: COMPILER=clang-7.0 STL=libstdc++ UBUNTU=18.04 TEST=ReleasePlainNoPch install: export OS=linux; export COMPILER='clang-7.0'; export STL='libstdc++'; - export UBUNTU='18.10'; extras/scripts/travis_ci_install_linux.sh + export UBUNTU='18.04'; extras/scripts/travis_ci_install_linux.sh os: linux script: export OS=linux; export COMPILER='clang-7.0'; export STL='libstdc++'; - export UBUNTU='18.10'; extras/scripts/postsubmit.sh ReleasePlainNoPch + export UBUNTU='18.04'; extras/scripts/postsubmit.sh ReleasePlainNoPch - compiler: clang - env: COMPILER=clang-7.0 STL=libstdc++ UBUNTU=18.10 TEST=DebugAsanUbsanNoPch + env: COMPILER=clang-7.0 STL=libstdc++ UBUNTU=18.04 TEST=DebugAsanUbsanNoPch install: export OS=linux; export COMPILER='clang-7.0'; export STL='libstdc++'; - export UBUNTU='18.10'; extras/scripts/travis_ci_install_linux.sh + export UBUNTU='18.04'; extras/scripts/travis_ci_install_linux.sh os: linux script: export OS=linux; export COMPILER='clang-7.0'; export STL='libstdc++'; - export UBUNTU='18.10'; extras/scripts/postsubmit.sh DebugAsanUbsanNoPch + export UBUNTU='18.04'; extras/scripts/postsubmit.sh DebugAsanUbsanNoPch + - compiler: gcc + env: COMPILER=gcc-6 UBUNTU=16.04 TEST=ReleasePlain + install: export OS=linux; export COMPILER='gcc-6'; export UBUNTU='16.04'; extras/scripts/travis_ci_install_linux.sh + os: linux + script: export OS=linux; export COMPILER='gcc-6'; export UBUNTU='16.04'; extras/scripts/postsubmit.sh + ReleasePlain + - compiler: gcc + env: COMPILER=gcc-6 UBUNTU=16.04 TEST=DebugPlain + install: export OS=linux; export COMPILER='gcc-6'; export UBUNTU='16.04'; extras/scripts/travis_ci_install_linux.sh + os: linux + script: export OS=linux; export COMPILER='gcc-6'; export UBUNTU='16.04'; extras/scripts/postsubmit.sh + DebugPlain - compiler: gcc env: COMPILER=gcc-5 UBUNTU=16.04 TEST=ReleasePlain install: export OS=linux; export COMPILER='gcc-5'; export UBUNTU='16.04'; extras/scripts/travis_ci_install_linux.sh diff --git a/extras/scripts/travis_yml_generator.py b/extras/scripts/travis_yml_generator.py index 48bdc7a..7a8aa08 100755 --- a/extras/scripts/travis_yml_generator.py +++ b/extras/scripts/travis_yml_generator.py @@ -146,6 +146,7 @@ def add_bazel_tests(ubuntu_version, smoke_tests=[]): # TODO: re-enable ASan/UBSan once they work in Travis CI. ATM (as of 18 November 2017) they fail due to https://github.com/google/sanitizers/issues/837 +add_ubuntu_tests(ubuntu_version='19.10', compiler='gcc-7', asan=False, ubsan=False) add_ubuntu_tests(ubuntu_version='19.10', compiler='gcc-9', asan=False, ubsan=False, smoke_tests=['DebugPlain', 'ReleasePlain']) add_ubuntu_tests(ubuntu_version='19.10', compiler='clang-6.0', stl='libstdc++', @@ -157,9 +158,10 @@ add_ubuntu_tests(ubuntu_version='19.10', compiler='clang-10.0', stl='libc++', # Disabled due to https://bugs.llvm.org/show_bug.cgi?id=41625. use_precompiled_headers_in_tests=False) -add_ubuntu_tests(ubuntu_version='18.10', compiler='gcc-8', asan=False, ubsan=False) -add_ubuntu_tests(ubuntu_version='18.10', compiler='clang-4.0', stl='libstdc++') -add_ubuntu_tests(ubuntu_version='18.10', compiler='clang-7.0', stl='libstdc++', +add_ubuntu_tests(ubuntu_version='18.04', compiler='gcc-5', asan=False, ubsan=False) +add_ubuntu_tests(ubuntu_version='18.04', compiler='gcc-8', asan=False, ubsan=False) +add_ubuntu_tests(ubuntu_version='18.04', compiler='clang-3.9', stl='libstdc++') +add_ubuntu_tests(ubuntu_version='18.04', compiler='clang-7.0', stl='libstdc++', # Disabled due to https://bugs.llvm.org/show_bug.cgi?id=41625. use_precompiled_headers_in_tests=False) @@ -167,6 +169,7 @@ add_bazel_tests(ubuntu_version='18.04', smoke_tests=['DebugPlain']) # ASan/UBSan are disabled for all these, the analysis on later versions is better anyway. # Also, in some combinations they wouldn't work. +add_ubuntu_tests(ubuntu_version='16.04', compiler='gcc-6', asan=False, ubsan=False) add_ubuntu_tests(ubuntu_version='16.04', compiler='gcc-5', asan=False, ubsan=False) add_ubuntu_tests(ubuntu_version='16.04', compiler='clang-3.5', stl='libstdc++', asan=False, ubsan=False) add_ubuntu_tests(ubuntu_version='16.04', compiler='clang-3.9', stl='libstdc++', asan=False, ubsan=False) -- cgit v1.2.3 From 156e5418107a2c27da3e071cca3a407b9d286e28 Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sun, 29 Mar 2020 10:05:54 -0700 Subject: Don't run CI tests with GCC 6 in Ubuntu 16.04, it's not installed there. --- .travis.yml | 12 ------------ extras/scripts/travis_yml_generator.py | 1 - 2 files changed, 13 deletions(-) diff --git a/.travis.yml b/.travis.yml index ff3458d..5077aeb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -140,18 +140,6 @@ matrix: os: linux script: export OS=linux; export COMPILER='clang-7.0'; export STL='libstdc++'; export UBUNTU='18.04'; extras/scripts/postsubmit.sh DebugAsanUbsanNoPch - - compiler: gcc - env: COMPILER=gcc-6 UBUNTU=16.04 TEST=ReleasePlain - install: export OS=linux; export COMPILER='gcc-6'; export UBUNTU='16.04'; extras/scripts/travis_ci_install_linux.sh - os: linux - script: export OS=linux; export COMPILER='gcc-6'; export UBUNTU='16.04'; extras/scripts/postsubmit.sh - ReleasePlain - - compiler: gcc - env: COMPILER=gcc-6 UBUNTU=16.04 TEST=DebugPlain - install: export OS=linux; export COMPILER='gcc-6'; export UBUNTU='16.04'; extras/scripts/travis_ci_install_linux.sh - os: linux - script: export OS=linux; export COMPILER='gcc-6'; export UBUNTU='16.04'; extras/scripts/postsubmit.sh - DebugPlain - compiler: gcc env: COMPILER=gcc-5 UBUNTU=16.04 TEST=ReleasePlain install: export OS=linux; export COMPILER='gcc-5'; export UBUNTU='16.04'; extras/scripts/travis_ci_install_linux.sh diff --git a/extras/scripts/travis_yml_generator.py b/extras/scripts/travis_yml_generator.py index 7a8aa08..c7a0648 100755 --- a/extras/scripts/travis_yml_generator.py +++ b/extras/scripts/travis_yml_generator.py @@ -169,7 +169,6 @@ add_bazel_tests(ubuntu_version='18.04', smoke_tests=['DebugPlain']) # ASan/UBSan are disabled for all these, the analysis on later versions is better anyway. # Also, in some combinations they wouldn't work. -add_ubuntu_tests(ubuntu_version='16.04', compiler='gcc-6', asan=False, ubsan=False) add_ubuntu_tests(ubuntu_version='16.04', compiler='gcc-5', asan=False, ubsan=False) add_ubuntu_tests(ubuntu_version='16.04', compiler='clang-3.5', stl='libstdc++', asan=False, ubsan=False) add_ubuntu_tests(ubuntu_version='16.04', compiler='clang-3.9', stl='libstdc++', asan=False, ubsan=False) -- cgit v1.2.3 From 08954a9c2fc25abd04d7e52b2f3ecaed7b3db1b6 Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sun, 29 Mar 2020 16:16:25 -0700 Subject: Switch back to Clang 9 for libc++ CI tests, the Clang 10 packages don't work with libc++ for some reason. Also re-enable PCHs for Clang 10 CI tests, the Clang bug requiring them to be off has now been fixed. --- .travis.yml | 20 ++++++++++---------- extras/scripts/travis_yml_generator.py | 7 +++---- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5077aeb..b623906 100644 --- a/.travis.yml +++ b/.travis.yml @@ -61,32 +61,32 @@ matrix: script: export OS=linux; export COMPILER='gcc-7'; export UBUNTU='19.10'; extras/scripts/postsubmit.sh DebugPlain - compiler: clang - env: COMPILER=clang-10.0 STL=libstdc++ UBUNTU=19.10 TEST=ReleasePlainNoPch + env: COMPILER=clang-10.0 STL=libstdc++ UBUNTU=19.10 TEST=ReleasePlain install: export OS=linux; export COMPILER='clang-10.0'; export STL='libstdc++'; export UBUNTU='19.10'; extras/scripts/travis_ci_install_linux.sh os: linux script: export OS=linux; export COMPILER='clang-10.0'; export STL='libstdc++'; - export UBUNTU='19.10'; extras/scripts/postsubmit.sh ReleasePlainNoPch + export UBUNTU='19.10'; extras/scripts/postsubmit.sh ReleasePlain - compiler: clang - env: COMPILER=clang-10.0 STL=libstdc++ UBUNTU=19.10 TEST=DebugAsanUbsanNoPch + env: COMPILER=clang-10.0 STL=libstdc++ UBUNTU=19.10 TEST=DebugAsanUbsan install: export OS=linux; export COMPILER='clang-10.0'; export STL='libstdc++'; export UBUNTU='19.10'; extras/scripts/travis_ci_install_linux.sh os: linux script: export OS=linux; export COMPILER='clang-10.0'; export STL='libstdc++'; - export UBUNTU='19.10'; extras/scripts/postsubmit.sh DebugAsanUbsanNoPch + export UBUNTU='19.10'; extras/scripts/postsubmit.sh DebugAsanUbsan - compiler: clang - env: COMPILER=clang-10.0 STL=libc++ UBUNTU=19.10 TEST=ReleasePlainNoPch - install: export OS=linux; export COMPILER='clang-10.0'; export STL='libc++'; export + env: COMPILER=clang-9.0 STL=libc++ UBUNTU=19.10 TEST=ReleasePlainNoPch + install: export OS=linux; export COMPILER='clang-9.0'; export STL='libc++'; export UBUNTU='19.10'; extras/scripts/travis_ci_install_linux.sh os: linux - script: export OS=linux; export COMPILER='clang-10.0'; export STL='libc++'; export + script: export OS=linux; export COMPILER='clang-9.0'; export STL='libc++'; export UBUNTU='19.10'; extras/scripts/postsubmit.sh ReleasePlainNoPch - compiler: clang - env: COMPILER=clang-10.0 STL=libc++ UBUNTU=19.10 TEST=DebugAsanUbsanNoPch - install: export OS=linux; export COMPILER='clang-10.0'; export STL='libc++'; export + env: COMPILER=clang-9.0 STL=libc++ UBUNTU=19.10 TEST=DebugAsanUbsanNoPch + install: export OS=linux; export COMPILER='clang-9.0'; export STL='libc++'; export UBUNTU='19.10'; extras/scripts/travis_ci_install_linux.sh os: linux - script: export OS=linux; export COMPILER='clang-10.0'; export STL='libc++'; export + script: export OS=linux; export COMPILER='clang-9.0'; export STL='libc++'; export UBUNTU='19.10'; extras/scripts/postsubmit.sh DebugAsanUbsanNoPch - compiler: gcc env: COMPILER=gcc-5 UBUNTU=18.04 TEST=ReleasePlain diff --git a/extras/scripts/travis_yml_generator.py b/extras/scripts/travis_yml_generator.py index c7a0648..d898921 100755 --- a/extras/scripts/travis_yml_generator.py +++ b/extras/scripts/travis_yml_generator.py @@ -151,10 +151,9 @@ add_ubuntu_tests(ubuntu_version='19.10', compiler='gcc-9', asan=False, ubsan=Fal smoke_tests=['DebugPlain', 'ReleasePlain']) add_ubuntu_tests(ubuntu_version='19.10', compiler='clang-6.0', stl='libstdc++', smoke_tests=['DebugPlain', 'DebugAsanUbsan', 'ReleasePlain']) -add_ubuntu_tests(ubuntu_version='19.10', compiler='clang-10.0', stl='libstdc++', - # Disabled due to https://bugs.llvm.org/show_bug.cgi?id=41625. - use_precompiled_headers_in_tests=False) -add_ubuntu_tests(ubuntu_version='19.10', compiler='clang-10.0', stl='libc++', +add_ubuntu_tests(ubuntu_version='19.10', compiler='clang-10.0', stl='libstdc++') +# Using Clang 10 + libc++ doesn't work as of March 2020, it can't find STL headers. +add_ubuntu_tests(ubuntu_version='19.10', compiler='clang-9.0', stl='libc++', # Disabled due to https://bugs.llvm.org/show_bug.cgi?id=41625. use_precompiled_headers_in_tests=False) -- cgit v1.2.3 From c1f47b9df5e8b73f32536fc7c6cdb27ec57eb830 Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sun, 29 Mar 2020 16:23:38 -0700 Subject: Disable a false-positive MSVC warning emitted on Fruit example code from recent versions of MSVC. --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d5d3d1d..3b345a3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -51,7 +51,8 @@ elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "^(MSVC)$") # The warning C4577 is disabled because we don't need a termination guarantee on exceptions for functions marked with # 'noexcept'. # The warning C4530 is disabled because it's triggered by MSVC's STL. - set(FRUIT_ADDITIONAL_COMPILE_FLAGS "${FRUIT_ADDITIONAL_COMPILE_FLAGS} /nologo /FS /W4 /wd4324 /wd4709 /wd4459 /wd4141 /wd4714 /wd4577 /wd4530 /D_SCL_SECURE_NO_WARNINGS") + # The warning C5205 is disabled, MSVC emits it for abstract classes in example code with non-virtual destructors, but we never call delete on those (even though std::default_delete is instantiated for those types). + set(FRUIT_ADDITIONAL_COMPILE_FLAGS "${FRUIT_ADDITIONAL_COMPILE_FLAGS} /nologo /FS /W4 /wd4324 /wd4709 /wd4459 /wd4141 /wd4714 /wd4577 /wd4530 /wd5205 /D_SCL_SECURE_NO_WARNINGS") endif() option(FRUIT_ENABLE_COVERAGE "Enable collection of test coverage. This is meant to be used by Fruit developers. It's only supported when using GCC on Linux." OFF) -- cgit v1.2.3 From 223c79cbe53b06b66c378c4ee0efb17bd596938c Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sun, 29 Mar 2020 16:24:13 -0700 Subject: Disable the clang-tidy bugprone-exception-escape diagnostic, it's emitted for no clear reason on Fruit example code. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3b345a3..3c2041d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -106,7 +106,7 @@ if(${FRUIT_ENABLE_CLANG_TIDY}) set(CMAKE_CXX_CLANG_TIDY clang-tidy; -header-filter=fruit; - -checks=bugprone*,clang-analyzer*,-bugprone-reserved-identifier,-clang-diagnostic-dtor-name; + -checks=bugprone*,clang-analyzer*,-bugprone-reserved-identifier,-bugprone-exception-escape,-clang-diagnostic-dtor-name; -warnings-as-errors=*;) endif() -- cgit v1.2.3 From 3d8b371ebf619c3f952cc25742fe776cddf28d84 Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sun, 29 Mar 2020 16:32:38 -0700 Subject: Disable Clang tidy in libc++ CI tests, it segfaults and can't find STL headers (these issues may or may not be related). --- .travis.yml | 8 ++++---- extras/scripts/travis_yml_generator.py | 4 +++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index b623906..d111db3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -75,19 +75,19 @@ matrix: script: export OS=linux; export COMPILER='clang-10.0'; export STL='libstdc++'; export UBUNTU='19.10'; extras/scripts/postsubmit.sh DebugAsanUbsan - compiler: clang - env: COMPILER=clang-9.0 STL=libc++ UBUNTU=19.10 TEST=ReleasePlainNoPch + env: COMPILER=clang-9.0 STL=libc++ UBUNTU=19.10 TEST=ReleasePlainNoPchNoClangTidy install: export OS=linux; export COMPILER='clang-9.0'; export STL='libc++'; export UBUNTU='19.10'; extras/scripts/travis_ci_install_linux.sh os: linux script: export OS=linux; export COMPILER='clang-9.0'; export STL='libc++'; export - UBUNTU='19.10'; extras/scripts/postsubmit.sh ReleasePlainNoPch + UBUNTU='19.10'; extras/scripts/postsubmit.sh ReleasePlainNoPchNoClangTidy - compiler: clang - env: COMPILER=clang-9.0 STL=libc++ UBUNTU=19.10 TEST=DebugAsanUbsanNoPch + env: COMPILER=clang-9.0 STL=libc++ UBUNTU=19.10 TEST=DebugAsanUbsanNoPchNoClangTidy install: export OS=linux; export COMPILER='clang-9.0'; export STL='libc++'; export UBUNTU='19.10'; extras/scripts/travis_ci_install_linux.sh os: linux script: export OS=linux; export COMPILER='clang-9.0'; export STL='libc++'; export - UBUNTU='19.10'; extras/scripts/postsubmit.sh DebugAsanUbsanNoPch + UBUNTU='19.10'; extras/scripts/postsubmit.sh DebugAsanUbsanNoPchNoClangTidy - compiler: gcc env: COMPILER=gcc-5 UBUNTU=18.04 TEST=ReleasePlain install: export OS=linux; export COMPILER='gcc-5'; export UBUNTU='18.04'; extras/scripts/travis_ci_install_linux.sh diff --git a/extras/scripts/travis_yml_generator.py b/extras/scripts/travis_yml_generator.py index d898921..82c9388 100755 --- a/extras/scripts/travis_yml_generator.py +++ b/extras/scripts/travis_yml_generator.py @@ -155,7 +155,9 @@ add_ubuntu_tests(ubuntu_version='19.10', compiler='clang-10.0', stl='libstdc++') # Using Clang 10 + libc++ doesn't work as of March 2020, it can't find STL headers. add_ubuntu_tests(ubuntu_version='19.10', compiler='clang-9.0', stl='libc++', # Disabled due to https://bugs.llvm.org/show_bug.cgi?id=41625. - use_precompiled_headers_in_tests=False) + use_precompiled_headers_in_tests=False, + # As of March 2020, Clang tidy segfaults and can't find STL headers (not sure if these issues are related or independent). + clang_tidy=False) add_ubuntu_tests(ubuntu_version='18.04', compiler='gcc-5', asan=False, ubsan=False) add_ubuntu_tests(ubuntu_version='18.04', compiler='gcc-8', asan=False, ubsan=False) -- cgit v1.2.3 From 44ad5c363085a61eb6bd41860d555715c08ea07a Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sun, 29 Mar 2020 17:42:14 -0700 Subject: Skip 1 test under MSVC, its error message is bad due to an inconsistent behavior of abstract-class-returning function types. --- tests/test_register_constructor.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/test_register_constructor.py b/tests/test_register_constructor.py index 4e2a4fc..3e5137e 100755 --- a/tests/test_register_constructor.py +++ b/tests/test_register_constructor.py @@ -178,6 +178,10 @@ class TestRegisterConstructor(parameterized.TestCase): source) def test_register_constructor_error_abstract_class(self): + if re.search('MSVC', CXX_COMPILER_NAME) is not None: + # MSVC allows to construct the type X(int*) but SignatureType> doesn't find the + # specialization. + return source = ''' struct X { X(int*) {} @@ -190,7 +194,7 @@ class TestRegisterConstructor(parameterized.TestCase): .registerConstructor(int*)>(); } ''' - if re.search('GNU|MSVC', CXX_COMPILER_NAME) is not None: + if re.search('GNU', CXX_COMPILER_NAME) is not None: expect_generic_compile_error( 'invalid abstract return type' '|.X.: cannot instantiate abstract class', -- cgit v1.2.3 From 0b30aa6de0f182adaa9f837fc23f3fa7604a93ff Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Mon, 30 Mar 2020 21:29:06 -0700 Subject: Enable extra Clang-tidy checks in Fruit code (but not example code) to include all Cland tidy checks that Android uses. --- CMakeLists.txt | 3 ++- examples/CMakeLists.txt | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3c2041d..d12ad47 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -101,12 +101,13 @@ else() set(FRUIT_COMPILE_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG} ${FRUIT_ADDITIONAL_COMPILE_FLAGS}") endif() + set(FRUIT_ENABLE_CLANG_TIDY FALSE CACHE BOOL "Whether to run clang-tidy on the Fruit codebase during the build") if(${FRUIT_ENABLE_CLANG_TIDY}) set(CMAKE_CXX_CLANG_TIDY clang-tidy; -header-filter=fruit; - -checks=bugprone*,clang-analyzer*,-bugprone-reserved-identifier,-bugprone-exception-escape,-clang-diagnostic-dtor-name; + -checks=bugprone*,-bugprone-reserved-identifier,-bugprone-exception-escape,clang-analyzer*,performance*,google*,-google-readability*,-google-runtime-references,clang-diagnostic-unused-command-line-argument,misc-macro-parentheses,-clang-diagnostic-dtor-name; -warnings-as-errors=*;) endif() diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index a00f93c..618340a 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -1,4 +1,13 @@ +# This is a restricted set compared to Fruit's code, the bar for Fruit code is higher. +if(${FRUIT_ENABLE_CLANG_TIDY}) + set(CMAKE_CXX_CLANG_TIDY + clang-tidy; + -header-filter=fruit; + -checks=bugprone*,clang-analyzer*,-bugprone-reserved-identifier,-bugprone-exception-escape,-clang-diagnostic-dtor-name; + -warnings-as-errors=*;) +endif() + add_subdirectory(simple_injection) add_subdirectory(hello_world) -- cgit v1.2.3 From 1bf73e046a2c236a64842f1442e41417223cf68b Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Mon, 30 Mar 2020 22:20:01 -0700 Subject: Fix (or disable) all newly-reported Clang tidy warnings. --- include/fruit/component.h | 25 +++++++++++----------- include/fruit/component_function.h | 6 +++--- include/fruit/impl/component.defn.h | 5 +---- .../component_storage/component_storage.defn.h | 6 +++--- .../impl/component_storage/component_storage.h | 6 +++--- .../component_storage/component_storage_entry.h | 2 +- .../partial_component_storage.defn.h | 12 +++++------ .../fruit/impl/data_structures/arena_allocator.h | 4 ++-- .../data_structures/fixed_size_allocator.defn.h | 6 +++--- .../impl/data_structures/fixed_size_allocator.h | 6 +++--- .../impl/data_structures/fixed_size_vector.defn.h | 4 ++-- .../fruit/impl/data_structures/fixed_size_vector.h | 6 +++--- .../fruit/impl/data_structures/memory_pool.defn.h | 4 ++-- include/fruit/impl/data_structures/memory_pool.h | 4 ++-- .../impl/data_structures/packed_pointer_and_bool.h | 4 ++-- .../fruit/impl/data_structures/semistatic_graph.h | 12 +++++------ .../fruit/impl/data_structures/semistatic_map.h | 4 ++-- .../fruit/impl/injector/injector_storage.defn.h | 2 +- include/fruit/impl/injector/injector_storage.h | 2 +- .../binding_normalization.templates.h | 18 +++++++--------- include/fruit/impl/util/hash_helpers.defn.h | 2 +- include/fruit/impl/util/type_info.defn.h | 2 +- include/fruit/impl/util/type_info.h | 4 ++-- include/fruit/injector.h | 4 ++-- include/fruit/normalized_component.h | 4 ++-- src/binding_normalization.cpp | 12 +++++------ src/fixed_size_allocator.cpp | 2 -- src/injector_storage.cpp | 2 -- src/memory_pool.cpp | 4 +--- src/normalized_component_storage.cpp | 3 --- src/normalized_component_storage_holder.cpp | 3 --- src/semistatic_graph.cpp | 2 -- src/semistatic_map.cpp | 2 -- 33 files changed, 81 insertions(+), 103 deletions(-) diff --git a/include/fruit/component.h b/include/fruit/component.h index 98eb727..cd8be1f 100644 --- a/include/fruit/component.h +++ b/include/fruit/component.h @@ -44,7 +44,7 @@ namespace fruit { template class Component { public: - Component(Component&&) = default; + Component(Component&&) noexcept = default; Component& operator=(Component&&) = delete; Component& operator=(const Component&) = delete; @@ -55,7 +55,7 @@ public: * This is usually called implicitly when returning a component from a function. See PartialComponent for an example. */ template - Component(PartialComponent&& component); + Component(PartialComponent&& component) noexcept; // NOLINT(google-explicit-constructor) private: // Do not use. Use fruit::createComponent() instead. @@ -938,7 +938,8 @@ public: Bindings...> with(ReplacedComponent (*)(FormalArgs...), Args&&... args); - PartialComponentWithReplacementInProgress(storage_t storage) : storage(storage) {} + PartialComponentWithReplacementInProgress(storage_t storage) // NOLINT(google-explicit-constructor) + : storage(storage) {} private: storage_t storage; @@ -1048,7 +1049,14 @@ public: fruit::Component, FormalArgs...> replace(fruit::Component (*)(FormalArgs...), Args&&... args); - ~PartialComponent(); + ~PartialComponent() = default; + + // Do not use. Use fruit::createComponent() instead. + PartialComponent() = delete; + + // Do not use. Only use PartialComponent for temporaries, and then convert it to a Component. + PartialComponent(const PartialComponent&) = delete; + PartialComponent(PartialComponent&&) = delete; private: template @@ -1059,14 +1067,7 @@ private: fruit::impl::PartialComponentStorage storage; - // Do not use. Use fruit::createComponent() instead. - PartialComponent() = delete; - - // Do not use. Only use PartialComponent for temporaries, and then convert it to a Component. - PartialComponent(const PartialComponent&) = delete; - PartialComponent(PartialComponent&&) = delete; - - PartialComponent(fruit::impl::PartialComponentStorage storage); + PartialComponent(fruit::impl::PartialComponentStorage storage); // NOLINT(google-explicit-constructor) template using OpFor = typename fruit::impl::meta::OpForComponent::template AddBinding; diff --git a/include/fruit/component_function.h b/include/fruit/component_function.h index 56b77a1..a86104a 100644 --- a/include/fruit/component_function.h +++ b/include/fruit/component_function.h @@ -34,7 +34,7 @@ private: /** * This is (intentionally) private, use fruit::componentFunction() to construct ComponentFunction objects. */ - ComponentFunction(ComponentType (*getComponent)(ComponentFunctionArgs...), ComponentFunctionArgs... args); + explicit ComponentFunction(ComponentType (*getComponent)(ComponentFunctionArgs...), ComponentFunctionArgs... args); friend struct fruit::impl::ComponentStorageEntry; @@ -45,10 +45,10 @@ public: ComponentType (*getComponent)(ComponentFunctionArgs...), ActualArgs&&... args); ComponentFunction(const ComponentFunction&) = default; - ComponentFunction(ComponentFunction&&) = default; + ComponentFunction(ComponentFunction&&) noexcept = default; ComponentFunction& operator=(const ComponentFunction&) = default; - ComponentFunction& operator=(ComponentFunction&&) = default; + ComponentFunction& operator=(ComponentFunction&&) noexcept = default; ComponentType operator()(); }; diff --git a/include/fruit/impl/component.defn.h b/include/fruit/impl/component.defn.h index 382ecac..ddc4810 100644 --- a/include/fruit/impl/component.defn.h +++ b/include/fruit/impl/component.defn.h @@ -48,7 +48,7 @@ struct OpForComponent { template template -inline Component::Component(PartialComponent&& partial_component) : storage() { +inline Component::Component(PartialComponent&& partial_component) noexcept : storage() { (void)typename fruit::impl::meta::CheckIfError::type(); @@ -77,9 +77,6 @@ inline Component::Component(PartialComponent&& partial_c storage = fruit::impl::ComponentStorage(std::move(entries)); } -template -inline PartialComponent::~PartialComponent() {} - inline PartialComponent<> createComponent() { return {{}}; } diff --git a/include/fruit/impl/component_storage/component_storage.defn.h b/include/fruit/impl/component_storage/component_storage.defn.h index c44efb9..0d0d4ce 100644 --- a/include/fruit/impl/component_storage/component_storage.defn.h +++ b/include/fruit/impl/component_storage/component_storage.defn.h @@ -23,14 +23,14 @@ namespace fruit { namespace impl { -inline ComponentStorage::ComponentStorage(FixedSizeVector&& entries) +inline ComponentStorage::ComponentStorage(FixedSizeVector&& entries) noexcept : entries(std::move(entries)) {} inline ComponentStorage::ComponentStorage(const ComponentStorage& other) { *this = other; } -inline ComponentStorage::ComponentStorage(ComponentStorage&& other) { +inline ComponentStorage::ComponentStorage(ComponentStorage&& other) noexcept { *this = std::move(other); } @@ -64,7 +64,7 @@ inline ComponentStorage& ComponentStorage::operator=(const ComponentStorage& oth return *this; } -inline ComponentStorage& ComponentStorage::operator=(ComponentStorage&& other) { +inline ComponentStorage& ComponentStorage::operator=(ComponentStorage&& other) noexcept { entries = std::move(other.entries); // We don't want other to have any entries after this operation because we might otherwise end up destroying those diff --git a/include/fruit/impl/component_storage/component_storage.h b/include/fruit/impl/component_storage/component_storage.h index 45e3f05..c3f96ae 100644 --- a/include/fruit/impl/component_storage/component_storage.h +++ b/include/fruit/impl/component_storage/component_storage.h @@ -43,9 +43,9 @@ private: public: ComponentStorage() = default; - ComponentStorage(FixedSizeVector&& entries); + explicit ComponentStorage(FixedSizeVector&& entries) noexcept; ComponentStorage(const ComponentStorage&); - ComponentStorage(ComponentStorage&&); + ComponentStorage(ComponentStorage&&) noexcept; ~ComponentStorage(); @@ -54,7 +54,7 @@ public: std::size_t numEntries() const; ComponentStorage& operator=(const ComponentStorage&); - ComponentStorage& operator=(ComponentStorage&&); + ComponentStorage& operator=(ComponentStorage&&) noexcept; }; } // namespace impl diff --git a/include/fruit/impl/component_storage/component_storage_entry.h b/include/fruit/impl/component_storage/component_storage_entry.h index 80e1e48..eb64791 100644 --- a/include/fruit/impl/component_storage/component_storage_entry.h +++ b/include/fruit/impl/component_storage/component_storage_entry.h @@ -238,7 +238,7 @@ struct ComponentStorageEntry { using entry_vector_t = std::vector>; - ComponentInterface(erased_fun_t erased_fun); + explicit ComponentInterface(erased_fun_t erased_fun); virtual ~ComponentInterface() = default; diff --git a/include/fruit/impl/component_storage/partial_component_storage.defn.h b/include/fruit/impl/component_storage/partial_component_storage.defn.h index 18e65e5..0e4b98c 100644 --- a/include/fruit/impl/component_storage/partial_component_storage.defn.h +++ b/include/fruit/impl/component_storage/partial_component_storage.defn.h @@ -46,7 +46,7 @@ private: PartialComponentStorage& previous_storage; public: - PartialComponentStorage(PartialComponentStorage& previous_storage) + PartialComponentStorage(PartialComponentStorage& previous_storage) // NOLINT(google-explicit-constructor) : previous_storage(previous_storage) {} void addBindings(FixedSizeVector& entries) const { @@ -64,7 +64,7 @@ private: PartialComponentStorage& previous_storage; public: - PartialComponentStorage(PartialComponentStorage& previous_storage) + PartialComponentStorage(PartialComponentStorage& previous_storage) // NOLINT(google-explicit-constructor) : previous_storage(previous_storage) {} void addBindings(FixedSizeVector& entries) const { @@ -164,7 +164,7 @@ private: PartialComponentStorage& previous_storage; public: - PartialComponentStorage(PartialComponentStorage& previous_storage) + PartialComponentStorage(PartialComponentStorage& previous_storage) // NOLINT(google-explicit-constructor) : previous_storage(previous_storage) {} void addBindings(FixedSizeVector& entries) const { @@ -279,7 +279,7 @@ private: PartialComponentStorage& previous_storage; public: - PartialComponentStorage(PartialComponentStorage& previous_storage) + PartialComponentStorage(PartialComponentStorage& previous_storage) // NOLINT(google-explicit-constructor) : previous_storage(previous_storage) {} void addBindings(FixedSizeVector& entries) const { @@ -297,7 +297,7 @@ private: PartialComponentStorage& previous_storage; public: - PartialComponentStorage(PartialComponentStorage& previous_storage) + PartialComponentStorage(PartialComponentStorage& previous_storage) // NOLINT(google-explicit-constructor) : previous_storage(previous_storage) {} void addBindings(FixedSizeVector& entries) const { @@ -315,7 +315,7 @@ private: PartialComponentStorage& previous_storage; public: - PartialComponentStorage(PartialComponentStorage& previous_storage) + PartialComponentStorage(PartialComponentStorage& previous_storage) // NOLINT(google-explicit-constructor) : previous_storage(previous_storage) {} void addBindings(FixedSizeVector& entries) const { diff --git a/include/fruit/impl/data_structures/arena_allocator.h b/include/fruit/impl/data_structures/arena_allocator.h index 3ba0521..207455d 100644 --- a/include/fruit/impl/data_structures/arena_allocator.h +++ b/include/fruit/impl/data_structures/arena_allocator.h @@ -53,10 +53,10 @@ public: * Constructs an arena allocator using the specified memory pool. * The MemoryPool object must outlive all allocators constructed with it and all allocated objects. */ - ArenaAllocator(MemoryPool& memory_pool); + explicit ArenaAllocator(MemoryPool& memory_pool); template - ArenaAllocator(const ArenaAllocator&); + ArenaAllocator(const ArenaAllocator&); // NOLINT(google-explicit-constructor) T* allocate(std::size_t n); void deallocate(T* p, std::size_t); diff --git a/include/fruit/impl/data_structures/fixed_size_allocator.defn.h b/include/fruit/impl/data_structures/fixed_size_allocator.defn.h index 7bad811..c5f6faf 100644 --- a/include/fruit/impl/data_structures/fixed_size_allocator.defn.h +++ b/include/fruit/impl/data_structures/fixed_size_allocator.defn.h @@ -98,7 +98,7 @@ inline void FixedSizeAllocator::registerExternallyAllocatedObject(T* p) { on_destruction.push_back(std::pair{destroyExternalObject, p}); } -inline FixedSizeAllocator::FixedSizeAllocator(FixedSizeAllocatorData allocator_data) +inline FixedSizeAllocator::FixedSizeAllocator(const FixedSizeAllocatorData& allocator_data) : on_destruction(allocator_data.num_types_to_destroy) { // The +1 is because we waste the first byte (storage_last_used points to the beginning of storage). storage_begin = new char[allocator_data.total_size + 1]; @@ -113,7 +113,7 @@ inline FixedSizeAllocator::FixedSizeAllocator(FixedSizeAllocatorData allocator_d #endif } -inline FixedSizeAllocator::FixedSizeAllocator(FixedSizeAllocator&& x) : FixedSizeAllocator() { +inline FixedSizeAllocator::FixedSizeAllocator(FixedSizeAllocator&& x) noexcept : FixedSizeAllocator() { std::swap(storage_begin, x.storage_begin); std::swap(storage_last_used, x.storage_last_used); std::swap(on_destruction, x.on_destruction); @@ -122,7 +122,7 @@ inline FixedSizeAllocator::FixedSizeAllocator(FixedSizeAllocator&& x) : FixedSiz #endif } -inline FixedSizeAllocator& FixedSizeAllocator::operator=(FixedSizeAllocator&& x) { +inline FixedSizeAllocator& FixedSizeAllocator::operator=(FixedSizeAllocator&& x) noexcept { std::swap(storage_begin, x.storage_begin); std::swap(storage_last_used, x.storage_last_used); std::swap(on_destruction, x.on_destruction); diff --git a/include/fruit/impl/data_structures/fixed_size_allocator.h b/include/fruit/impl/data_structures/fixed_size_allocator.h index cbc8ca8..1e057d5 100644 --- a/include/fruit/impl/data_structures/fixed_size_allocator.h +++ b/include/fruit/impl/data_structures/fixed_size_allocator.h @@ -89,10 +89,10 @@ public: FixedSizeAllocator() = default; // Constructs an allocator for the type set in FixedSizeAllocatorData. - FixedSizeAllocator(FixedSizeAllocatorData allocator_data); + explicit FixedSizeAllocator(const FixedSizeAllocatorData& allocator_data); - FixedSizeAllocator(FixedSizeAllocator&&); - FixedSizeAllocator& operator=(FixedSizeAllocator&&); + FixedSizeAllocator(FixedSizeAllocator&&) noexcept; + FixedSizeAllocator& operator=(FixedSizeAllocator&&) noexcept; FixedSizeAllocator(const FixedSizeAllocator&) = delete; FixedSizeAllocator& operator=(const FixedSizeAllocator&) = delete; diff --git a/include/fruit/impl/data_structures/fixed_size_vector.defn.h b/include/fruit/impl/data_structures/fixed_size_vector.defn.h index ed8a533..2467571 100644 --- a/include/fruit/impl/data_structures/fixed_size_vector.defn.h +++ b/include/fruit/impl/data_structures/fixed_size_vector.defn.h @@ -48,12 +48,12 @@ inline FixedSizeVector::~FixedSizeVector() { } template -inline FixedSizeVector::FixedSizeVector(FixedSizeVector&& other) : FixedSizeVector() { +inline FixedSizeVector::FixedSizeVector(FixedSizeVector&& other) noexcept : FixedSizeVector() { swap(other); } template -inline FixedSizeVector& FixedSizeVector::operator=(FixedSizeVector&& other) { +inline FixedSizeVector& FixedSizeVector::operator=(FixedSizeVector&& other) noexcept { swap(other); return *this; } diff --git a/include/fruit/impl/data_structures/fixed_size_vector.h b/include/fruit/impl/data_structures/fixed_size_vector.h index 7450bf1..c4fa21b 100644 --- a/include/fruit/impl/data_structures/fixed_size_vector.h +++ b/include/fruit/impl/data_structures/fixed_size_vector.h @@ -44,7 +44,7 @@ public: using iterator = T*; using const_iterator = const T*; - FixedSizeVector(std::size_t capacity = 0, Allocator allocator = Allocator()); + explicit FixedSizeVector(std::size_t capacity = 0, Allocator allocator = Allocator()); // Creates a vector with the specified size (and equal capacity) initialized with the specified value. FixedSizeVector(std::size_t size, const T& value, Allocator allocator = Allocator()); ~FixedSizeVector(); @@ -53,10 +53,10 @@ public: FixedSizeVector(const FixedSizeVector& other) = delete; FixedSizeVector(const FixedSizeVector& other, std::size_t capacity); - FixedSizeVector(FixedSizeVector&& other); + FixedSizeVector(FixedSizeVector&& other) noexcept; FixedSizeVector& operator=(const FixedSizeVector& other) = delete; - FixedSizeVector& operator=(FixedSizeVector&& other); + FixedSizeVector& operator=(FixedSizeVector&& other) noexcept; std::size_t size() const; diff --git a/include/fruit/impl/data_structures/memory_pool.defn.h b/include/fruit/impl/data_structures/memory_pool.defn.h index d4630f9..a104f95 100644 --- a/include/fruit/impl/data_structures/memory_pool.defn.h +++ b/include/fruit/impl/data_structures/memory_pool.defn.h @@ -28,13 +28,13 @@ namespace impl { inline MemoryPool::MemoryPool() : first_free(nullptr), capacity(0) {} -inline MemoryPool::MemoryPool(MemoryPool&& other) +inline MemoryPool::MemoryPool(MemoryPool&& other) noexcept : allocated_chunks(std::move(other.allocated_chunks)), first_free(other.first_free), capacity(other.capacity) { // This is to be sure that we don't double-deallocate. other.allocated_chunks.clear(); } -inline MemoryPool& MemoryPool::operator=(MemoryPool&& other) { +inline MemoryPool& MemoryPool::operator=(MemoryPool&& other) noexcept { destroy(); allocated_chunks = std::move(other.allocated_chunks); diff --git a/include/fruit/impl/data_structures/memory_pool.h b/include/fruit/impl/data_structures/memory_pool.h index 05e4eff..13888dd 100644 --- a/include/fruit/impl/data_structures/memory_pool.h +++ b/include/fruit/impl/data_structures/memory_pool.h @@ -44,9 +44,9 @@ public: MemoryPool(); MemoryPool(const MemoryPool&) = delete; - MemoryPool(MemoryPool&&); + MemoryPool(MemoryPool&&) noexcept; MemoryPool& operator=(const MemoryPool&) = delete; - MemoryPool& operator=(MemoryPool&&); + MemoryPool& operator=(MemoryPool&&) noexcept; ~MemoryPool(); /** diff --git a/include/fruit/impl/data_structures/packed_pointer_and_bool.h b/include/fruit/impl/data_structures/packed_pointer_and_bool.h index 8ac84de..ef65e3c 100644 --- a/include/fruit/impl/data_structures/packed_pointer_and_bool.h +++ b/include/fruit/impl/data_structures/packed_pointer_and_bool.h @@ -41,10 +41,10 @@ public: PackedPointerAndBool() = default; PackedPointerAndBool(const PackedPointerAndBool&) = default; - PackedPointerAndBool(PackedPointerAndBool&&) = default; + PackedPointerAndBool(PackedPointerAndBool&&) noexcept = default; PackedPointerAndBool& operator=(const PackedPointerAndBool&) = default; - PackedPointerAndBool& operator=(PackedPointerAndBool&&) = default; + PackedPointerAndBool& operator=(PackedPointerAndBool&&) noexcept = default; T* getPointer() const; void setPointer(T* p); diff --git a/include/fruit/impl/data_structures/semistatic_graph.h b/include/fruit/impl/data_structures/semistatic_graph.h index 26eaf46..92fd8a2 100644 --- a/include/fruit/impl/data_structures/semistatic_graph.h +++ b/include/fruit/impl/data_structures/semistatic_graph.h @@ -113,7 +113,7 @@ public: friend class SemistaticGraph; - node_iterator(NodeData* itr); + explicit node_iterator(NodeData* itr); public: Node& getNode(); @@ -137,10 +137,10 @@ public: friend class SemistaticGraph; - const_node_iterator(const NodeData* itr); + explicit const_node_iterator(const NodeData* itr); public: - const_node_iterator(node_iterator itr); + explicit const_node_iterator(node_iterator itr); const Node& getNode(); @@ -158,7 +158,7 @@ public: friend class SemistaticGraph; friend class SemistaticGraph::node_iterator; - edge_iterator(InternalNodeId* itr); + explicit edge_iterator(InternalNodeId* itr); public: // getNodeIterator(graph.nodes.begin()) returns the first neighbor. @@ -189,7 +189,7 @@ public: template SemistaticGraph(NodeIter first, NodeIter last, MemoryPool& memory_pool); - SemistaticGraph(SemistaticGraph&&) = default; + SemistaticGraph(SemistaticGraph&&) noexcept = default; SemistaticGraph(const SemistaticGraph&) = delete; /** @@ -208,7 +208,7 @@ public: ~SemistaticGraph(); SemistaticGraph& operator=(const SemistaticGraph&) = delete; - SemistaticGraph& operator=(SemistaticGraph&&) = default; + SemistaticGraph& operator=(SemistaticGraph&&) noexcept = default; // The result is unspecified. The only guarantee is that it's the right value to pass to edge_iterator's // getNodeIterator() methods. diff --git a/include/fruit/impl/data_structures/semistatic_map.h b/include/fruit/impl/data_structures/semistatic_map.h index cd03cc2..c5b4eb4 100644 --- a/include/fruit/impl/data_structures/semistatic_map.h +++ b/include/fruit/impl/data_structures/semistatic_map.h @@ -102,12 +102,12 @@ public: SemistaticMap(const SemistaticMap& map, std::vector>&& new_elements); - SemistaticMap(SemistaticMap&&) = default; + SemistaticMap(SemistaticMap&&) noexcept = default; SemistaticMap(const SemistaticMap&) = delete; ~SemistaticMap(); - SemistaticMap& operator=(SemistaticMap&&) = default; + SemistaticMap& operator=(SemistaticMap&&) noexcept = default; SemistaticMap& operator=(const SemistaticMap&) = delete; // Precondition: `key' must exist in the map. diff --git a/include/fruit/impl/injector/injector_storage.defn.h b/include/fruit/impl/injector/injector_storage.defn.h index 2474ada..7494fce 100644 --- a/include/fruit/impl/injector/injector_storage.defn.h +++ b/include/fruit/impl/injector/injector_storage.defn.h @@ -49,7 +49,7 @@ inline bool InjectorStorage::BindingDataNodeIter::operator!=(const BindingDataNo return itr != other.itr; } -inline std::ptrdiff_t InjectorStorage::BindingDataNodeIter::operator-(BindingDataNodeIter other) const { +inline std::ptrdiff_t InjectorStorage::BindingDataNodeIter::operator-(const BindingDataNodeIter& other) const { return itr - other.itr; } diff --git a/include/fruit/impl/injector/injector_storage.h b/include/fruit/impl/injector/injector_storage.h index e9af2da..eab43d7 100644 --- a/include/fruit/impl/injector/injector_storage.h +++ b/include/fruit/impl/injector/injector_storage.h @@ -218,7 +218,7 @@ public: bool operator==(const BindingDataNodeIter& other) const; bool operator!=(const BindingDataNodeIter& other) const; - std::ptrdiff_t operator-(BindingDataNodeIter other) const; + std::ptrdiff_t operator-(const BindingDataNodeIter& other) const; TypeId getId(); NormalizedBinding getValue(); diff --git a/include/fruit/impl/normalized_component_storage/binding_normalization.templates.h b/include/fruit/impl/normalized_component_storage/binding_normalization.templates.h index 6710ea0..19396c8 100644 --- a/include/fruit/impl/normalized_component_storage/binding_normalization.templates.h +++ b/include/fruit/impl/normalized_component_storage/binding_normalization.templates.h @@ -26,8 +26,6 @@ #include #include -using namespace fruit::impl; - namespace fruit { namespace impl { @@ -193,7 +191,7 @@ BindingNormalization::handleBindingForConstructedObject(BindingNormalizationCont } // New binding, add it to the map. - entry_in_map = std::move(entry); + entry_in_map = entry; } template @@ -227,7 +225,7 @@ FRUIT_ALWAYS_INLINE inline void BindingNormalization::handleBindingForObjectToCo } // New binding, add it to the map. - entry_in_map = std::move(entry); + entry_in_map = entry; } template @@ -261,7 +259,7 @@ FRUIT_ALWAYS_INLINE inline void BindingNormalization::handleBindingForObjectToCo } // New binding, add it to the map. - entry_in_map = std::move(entry); + entry_in_map = entry; } template @@ -313,7 +311,7 @@ BindingNormalization::handleComponentWithoutArgsEndMarker(BindingNormalizationCo // components_with_*_with_expansion_in_progress to fully_expanded_components_*. context.components_with_no_args_with_expansion_in_progress.erase(entry.lazy_component_with_no_args); - context.fully_expanded_components_with_no_args.insert(std::move(entry.lazy_component_with_no_args)); + context.fully_expanded_components_with_no_args.insert(entry.lazy_component_with_no_args); } template @@ -326,14 +324,14 @@ BindingNormalization::handleComponentWithArgsEndMarker(BindingNormalizationConte // components_with_*_with_expansion_in_progress to fully_expanded_components_*. context.components_with_args_with_expansion_in_progress.erase(entry.lazy_component_with_args); - context.fully_expanded_components_with_args.insert(std::move(entry.lazy_component_with_args)); + context.fully_expanded_components_with_args.insert(entry.lazy_component_with_args); } template void BindingNormalization::handleReplacedLazyComponentWithArgs(BindingNormalizationContext& context) { ComponentStorageEntry entry = context.entries_to_process.back(); FruitAssert(entry.kind == ComponentStorageEntry::Kind::REPLACED_LAZY_COMPONENT_WITH_ARGS); - ComponentStorageEntry replaced_component_entry = std::move(entry); + ComponentStorageEntry replaced_component_entry = entry; context.entries_to_process.pop_back(); FruitAssert(!context.entries_to_process.empty()); @@ -379,7 +377,7 @@ template void BindingNormalization::handleReplacedLazyComponentWithNoArgs(BindingNormalizationContext& context) { ComponentStorageEntry entry = context.entries_to_process.back(); FruitAssert(entry.kind == ComponentStorageEntry::Kind::REPLACED_LAZY_COMPONENT_WITH_NO_ARGS); - ComponentStorageEntry replaced_component_entry = std::move(entry); + ComponentStorageEntry replaced_component_entry = entry; context.entries_to_process.pop_back(); FruitAssert(!context.entries_to_process.empty()); @@ -626,7 +624,7 @@ BindingNormalization::performBindingCompression( auto c_binding_data = binding_data_map.find(c_id); FruitAssert(i_binding_data != binding_data_map.end()); FruitAssert(c_binding_data != binding_data_map.end()); - NormalizedComponentStorage::CompressedBindingUndoInfo undo_info; + NormalizedComponentStorage::CompressedBindingUndoInfo undo_info{}; undo_info.i_type_id = i_id; FruitAssert(i_binding_data->second.kind == ComponentStorageEntry::Kind::BINDING_FOR_OBJECT_TO_CONSTRUCT_THAT_NEEDS_NO_ALLOCATION); diff --git a/include/fruit/impl/util/hash_helpers.defn.h b/include/fruit/impl/util/hash_helpers.defn.h index e75ec4a..2f7544c 100644 --- a/include/fruit/impl/util/hash_helpers.defn.h +++ b/include/fruit/impl/util/hash_helpers.defn.h @@ -68,7 +68,7 @@ inline HashMapWithArenaAllocator createHashMapWithArenaAllocatorAndCustomFunctors(size_t capacity, MemoryPool& memory_pool, Hasher hasher, EqualityComparator equality_comparator) { return HashMapWithArenaAllocator( - capacity, hasher, equality_comparator, ArenaAllocator>(memory_pool)); + capacity, hasher, equality_comparator, ArenaAllocator>{memory_pool}); } } // namespace impl diff --git a/include/fruit/impl/util/type_info.defn.h b/include/fruit/impl/util/type_info.defn.h index d52fab0..d077b02 100644 --- a/include/fruit/impl/util/type_info.defn.h +++ b/include/fruit/impl/util/type_info.defn.h @@ -147,7 +147,7 @@ struct GetTypeIdsForListHelper; template struct GetTypeIdsForListHelper> { std::vector> operator()(MemoryPool& memory_pool) { - return std::vector>(std::initializer_list{getTypeId()...}, memory_pool); + return std::vector>(std::initializer_list{getTypeId()...}, ArenaAllocator{memory_pool}); } }; diff --git a/include/fruit/impl/util/type_info.h b/include/fruit/impl/util/type_info.h index 01fb647..5a9d079 100644 --- a/include/fruit/impl/util/type_info.h +++ b/include/fruit/impl/util/type_info.h @@ -42,7 +42,7 @@ struct alignas(1) alignas(void*) TypeInfo { }; // This should only be used if RTTI is disabled. Use the other constructor if possible. - constexpr TypeInfo(ConcreteTypeInfo concrete_type_info); + explicit constexpr TypeInfo(ConcreteTypeInfo concrete_type_info); constexpr TypeInfo(const std::type_info& info, ConcreteTypeInfo concrete_type_info); @@ -64,7 +64,7 @@ private: struct TypeId { const TypeInfo* type_info; - operator std::string() const; + explicit operator std::string() const; bool operator==(TypeId x) const; bool operator!=(TypeId x) const; diff --git a/include/fruit/injector.h b/include/fruit/injector.h index a62f631..e84112a 100644 --- a/include/fruit/injector.h +++ b/include/fruit/injector.h @@ -48,7 +48,7 @@ template class Injector { public: // Moving injectors is allowed. - Injector(Injector&&) = default; + Injector(Injector&&) noexcept = default; // Copying injectors is forbidden. Injector(const Injector&) = delete; @@ -79,7 +79,7 @@ public: * Foo* foo = injector.get(); */ template - Injector(Component (*)(FormalArgs...), Args&&... args); + explicit Injector(Component (*)(FormalArgs...), Args&&... args); /** * This creates an injector from a normalized component and a component function. diff --git a/include/fruit/normalized_component.h b/include/fruit/normalized_component.h index 105edf8..366aef0 100644 --- a/include/fruit/normalized_component.h +++ b/include/fruit/normalized_component.h @@ -111,9 +111,9 @@ public: * The constraints on the argument types (if there are any) are the same as the ones for PartialComponent::install(). */ template - NormalizedComponent(Component (*)(FormalArgs...), Args&&... args); + explicit NormalizedComponent(Component (*)(FormalArgs...), Args&&... args); - NormalizedComponent(NormalizedComponent&&) = default; + NormalizedComponent(NormalizedComponent&&) noexcept = default; NormalizedComponent(const NormalizedComponent&) = delete; NormalizedComponent& operator=(NormalizedComponent&&) = delete; diff --git a/src/binding_normalization.cpp b/src/binding_normalization.cpp index 843ee34..db6ee00 100644 --- a/src/binding_normalization.cpp +++ b/src/binding_normalization.cpp @@ -32,8 +32,6 @@ using std::cout; using std::endl; -using namespace fruit::impl; - namespace fruit { namespace impl { @@ -242,7 +240,7 @@ void BindingNormalization::addMultibindings(std::unordered_mapfirst.multibinding_for_constructed_object.object_ptr; - b.elems.push_back(std::move(normalized_multibinding)); + b.elems.push_back(normalized_multibinding); } break; case ComponentStorageEntry::Kind::MULTIBINDING_FOR_OBJECT_TO_CONSTRUCT_THAT_NEEDS_NO_ALLOCATION: { @@ -250,7 +248,7 @@ void BindingNormalization::addMultibindings(std::unordered_mapfirst.multibinding_for_object_to_construct.create; - b.elems.push_back(std::move(normalized_multibinding)); + b.elems.push_back(normalized_multibinding); } break; case ComponentStorageEntry::Kind::MULTIBINDING_FOR_OBJECT_TO_CONSTRUCT_THAT_NEEDS_ALLOCATION: { @@ -258,7 +256,7 @@ void BindingNormalization::addMultibindings(std::unordered_mapfirst.multibinding_for_object_to_construct.create; - b.elems.push_back(std::move(normalized_multibinding)); + b.elems.push_back(normalized_multibinding); } break; default: @@ -435,9 +433,9 @@ void BindingNormalization::normalizeBindingsAndAddTo( i_binding.kind = ComponentStorageEntry::Kind::BINDING_FOR_OBJECT_TO_CONSTRUCT_THAT_NEEDS_NO_ALLOCATION; i_binding.binding_for_object_to_construct = binding_compression_itr->second.i_binding; - new_bindings_vector.push_back(std::move(c_binding)); + new_bindings_vector.push_back(c_binding); // This TypeId is already in normalized_component.bindings, we overwrite it here. - new_bindings_vector.push_back(std::move(i_binding)); + new_bindings_vector.push_back(i_binding); #if FRUIT_EXTRA_DEBUG std::cout << "InjectorStorage: undoing binding compression for: " << binding_compression_itr->second.i_type_id diff --git a/src/fixed_size_allocator.cpp b/src/fixed_size_allocator.cpp index b490828..2652885 100644 --- a/src/fixed_size_allocator.cpp +++ b/src/fixed_size_allocator.cpp @@ -19,8 +19,6 @@ #include #include -using namespace fruit::impl; - namespace fruit { namespace impl { diff --git a/src/injector_storage.cpp b/src/injector_storage.cpp index 1e77702..af3a14d 100644 --- a/src/injector_storage.cpp +++ b/src/injector_storage.cpp @@ -32,8 +32,6 @@ using std::cout; using std::endl; -using namespace fruit::impl; - namespace fruit { namespace impl { diff --git a/src/memory_pool.cpp b/src/memory_pool.cpp index 1311b2c..03429c2 100644 --- a/src/memory_pool.cpp +++ b/src/memory_pool.cpp @@ -18,9 +18,7 @@ #include -using namespace fruit::impl; - -void MemoryPool::destroy() { +void fruit::impl::MemoryPool::destroy() { for (void* p : allocated_chunks) { operator delete(p); } diff --git a/src/normalized_component_storage.cpp b/src/normalized_component_storage.cpp index 7449ec5..d6d67ec 100644 --- a/src/normalized_component_storage.cpp +++ b/src/normalized_component_storage.cpp @@ -34,9 +34,6 @@ using std::cout; using std::endl; -using namespace fruit; -using namespace fruit::impl; - namespace fruit { namespace impl { diff --git a/src/normalized_component_storage_holder.cpp b/src/normalized_component_storage_holder.cpp index 0629b99..6dececf 100644 --- a/src/normalized_component_storage_holder.cpp +++ b/src/normalized_component_storage_holder.cpp @@ -19,9 +19,6 @@ #include #include -using namespace fruit; -using namespace fruit::impl; - namespace fruit { namespace impl { diff --git a/src/semistatic_graph.cpp b/src/semistatic_graph.cpp index 1b23d70..71952f5 100644 --- a/src/semistatic_graph.cpp +++ b/src/semistatic_graph.cpp @@ -22,8 +22,6 @@ #include #include -using namespace fruit::impl; - // Clang requires the following instantiation to be in its namespace. namespace fruit { namespace impl { diff --git a/src/semistatic_map.cpp b/src/semistatic_map.cpp index 281f34a..15778a0 100644 --- a/src/semistatic_map.cpp +++ b/src/semistatic_map.cpp @@ -22,8 +22,6 @@ #include -using namespace fruit::impl; - // Clang requires the following instantiation to be in its namespace. namespace fruit { namespace impl { -- cgit v1.2.3 From ffc697d0220f5d4ab8f4b3d9342f403d54caee2e Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Mon, 30 Mar 2020 22:42:49 -0700 Subject: Fix a build error reported by old versions of Clang after the previous commit (exception specification of explicitly defaulted move constructor does not match the calculated one). --- include/fruit/impl/injector/injector_storage.h | 1 + .../impl/normalized_component_storage/normalized_component_storage.h | 2 +- .../normalized_component_storage_holder.h | 5 +++-- include/fruit/normalized_component.h | 2 +- src/normalized_component_storage.cpp | 2 +- src/normalized_component_storage_holder.cpp | 2 +- 6 files changed, 8 insertions(+), 6 deletions(-) diff --git a/include/fruit/impl/injector/injector_storage.h b/include/fruit/impl/injector/injector_storage.h index eab43d7..902b43b 100644 --- a/include/fruit/impl/injector/injector_storage.h +++ b/include/fruit/impl/injector/injector_storage.h @@ -26,6 +26,7 @@ #include #include #include +#include namespace fruit { namespace impl { diff --git a/include/fruit/impl/normalized_component_storage/normalized_component_storage.h b/include/fruit/impl/normalized_component_storage/normalized_component_storage.h index 22dc8b1..9ec987e 100644 --- a/include/fruit/impl/normalized_component_storage/normalized_component_storage.h +++ b/include/fruit/impl/normalized_component_storage/normalized_component_storage.h @@ -157,7 +157,7 @@ public: // We don't use the default destructor because that will require the inclusion of // the Boost's hashmap header. We define this in the cpp file instead. - ~NormalizedComponentStorage(); + ~NormalizedComponentStorage() noexcept; }; } // namespace impl diff --git a/include/fruit/impl/normalized_component_storage/normalized_component_storage_holder.h b/include/fruit/impl/normalized_component_storage/normalized_component_storage_holder.h index 180f297..6c07680 100644 --- a/include/fruit/impl/normalized_component_storage/normalized_component_storage_holder.h +++ b/include/fruit/impl/normalized_component_storage/normalized_component_storage_holder.h @@ -45,7 +45,8 @@ public: struct WithUndoableCompression {}; struct WithPermanentCompression {}; - NormalizedComponentStorageHolder() = default; + NormalizedComponentStorageHolder() noexcept = default; + /** * The MemoryPool is only used during construction, the constructed object *can* outlive the memory pool. @@ -62,7 +63,7 @@ public: // We don't use the default destructor because that would require the inclusion of // normalized_component_storage.h. We define this in the cpp file instead. - ~NormalizedComponentStorageHolder(); + ~NormalizedComponentStorageHolder() noexcept; }; } // namespace impl diff --git a/include/fruit/normalized_component.h b/include/fruit/normalized_component.h index 366aef0..e9dca2f 100644 --- a/include/fruit/normalized_component.h +++ b/include/fruit/normalized_component.h @@ -113,7 +113,7 @@ public: template explicit NormalizedComponent(Component (*)(FormalArgs...), Args&&... args); - NormalizedComponent(NormalizedComponent&&) noexcept = default; + NormalizedComponent(NormalizedComponent&& storage) noexcept : storage(std::move(storage.storage)) {} NormalizedComponent(const NormalizedComponent&) = delete; NormalizedComponent& operator=(NormalizedComponent&&) = delete; diff --git a/src/normalized_component_storage.cpp b/src/normalized_component_storage.cpp index d6d67ec..59d01ca 100644 --- a/src/normalized_component_storage.cpp +++ b/src/normalized_component_storage.cpp @@ -91,7 +91,7 @@ NormalizedComponentStorage::NormalizedComponentStorage(ComponentStorage&& compon memory_pool); } -NormalizedComponentStorage::~NormalizedComponentStorage() { +NormalizedComponentStorage::~NormalizedComponentStorage() noexcept { for (auto& x : fully_expanded_components_with_args) { x.destroy(); } diff --git a/src/normalized_component_storage_holder.cpp b/src/normalized_component_storage_holder.cpp index 6dececf..dfc4fd3 100644 --- a/src/normalized_component_storage_holder.cpp +++ b/src/normalized_component_storage_holder.cpp @@ -28,7 +28,7 @@ NormalizedComponentStorageHolder::NormalizedComponentStorageHolder( : storage(new NormalizedComponentStorage(std::move(component), exposed_types, memory_pool, NormalizedComponentStorage::WithUndoableCompression())) {} -NormalizedComponentStorageHolder::~NormalizedComponentStorageHolder() {} +NormalizedComponentStorageHolder::~NormalizedComponentStorageHolder() noexcept {} } // namespace impl } // namespace fruit -- cgit v1.2.3 From b8945ef32610c7c8caaab1719d190e69bc26ddcc Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Mon, 30 Mar 2020 22:49:02 -0700 Subject: Increase the amount of Clang tidy checks that also run for example code (and avoid duplication of the list of checks). --- CMakeLists.txt | 4 +++- examples/CMakeLists.txt | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d12ad47..524d1f3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -101,13 +101,15 @@ else() set(FRUIT_COMPILE_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG} ${FRUIT_ADDITIONAL_COMPILE_FLAGS}") endif() +set(FRUIT_CLANG_TIDY_CHECKS + bugprone*,-bugprone-reserved-identifier,-bugprone-exception-escape,clang-analyzer*,performance*,google*,-google-readability*,-google-runtime-references,clang-diagnostic-unused-command-line-argument,misc-macro-parentheses,-clang-diagnostic-dtor-name) set(FRUIT_ENABLE_CLANG_TIDY FALSE CACHE BOOL "Whether to run clang-tidy on the Fruit codebase during the build") if(${FRUIT_ENABLE_CLANG_TIDY}) set(CMAKE_CXX_CLANG_TIDY clang-tidy; -header-filter=fruit; - -checks=bugprone*,-bugprone-reserved-identifier,-bugprone-exception-escape,clang-analyzer*,performance*,google*,-google-readability*,-google-runtime-references,clang-diagnostic-unused-command-line-argument,misc-macro-parentheses,-clang-diagnostic-dtor-name; + -checks=${FRUIT_CLANG_TIDY_CHECKS}; -warnings-as-errors=*;) endif() diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 618340a..200118d 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -4,7 +4,7 @@ if(${FRUIT_ENABLE_CLANG_TIDY}) set(CMAKE_CXX_CLANG_TIDY clang-tidy; -header-filter=fruit; - -checks=bugprone*,clang-analyzer*,-bugprone-reserved-identifier,-bugprone-exception-escape,-clang-diagnostic-dtor-name; + -checks=${FRUIT_CLANG_TIDY_CHECKS},-google-explicit-constructor,-google-build-using-namespace; -warnings-as-errors=*;) endif() -- cgit v1.2.3 From 2c8435f9321f5158ee6259c6552e5eb9bee5106f Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Tue, 31 Mar 2020 00:11:56 -0700 Subject: Implement a move-assignment operator explicitly to avoid an error in old versions of Clang (exception specification of explicitly defaulted move assignment operator does not match the calculated one). --- include/fruit/component_function.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/fruit/component_function.h b/include/fruit/component_function.h index a86104a..70299ed 100644 --- a/include/fruit/component_function.h +++ b/include/fruit/component_function.h @@ -48,7 +48,10 @@ public: ComponentFunction(ComponentFunction&&) noexcept = default; ComponentFunction& operator=(const ComponentFunction&) = default; - ComponentFunction& operator=(ComponentFunction&&) noexcept = default; + ComponentFunction& operator=(ComponentFunction&& other) noexcept { + args_tuple = std::move(other.args_tuple); + return *this; + } ComponentType operator()(); }; -- cgit v1.2.3 From 87f8d9f3ef18308f18e9484e602649c3b867774c Mon Sep 17 00:00:00 2001 From: Bob Badour Date: Wed, 25 Mar 2020 18:56:31 -0700 Subject: Remove redundant NOTICE copied from LICENSE. Identified using the below shell script: $ find -H . -name LICENSE -type f -print0 | xargs -0 dirname \ | while read dir; do \ if [ -f "${dir}/NOTICE" ] \ && diff "${dir}/LICENSE" "${dir}/NOTICE" >/dev/null; then \ echo "${dir}/NOTICE"; \ fi; \ done Now that http://r.android.com/r/1235427 and http://r.android.com/r/1238719 are merged, LICENSE files copied into NOTICE files are no longer needed. Bug: 67772237 Bug: 68860345 Test: manually built and diffed before and after system image notices Exempt-From-Owner-Approval: janitorial work Change-Id: Ibe00d35558e71db695ffff6e44523a851618623b --- NOTICE | 202 ----------------------------------------------------------------- 1 file changed, 202 deletions(-) delete mode 100644 NOTICE diff --git a/NOTICE b/NOTICE deleted file mode 100644 index 80d612b..0000000 --- a/NOTICE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2014 Google Inc. All rights reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -- cgit v1.2.3 From 0ac041ff302faec7c8218989c86773613a621523 Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Wed, 1 Apr 2020 20:31:04 -0700 Subject: Changes in dockerfiles needed by last few CI-related commits. --- extras/dockerfiles/Dockerfile.ubuntu-17.04 | 10 ------- extras/dockerfiles/Dockerfile.ubuntu-18.10 | 9 ------- extras/dockerfiles/Dockerfile.ubuntu-19.10 | 9 +++++++ extras/dockerfiles/common_install.sh | 2 +- extras/dockerfiles/rebuild_all.sh | 2 +- extras/dockerfiles/ubuntu-16.04_custom.list | 11 -------- extras/dockerfiles/ubuntu-16.04_install.sh | 36 ++++++++++++++++++++----- extras/dockerfiles/ubuntu-17.04_custom.list | 8 ------ extras/dockerfiles/ubuntu-17.04_install.sh | 18 ------------- extras/dockerfiles/ubuntu-18.04_install.sh | 23 ++++++++++++++++ extras/dockerfiles/ubuntu-18.10_custom.list | 0 extras/dockerfiles/ubuntu-18.10_install.sh | 16 ----------- extras/dockerfiles/ubuntu-19.04_install.sh | 14 ++++++++++ extras/dockerfiles/ubuntu-19.10_custom.list | 0 extras/dockerfiles/ubuntu-19.10_install.sh | 29 ++++++++++++++++++++ extras/dockerfiles/ubuntu_arm-16.04_install.sh | 1 + extras/dockerfiles/ubuntu_arm-18.04_custom.list | 8 ------ extras/dockerfiles/ubuntu_arm-18.04_install.sh | 1 + 18 files changed, 109 insertions(+), 88 deletions(-) delete mode 100644 extras/dockerfiles/Dockerfile.ubuntu-17.04 delete mode 100644 extras/dockerfiles/Dockerfile.ubuntu-18.10 create mode 100644 extras/dockerfiles/Dockerfile.ubuntu-19.10 delete mode 100644 extras/dockerfiles/ubuntu-17.04_custom.list delete mode 100644 extras/dockerfiles/ubuntu-17.04_install.sh delete mode 100644 extras/dockerfiles/ubuntu-18.10_custom.list delete mode 100644 extras/dockerfiles/ubuntu-18.10_install.sh create mode 100644 extras/dockerfiles/ubuntu-19.10_custom.list create mode 100644 extras/dockerfiles/ubuntu-19.10_install.sh diff --git a/extras/dockerfiles/Dockerfile.ubuntu-17.04 b/extras/dockerfiles/Dockerfile.ubuntu-17.04 deleted file mode 100644 index ee50dcc..0000000 --- a/extras/dockerfiles/Dockerfile.ubuntu-17.04 +++ /dev/null @@ -1,10 +0,0 @@ -FROM ubuntu:17.04 -MAINTAINER Marco Poletti - -COPY ubuntu-17.04_custom.list /etc/apt/sources.list.d/ -COPY common_install.sh common_cleanup.sh ubuntu-17.04_install.sh / - -RUN sed -i -re 's/([a-z]{2}\.)?archive.ubuntu.com|security.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list; \ - bash -x /common_install.sh && \ - bash -x /ubuntu-17.04_install.sh && \ - bash -x /common_cleanup.sh diff --git a/extras/dockerfiles/Dockerfile.ubuntu-18.10 b/extras/dockerfiles/Dockerfile.ubuntu-18.10 deleted file mode 100644 index 09bd008..0000000 --- a/extras/dockerfiles/Dockerfile.ubuntu-18.10 +++ /dev/null @@ -1,9 +0,0 @@ -FROM ubuntu:18.10 -MAINTAINER Marco Poletti - -COPY ubuntu-18.10_custom.list /etc/apt/sources.list.d/ -COPY common_install.sh common_cleanup.sh ubuntu-18.10_install.sh / - -RUN bash -x /common_install.sh && \ - bash -x /ubuntu-18.10_install.sh && \ - bash -x /common_cleanup.sh diff --git a/extras/dockerfiles/Dockerfile.ubuntu-19.10 b/extras/dockerfiles/Dockerfile.ubuntu-19.10 new file mode 100644 index 0000000..5ee6178 --- /dev/null +++ b/extras/dockerfiles/Dockerfile.ubuntu-19.10 @@ -0,0 +1,9 @@ +FROM ubuntu:19.10 +MAINTAINER Marco Poletti + +COPY ubuntu-19.10_custom.list /etc/apt/sources.list.d/ +COPY common_install.sh common_cleanup.sh ubuntu-19.10_install.sh / + +RUN bash -x /common_install.sh && \ + bash -x /ubuntu-19.10_install.sh && \ + bash -x /common_cleanup.sh diff --git a/extras/dockerfiles/common_install.sh b/extras/dockerfiles/common_install.sh index ba63b2c..1e0b58b 100644 --- a/extras/dockerfiles/common_install.sh +++ b/extras/dockerfiles/common_install.sh @@ -3,7 +3,7 @@ set -e apt-get update -qq -apt-get install -y --no-install-recommends wget gnupg +apt-get install -y --no-install-recommends wget gnupg ca-certificates apt-transport-https wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key | apt-key add - diff --git a/extras/dockerfiles/rebuild_all.sh b/extras/dockerfiles/rebuild_all.sh index 545df07..f84dbbd 100755 --- a/extras/dockerfiles/rebuild_all.sh +++ b/extras/dockerfiles/rebuild_all.sh @@ -7,7 +7,7 @@ docker run --rm --privileged multiarch/qemu-user-static:register --reset COMMANDS=() -for V in 16.04 17.04 18.04 18.10 19.04 16.04 +for V in 16.04 18.04 19.04 16.04 19.10 do C="docker build -t polettimarco/fruit-basesystem:ubuntu-$V -f Dockerfile.ubuntu-$V ." COMMANDS+=("$C || { echo; echo FAILED: '$C'; echo; exit 1; }") diff --git a/extras/dockerfiles/ubuntu-16.04_custom.list b/extras/dockerfiles/ubuntu-16.04_custom.list index 54c95ff..e69de29 100644 --- a/extras/dockerfiles/ubuntu-16.04_custom.list +++ b/extras/dockerfiles/ubuntu-16.04_custom.list @@ -1,11 +0,0 @@ -deb http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu xenial main -deb-src http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu xenial main -deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial main -deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial main -deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-3.8 main -deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial-3.8 main -deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-3.9 main -deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial-3.9 main -deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-4.0 main -deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial-4.0 main -deb [arch=amd64] http://storage.googleapis.com/bazel-apt stable jdk1.8 diff --git a/extras/dockerfiles/ubuntu-16.04_install.sh b/extras/dockerfiles/ubuntu-16.04_install.sh index 4d47e56..071fda1 100644 --- a/extras/dockerfiles/ubuntu-16.04_install.sh +++ b/extras/dockerfiles/ubuntu-16.04_install.sh @@ -2,11 +2,30 @@ set -e -apt-get install -y --no-install-recommends \ - curl +cat </etc/apt/sources.list.d/custom.list +deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial main +deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial main +deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-3.8 main +deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial-3.8 main +deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-3.9 main +deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial-3.9 main +deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-4.0 main +deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial-4.0 main +deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-5.0 main +deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial-5.0 main +deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-6.0 main +deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial-6.0 main +deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-7 main +deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial-7 main +deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-8 main +deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial-8 main +deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-9 main +deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial-9 main +deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-10 main +deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial-10 main +EOF -# For the Bazel repository -curl https://bazel.build/bazel-release.pub.gpg | apt-key add - +apt-get update -qq apt-get install -y --allow-unauthenticated --no-install-recommends \ clang-3.5 \ @@ -15,13 +34,18 @@ apt-get install -y --allow-unauthenticated --no-install-recommends \ clang-3.8 \ clang-3.9 \ clang-4.0 \ + clang-5.0 \ + clang-6.0 \ + clang-7 \ + clang-8 \ + clang-9 \ + clang-10 \ g++-5 \ g++-4.9 \ g++-6 \ python \ - bazel \ git \ - openjdk-8-jdk \ + clang-tidy \ clang-format pip3 install typed_ast diff --git a/extras/dockerfiles/ubuntu-17.04_custom.list b/extras/dockerfiles/ubuntu-17.04_custom.list deleted file mode 100644 index dfafeb4..0000000 --- a/extras/dockerfiles/ubuntu-17.04_custom.list +++ /dev/null @@ -1,8 +0,0 @@ -deb http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu zesty main -deb-src http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu zesty main -deb http://apt.llvm.org/zesty/ llvm-toolchain-zesty main -deb-src http://apt.llvm.org/zesty/ llvm-toolchain-zesty main -deb http://apt.llvm.org/zesty/ llvm-toolchain-zesty-3.9 main -deb-src http://apt.llvm.org/zesty/ llvm-toolchain-zesty-3.9 main -deb http://apt.llvm.org/zesty/ llvm-toolchain-zesty-4.0 main -deb-src http://apt.llvm.org/zesty/ llvm-toolchain-zesty-4.0 main diff --git a/extras/dockerfiles/ubuntu-17.04_install.sh b/extras/dockerfiles/ubuntu-17.04_install.sh deleted file mode 100644 index 6c774ef..0000000 --- a/extras/dockerfiles/ubuntu-17.04_install.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -set -e - -apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 1E9377A2BA9EF27F - -apt-get install -y --allow-unauthenticated --no-install-recommends \ - clang-3.7 \ - clang-3.8 \ - clang-3.9 \ - clang-4.0 \ - g++-5 \ - g++-4.9 \ - g++-6 \ - python \ - clang-format - -pip3 install typed_ast diff --git a/extras/dockerfiles/ubuntu-18.04_install.sh b/extras/dockerfiles/ubuntu-18.04_install.sh index 3d4cde7..7c1aa3d 100644 --- a/extras/dockerfiles/ubuntu-18.04_install.sh +++ b/extras/dockerfiles/ubuntu-18.04_install.sh @@ -10,19 +10,42 @@ curl https://bazel.build/bazel-release.pub.gpg | apt-key add - echo 'deb [arch=amd64] http://storage.googleapis.com/bazel-apt stable jdk1.8' >> /etc/apt/sources.list.d/bazel.list +cat </etc/apt/sources.list.d/custom.list +deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic main +deb-src http://apt.llvm.org/bionic/ llvm-toolchain-bionic main +deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-5.0 main +deb-src http://apt.llvm.org/bionic/ llvm-toolchain-bionic-5.0 main +deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-6.0 main +deb-src http://apt.llvm.org/bionic/ llvm-toolchain-bionic-6.0 main +deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-7 main +deb-src http://apt.llvm.org/bionic/ llvm-toolchain-bionic-7 main +deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-8 main +deb-src http://apt.llvm.org/bionic/ llvm-toolchain-bionic-8 main +deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-9 main +deb-src http://apt.llvm.org/bionic/ llvm-toolchain-bionic-9 main +deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-10 main +deb-src http://apt.llvm.org/bionic/ llvm-toolchain-bionic-10 main +EOF + apt-get update -qq apt-get install -y --allow-unauthenticated --no-install-recommends \ g++-8 \ g++-7 \ + g++-6 \ g++-5 \ clang-3.9 \ clang-4.0 \ clang-5.0 \ clang-6.0 \ + clang-7 \ + clang-8 \ + clang-9 \ + clang-10 \ bazel \ git \ python \ python3-sh \ python3-typed-ast \ + clang-tidy \ clang-format diff --git a/extras/dockerfiles/ubuntu-18.10_custom.list b/extras/dockerfiles/ubuntu-18.10_custom.list deleted file mode 100644 index e69de29..0000000 diff --git a/extras/dockerfiles/ubuntu-18.10_install.sh b/extras/dockerfiles/ubuntu-18.10_install.sh deleted file mode 100644 index 1357b11..0000000 --- a/extras/dockerfiles/ubuntu-18.10_install.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -set -e - -apt-get install -y --allow-unauthenticated --no-install-recommends \ - g++-7 \ - g++-8 \ - g++-5 \ - clang-3.9 \ - clang-4.0 \ - clang-6.0 \ - clang-7 \ - python \ - python3-sh \ - python3-typed-ast \ - clang-format diff --git a/extras/dockerfiles/ubuntu-19.04_install.sh b/extras/dockerfiles/ubuntu-19.04_install.sh index 2f78bdd..076073c 100644 --- a/extras/dockerfiles/ubuntu-19.04_install.sh +++ b/extras/dockerfiles/ubuntu-19.04_install.sh @@ -2,6 +2,19 @@ set -e +cat </etc/apt/sources.list.d/ubuntu-19.10_custom.list +deb http://apt.llvm.org/disco/ llvm-toolchain-disco main +deb-src http://apt.llvm.org/disco/ llvm-toolchain-disco main +# 9 +deb http://apt.llvm.org/disco/ llvm-toolchain-disco-9 main +deb-src http://apt.llvm.org/disco/ llvm-toolchain-disco-9 main +# 10 +deb http://apt.llvm.org/disco/ llvm-toolchain-disco-10 main +deb-src http://apt.llvm.org/disco/ llvm-toolchain-disco-10 main +EOF + +apt-get update + apt-get install -y --allow-unauthenticated --no-install-recommends \ g++-7 \ g++-8 \ @@ -12,4 +25,5 @@ apt-get install -y --allow-unauthenticated --no-install-recommends \ python \ python3-sh \ python3-typed-ast \ + clang-tidy \ clang-format diff --git a/extras/dockerfiles/ubuntu-19.10_custom.list b/extras/dockerfiles/ubuntu-19.10_custom.list new file mode 100644 index 0000000..e69de29 diff --git a/extras/dockerfiles/ubuntu-19.10_install.sh b/extras/dockerfiles/ubuntu-19.10_install.sh new file mode 100644 index 0000000..464c400 --- /dev/null +++ b/extras/dockerfiles/ubuntu-19.10_install.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +set -e + +cat </etc/apt/sources.list.d/ubuntu-19.10_custom.list +deb http://apt.llvm.org/eoan/ llvm-toolchain-eoan main +deb-src http://apt.llvm.org/eoan/ llvm-toolchain-eoan main +deb http://apt.llvm.org/eoan/ llvm-toolchain-eoan-9 main +deb-src http://apt.llvm.org/eoan/ llvm-toolchain-eoan-9 main +deb http://apt.llvm.org/eoan/ llvm-toolchain-eoan-10 main +deb-src http://apt.llvm.org/eoan/ llvm-toolchain-eoan-10 main +EOF + +apt-get update + +apt-get install -y --allow-unauthenticated --no-install-recommends \ + g++-7 \ + g++-8 \ + g++-9 \ + clang-6.0 \ + clang-7 \ + clang-8 \ + clang-9 \ + clang-10 \ + python \ + python3-sh \ + python3-typed-ast \ + clang-tidy \ + clang-format diff --git a/extras/dockerfiles/ubuntu_arm-16.04_install.sh b/extras/dockerfiles/ubuntu_arm-16.04_install.sh index 504b2c0..d692fb4 100644 --- a/extras/dockerfiles/ubuntu_arm-16.04_install.sh +++ b/extras/dockerfiles/ubuntu_arm-16.04_install.sh @@ -12,4 +12,5 @@ apt-get install -y --allow-unauthenticated --no-install-recommends \ g++-4.9 \ g++-6 \ python \ + clang-tidy \ clang-format diff --git a/extras/dockerfiles/ubuntu_arm-18.04_custom.list b/extras/dockerfiles/ubuntu_arm-18.04_custom.list index e347ae1..e69de29 100644 --- a/extras/dockerfiles/ubuntu_arm-18.04_custom.list +++ b/extras/dockerfiles/ubuntu_arm-18.04_custom.list @@ -1,8 +0,0 @@ -#deb [trusted=yes] http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu bionic main -#deb-src [trusted=yes] http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu bionic main -#deb [trusted=yes] http://apt.llvm.org/bionic/ llvm-toolchain-bionic main -#deb-src [trusted=yes] http://apt.llvm.org/bionic/ llvm-toolchain-bionic main -#deb [trusted=yes] http://apt.llvm.org/bionic/ llvm-toolchain-bionic-4.0 main -#deb-src [trusted=yes] http://apt.llvm.org/bionic/ llvm-toolchain-bionic-4.0 main -#deb [trusted=yes] http://apt.llvm.org/bionic/ llvm-toolchain-bionic-5.0 main -#deb-src [trusted=yes] http://apt.llvm.org/bionic/ llvm-toolchain-bionic-5.0 main diff --git a/extras/dockerfiles/ubuntu_arm-18.04_install.sh b/extras/dockerfiles/ubuntu_arm-18.04_install.sh index 8e21982..ea2d240 100644 --- a/extras/dockerfiles/ubuntu_arm-18.04_install.sh +++ b/extras/dockerfiles/ubuntu_arm-18.04_install.sh @@ -13,4 +13,5 @@ apt-get install -y --allow-unauthenticated --no-install-recommends \ python \ python3-sh \ python3-typed-ast \ + clang-tidy \ clang-format -- cgit v1.2.3 From ebb754e514bbdbdfd8acec5d8effe4f6edc63173 Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Wed, 1 Apr 2020 20:47:40 -0700 Subject: Update compiler version in bench definition files with latest compilers. --- extras/benchmark/suites/boost_di.yml | 4 ++-- extras/benchmark/suites/debug.yml | 8 ++++---- extras/benchmark/suites/fruit_full.yml | 4 ++-- extras/benchmark/suites/fruit_mostly_full.yml | 4 ++-- extras/benchmark/suites/fruit_quick.yml | 4 ++-- extras/benchmark/suites/fruit_single.yml | 2 +- extras/benchmark/suites/simple_di_full.yml | 4 ++-- extras/benchmark/suites/simple_di_mostly_full.yml | 4 ++-- 8 files changed, 17 insertions(+), 17 deletions(-) diff --git a/extras/benchmark/suites/boost_di.yml b/extras/benchmark/suites/boost_di.yml index 815991c..f0e1e94 100644 --- a/extras/benchmark/suites/boost_di.yml +++ b/extras/benchmark/suites/boost_di.yml @@ -19,8 +19,8 @@ global: # These values are ignored, they are here just to be referenced below. constants: compilers: &compilers - - "g++-8" - - "clang++-6.0" + - "g++-9" + - "clang++-10" benchmarks: - name: diff --git a/extras/benchmark/suites/debug.yml b/extras/benchmark/suites/debug.yml index 13d6c0b..431f1a9 100644 --- a/extras/benchmark/suites/debug.yml +++ b/extras/benchmark/suites/debug.yml @@ -22,12 +22,12 @@ global: # These values are ignored, they are here just to be referenced below. constants: compilers: &compilers - - "g++-7" - - "clang++-4.0" + - "g++-9" + - "clang++-10" gcc: &gcc - - "g++-7" + - "g++-9" clang: &clang - - "clang++-4.0" + - "clang++-10" benchmarks: - name: "fruit_single_file_compile_time" diff --git a/extras/benchmark/suites/fruit_full.yml b/extras/benchmark/suites/fruit_full.yml index 32ac6d1..262ec32 100644 --- a/extras/benchmark/suites/fruit_full.yml +++ b/extras/benchmark/suites/fruit_full.yml @@ -19,8 +19,8 @@ global: # These values are ignored, they are here just to be referenced below. constants: compilers: &compilers - - "g++-8" - - "clang++-6.0" + - "g++-9" + - "clang++-10" num_classes: &num_classes - 100 - 1000 diff --git a/extras/benchmark/suites/fruit_mostly_full.yml b/extras/benchmark/suites/fruit_mostly_full.yml index e212ac8..dcba6fe 100644 --- a/extras/benchmark/suites/fruit_mostly_full.yml +++ b/extras/benchmark/suites/fruit_mostly_full.yml @@ -19,8 +19,8 @@ global: # These values are ignored, they are here just to be referenced below. constants: compilers: &compilers - - "g++-8" - - "clang++-6.0" + - "g++-9" + - "clang++-10" num_classes: &num_classes - 100 - 1000 diff --git a/extras/benchmark/suites/fruit_quick.yml b/extras/benchmark/suites/fruit_quick.yml index 002e7e8..82bce10 100644 --- a/extras/benchmark/suites/fruit_quick.yml +++ b/extras/benchmark/suites/fruit_quick.yml @@ -19,8 +19,8 @@ global: # These values are ignored, they are here just to be referenced below. constants: compilers: &compilers - - "g++-6" - - "clang++-4.0" + - "g++-9" + - "clang++-10" num_classes: &num_classes - 100 diff --git a/extras/benchmark/suites/fruit_single.yml b/extras/benchmark/suites/fruit_single.yml index d269da9..e030c5e 100644 --- a/extras/benchmark/suites/fruit_single.yml +++ b/extras/benchmark/suites/fruit_single.yml @@ -21,7 +21,7 @@ global: # These values are ignored, they are here just to be referenced below. constants: compilers: &compilers - - "g++-7" + - "g++-9" benchmarks: - name: diff --git a/extras/benchmark/suites/simple_di_full.yml b/extras/benchmark/suites/simple_di_full.yml index 6ed8d0f..b280338 100644 --- a/extras/benchmark/suites/simple_di_full.yml +++ b/extras/benchmark/suites/simple_di_full.yml @@ -22,8 +22,8 @@ global: # These values are ignored, they are here just to be referenced below. constants: compilers: &compilers - - "g++-7" - - "clang++-4.0" + - "g++-9" + - "clang++-10" num_classes: &num_classes - 100 - 1000 diff --git a/extras/benchmark/suites/simple_di_mostly_full.yml b/extras/benchmark/suites/simple_di_mostly_full.yml index a833652..f5587fe 100644 --- a/extras/benchmark/suites/simple_di_mostly_full.yml +++ b/extras/benchmark/suites/simple_di_mostly_full.yml @@ -22,8 +22,8 @@ global: # These values are ignored, they are here just to be referenced below. constants: compilers: &compilers - - "g++-7" - - "clang++-4.0" + - "g++-9" + - "clang++-10" num_classes: &num_classes - 100 -- cgit v1.2.3 From ca3b793b68794cd21d6e3f55d1e4d03c0bfa3f68 Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Wed, 1 Apr 2020 20:50:42 -0700 Subject: Switch Fruit benchmark infra to yaml.safe_load(). yaml.load() now prints a warning (even though there are no security issues, the yaml code is trusted in this case). --- extras/benchmark/format_bench_results.py | 2 +- extras/benchmark/run_benchmarks.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/extras/benchmark/format_bench_results.py b/extras/benchmark/format_bench_results.py index 49c4893..6577a72 100755 --- a/extras/benchmark/format_bench_results.py +++ b/extras/benchmark/format_bench_results.py @@ -314,7 +314,7 @@ def main(): baseline_bench_results = None with open(args.benchmark_tables_definition, 'r') as f: - for table_definition in yaml.load(f)["tables"]: + for table_definition in yaml.safe_load(f)["tables"]: try: fixed_benchmark_params = {dimension_name: make_immutable(dimension_value) for dimension_name, dimension_value in table_definition['benchmark_filter'].items()} table_data = extract_results( diff --git a/extras/benchmark/run_benchmarks.py b/extras/benchmark/run_benchmarks.py index d19232b..640f175 100755 --- a/extras/benchmark/run_benchmarks.py +++ b/extras/benchmark/run_benchmarks.py @@ -690,7 +690,7 @@ def main(): fruit_build_dir = tempfile.gettempdir() + '/fruit-benchmark-build-dir' with open(args.benchmark_definition, 'r') as f: - yaml_file_content = yaml.load(f) + yaml_file_content = yaml.safe_load(f) global_definitions = yaml_file_content['global'] benchmark_definitions = expand_benchmark_definitions(yaml_file_content['benchmarks']) -- cgit v1.2.3 From 2c46687f390c2218224139a55547b1134c5e6ab1 Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Wed, 1 Apr 2020 21:54:29 -0700 Subject: Add type annotations in benchmarking code. --- extras/benchmark/boost_di_source_generator.py | 12 +++-- extras/benchmark/format_bench_results.py | 59 ++++++++++++---------- extras/benchmark/fruit_source_generator.py | 13 +++-- extras/benchmark/generate_benchmark.py | 40 +++++++-------- extras/benchmark/makefile_generator.py | 3 +- extras/benchmark/no_di_library_source_generator.py | 16 +++--- extras/benchmark/run_benchmarks.py | 49 ++++++++++-------- 7 files changed, 107 insertions(+), 85 deletions(-) diff --git a/extras/benchmark/boost_di_source_generator.py b/extras/benchmark/boost_di_source_generator.py index 6a3f91f..76be4ef 100644 --- a/extras/benchmark/boost_di_source_generator.py +++ b/extras/benchmark/boost_di_source_generator.py @@ -11,8 +11,12 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +from typing import Set -def generate_files(injection_graph, generate_runtime_bench_code): +import networkx as nx + + +def generate_files(injection_graph: nx.DiGraph, generate_runtime_bench_code: bool): file_content_by_name = dict() for node_id in injection_graph.nodes_iter(): @@ -27,7 +31,7 @@ def generate_files(injection_graph, generate_runtime_bench_code): return file_content_by_name -def _generate_component_header(component_index, deps): +def _generate_component_header(component_index: int, deps: Set[int]): fields = ''.join(['std::shared_ptr x%s;\n' % (dep, dep) for dep in deps]) component_deps = ''.join([', std::shared_ptr' % dep for dep in deps]) @@ -69,7 +73,7 @@ auto x{component_index}Component = [] {{ """ return template.format(**locals()) -def _generate_component_source(component_index, deps): +def _generate_component_source(component_index: int, deps: Set[int]): param_initializers = ', '.join('x%s(x%s)' % (dep, dep) for dep in deps) if param_initializers: @@ -86,7 +90,7 @@ X{component_index}::X{component_index}({component_deps}) """ return template.format(**locals()) -def _generate_main(injection_graph, toplevel_component, generate_runtime_bench_code): +def _generate_main(injection_graph: nx.DiGraph, toplevel_component: int, generate_runtime_bench_code: bool): include_directives = ''.join('#include "component%s.h"\n' % index for index in injection_graph.nodes_iter()) diff --git a/extras/benchmark/format_bench_results.py b/extras/benchmark/format_bench_results.py index 6577a72..0865d6c 100755 --- a/extras/benchmark/format_bench_results.py +++ b/extras/benchmark/format_bench_results.py @@ -15,11 +15,13 @@ import argparse import json +from typing import Tuple, List, Dict, Union, Callable, Any, Sequence + import yaml from collections import defaultdict -def extract_results(bench_results, fixed_benchmark_params, column_dimension, row_dimension, result_dimension): - table_data = defaultdict(lambda: dict()) +def extract_results(bench_results: List[Dict[str, Dict[Any, Any]]], fixed_benchmark_params: Dict[str, str], column_dimension: str, row_dimension: str, result_dimension: str) -> Dict[str, Dict[str, Dict[str, Any]]]: + table_data = defaultdict(lambda: dict()) # type: Dict[str, Dict[str, Dict[str, Any]]] remaining_dimensions_by_row_column = dict() for bench_result in bench_results: try: @@ -56,13 +58,8 @@ def extract_results(bench_results, fixed_benchmark_params, column_dimension, row raise Exception('While processing %s' % bench_result) from e return table_data - -def identity(x): - return x - - # Takes a 2-dimensional array (list of lists) and prints a markdown table with that content. -def print_markdown_table(table_data): +def print_markdown_table(table_data: List[List[str]]) -> None: max_content_length_by_column = [max([len(str(row[column_index])) for row in table_data]) for column_index in range(len(table_data[0]))] for row_index in range(len(table_data)): @@ -81,7 +78,11 @@ def print_markdown_table(table_data): for column_index in range(len(row))]) + '-|') -def compute_min_max(table_data, row_headers, column_headers): +# A sequence of length 2, with the lower and upper bound of the interval. +# TODO: use a class instead. +Interval = Sequence[float] + +def compute_min_max(table_data, row_headers: List[str], column_headers: List[str]) -> Interval: values_by_row = {row_header: [table_data[row_header][column_header] for column_header in column_headers if column_header in table_data[row_header]] @@ -93,8 +94,7 @@ def compute_min_max(table_data, row_headers, column_headers): for row_header in row_headers]) return (min_in_table, max_in_table) - -def pretty_print_percentage_difference(baseline_value, current_value): +def pretty_print_percentage_difference(baseline_value: Interval, current_value: Interval): baseline_min = baseline_value[0] baseline_max = baseline_value[1] current_min = current_value[0] @@ -108,6 +108,10 @@ def pretty_print_percentage_difference(baseline_value, current_value): else: return "%s - %s" % (percentage_min_s, percentage_max_s) +DimensionPrettyPrinter = Callable[[Any], str] + +IntervalPrettyPrinter = Callable[[Interval, float, float], str] + # Takes a table as a dict of dicts (where each table_data[row_key][column_key] is a confidence interval) and prints it as a markdown table using # the specified pretty print functions for column keys, row keys and values respectively. @@ -117,9 +121,9 @@ def pretty_print_percentage_difference(baseline_value, current_value): def print_confidence_intervals_table(table_name, table_data, baseline_table_data, - column_header_pretty_printer=identity, - row_header_pretty_printer=identity, - value_pretty_printer=identity): + column_header_pretty_printer: DimensionPrettyPrinter, + row_header_pretty_printer: DimensionPrettyPrinter, + value_pretty_printer: IntervalPrettyPrinter): if table_data == {}: print('%s: (no data)' % table_name) return @@ -166,15 +170,15 @@ def print_confidence_intervals_table(table_name, print_markdown_table(table_content) -def format_string_pretty_printer(format_string): - def pretty_print(s): +def format_string_pretty_printer(format_string: str) -> Callable[[str], str]: + def pretty_print(s: str): return format_string % s return pretty_print -def interval_pretty_printer(interval, unit, multiplier): - interval = interval.copy() +def interval_pretty_printer(interval: Interval, unit: str, multiplier: float) -> str: + interval = list(interval) # type: List[Any] interval[0] *= multiplier interval[1] *= multiplier @@ -198,7 +202,7 @@ def interval_pretty_printer(interval, unit, multiplier): # Finds the best unit to represent values in the range [min_value, max_value]. # The units must be specified as an ordered list [multiplier1, ..., multiplierN] -def find_best_unit(units, min_value, max_value): +def find_best_unit(units: List[float], min_value: float, max_value: float) -> float: assert min_value <= max_value if max_value <= units[0]: return units[0] @@ -222,7 +226,7 @@ def find_best_unit(units, min_value, max_value): return units[0] -def time_interval_pretty_printer(time_interval, min_in_table, max_in_table): +def time_interval_pretty_printer(time_interval: Interval, min_in_table: float, max_in_table: float) -> str: sec = 1 milli = 0.001 micro = milli * milli @@ -235,7 +239,7 @@ def time_interval_pretty_printer(time_interval, min_in_table, max_in_table): return interval_pretty_printer(time_interval, unit=unit_name, multiplier=1 / unit) -def file_size_interval_pretty_printer(file_size_interval, min_in_table, max_in_table): +def file_size_interval_pretty_printer(file_size_interval: Interval, min_in_table: float, max_in_table: float) -> str: byte = 1 kb = 1024 mb = kb * kb @@ -254,11 +258,11 @@ def make_immutable(x): return x -def dict_pretty_printer(dict_data): +def dict_pretty_printer(dict_data: List[Dict[str, Union[str, Tuple[str]]]]) -> Callable[[Union[str, Tuple[str]]], str]: if isinstance(dict_data, list): dict_data = {make_immutable(mapping['from']): mapping['to'] for mapping in dict_data} - def pretty_print(s): + def pretty_print(s: Union[str, Tuple[str]]) -> str: if s in dict_data: return dict_data[s] else: @@ -267,7 +271,8 @@ def dict_pretty_printer(dict_data): return pretty_print -def determine_column_pretty_printer(pretty_printer_definition): + +def determine_column_pretty_printer(pretty_printer_definition: Dict[str, Any]) -> DimensionPrettyPrinter: if 'format_string' in pretty_printer_definition: return format_string_pretty_printer(pretty_printer_definition['format_string']) @@ -276,12 +281,10 @@ def determine_column_pretty_printer(pretty_printer_definition): raise Exception("Unrecognized pretty printer description: %s" % pretty_printer_definition) - -def determine_row_pretty_printer(pretty_printer_definition): +def determine_row_pretty_printer(pretty_printer_definition: Dict[str, Any]) -> DimensionPrettyPrinter: return determine_column_pretty_printer(pretty_printer_definition) - -def determine_value_pretty_printer(unit): +def determine_value_pretty_printer(unit: str) -> IntervalPrettyPrinter: if unit == "seconds": return time_interval_pretty_printer if unit == "bytes": diff --git a/extras/benchmark/fruit_source_generator.py b/extras/benchmark/fruit_source_generator.py index 894bd28..fbb7a2b 100644 --- a/extras/benchmark/fruit_source_generator.py +++ b/extras/benchmark/fruit_source_generator.py @@ -11,9 +11,12 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +from typing import Set +import networkx as nx -def generate_files(injection_graph, generate_runtime_bench_code, use_normalized_component=False): + +def generate_files(injection_graph: nx.DiGraph, generate_runtime_bench_code: bool, use_normalized_component: bool=False): if use_normalized_component: assert not generate_runtime_bench_code @@ -30,10 +33,10 @@ def generate_files(injection_graph, generate_runtime_bench_code, use_normalized_ return file_content_by_name -def _get_component_type(component_index): +def _get_component_type(component_index: int): return 'fruit::Component'.format(**locals()) -def _generate_component_header(component_index): +def _generate_component_header(component_index: int): component_type = _get_component_type(component_index) template = """ #ifndef COMPONENT{component_index}_H @@ -54,7 +57,7 @@ struct Interface{component_index} {{ """ return template.format(**locals()) -def _generate_component_source(component_index, deps): +def _generate_component_source(component_index: int, deps: Set[int]): include_directives = ''.join(['#include "component%s.h"\n' % index for index in deps + [component_index]]) fields = ''.join(['Interface%s& x%s;\n' % (dep, dep) @@ -95,7 +98,7 @@ struct X{component_index} : public Interface{component_index} {{ return template.format(**locals()) -def _generate_main(toplevel_component, generate_runtime_bench_code): +def _generate_main(toplevel_component: int, generate_runtime_bench_code: bool): if generate_runtime_bench_code: template = """ #include "component{toplevel_component}.h" diff --git a/extras/benchmark/generate_benchmark.py b/extras/benchmark/generate_benchmark.py index cee0017..a642215 100755 --- a/extras/benchmark/generate_benchmark.py +++ b/extras/benchmark/generate_benchmark.py @@ -24,9 +24,9 @@ import argparse import networkx as nx -def generate_injection_graph(num_components_with_no_deps, - num_components_with_deps, - num_deps): +def generate_injection_graph(num_components_with_no_deps: int, + num_components_with_deps: int, + num_deps: int): injection_graph = nx.DiGraph() num_used_ids = 0 @@ -71,23 +71,23 @@ def generate_injection_graph(num_components_with_no_deps, return injection_graph def generate_benchmark( - di_library, - compiler, - cxx_std, - output_dir, - num_components_with_no_deps, - num_components_with_deps, - num_deps, - generate_runtime_bench_code, - use_exceptions=True, - use_rtti=True, - fruit_build_dir=None, - fruit_sources_dir=None, - boost_di_sources_dir=None, - generate_debuginfo=False, - use_new_delete=False, - use_interfaces=False, - use_normalized_component=False): + di_library: str, + compiler: str, + cxx_std: str, + output_dir: str, + num_components_with_no_deps: int, + num_components_with_deps: int, + num_deps: int, + generate_runtime_bench_code: bool, + use_exceptions: bool=True, + use_rtti: bool=True, + fruit_build_dir: str=None, + fruit_sources_dir: str=None, + boost_di_sources_dir: str=None, + generate_debuginfo: bool=False, + use_new_delete: bool=False, + use_interfaces: bool=False, + use_normalized_component: bool=False): """Generates a sample codebase using the specified DI library, meant for benchmarking. :param boost_di_sources_dir: this is only used if di_library=='boost_di', it can be None otherwise. diff --git a/extras/benchmark/makefile_generator.py b/extras/benchmark/makefile_generator.py index 083fd36..0824355 100644 --- a/extras/benchmark/makefile_generator.py +++ b/extras/benchmark/makefile_generator.py @@ -11,9 +11,10 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +from typing import List -def generate_makefile(cpp_files, executable_name, compile_command, link_command, link_command_suffix): +def generate_makefile(cpp_files: List[str], executable_name: str, compile_command: str, link_command: str, link_command_suffix: str): assert executable_name + '.cpp' in cpp_files, '%s.cpp in %s' % (executable_name, cpp_files) link_rule_template = """ diff --git a/extras/benchmark/no_di_library_source_generator.py b/extras/benchmark/no_di_library_source_generator.py index 2d91d04..fcf03d3 100644 --- a/extras/benchmark/no_di_library_source_generator.py +++ b/extras/benchmark/no_di_library_source_generator.py @@ -12,9 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. import itertools +from typing import Set + import networkx as nx -def generate_files(injection_graph, use_new_delete, use_interfaces, generate_runtime_bench_code): +def generate_files(injection_graph: nx.DiGraph, use_new_delete: bool, use_interfaces: bool, generate_runtime_bench_code: bool): file_content_by_name = dict() for node_id in injection_graph.nodes_iter(): @@ -31,7 +33,7 @@ def generate_files(injection_graph, use_new_delete, use_interfaces, generate_run return file_content_by_name -def _generate_class_interface_header(class_index): +def _generate_class_interface_header(class_index: int): template = """ #ifndef CLASS{class_index}_INTERFACE_H #define CLASS{class_index}_INTERFACE_H @@ -48,7 +50,7 @@ struct Interface{class_index} {{ """ return template.format(**locals()) -def _generate_class_header_with_interfaces(class_index, deps): +def _generate_class_header_with_interfaces(class_index: int, deps: Set[int]): include_directives = ''.join('#include "class%s_interface.h"\n' % index for index in itertools.chain(deps, (class_index,))) fields = ''.join('Interface%s& x%s;\n' % (index, index) @@ -75,7 +77,7 @@ struct Class{class_index} : public Interface{class_index} {{ """ return template.format(**locals()) -def _generate_class_header_without_interfaces(class_index, deps): +def _generate_class_header_without_interfaces(class_index: int, deps: Set[int]): include_directives = ''.join('#include "class%s.h"\n' % index for index in deps) fields = ''.join('Class%s& x%s;\n' % (index, index) @@ -101,7 +103,7 @@ struct Class{class_index} {{ """ return template.format(**locals()) -def _generate_class_cpp_file_with_interfaces(class_index, deps): +def _generate_class_cpp_file_with_interfaces(class_index: int, deps: Set[int]): constructor_params = ', '.join('Interface%s& x%s' % (index, index) for index in deps) field_initializers = ', '.join('x%s(x%s)' % (index, index) @@ -127,7 +129,7 @@ Class{class_index}::~Class{class_index}() {{ """ return template.format(**locals()) -def _generate_class_cpp_file_without_interfaces(class_index, deps): +def _generate_class_cpp_file_without_interfaces(class_index: int, deps: Set[int]): constructor_params = ', '.join('Class%s& x%s' % (index, index) for index in deps) field_initializers = ', '.join('x%s(x%s)' % (index, index) @@ -145,7 +147,7 @@ Class{class_index}::Class{class_index}({constructor_params}) return template.format(**locals()) -def _generate_main(injection_graph, use_interfaces, use_new_delete, generate_runtime_bench_code): +def _generate_main(injection_graph: nx.DiGraph, use_interfaces: bool, use_new_delete: bool, generate_runtime_bench_code: bool): [toplevel_class_index] = [node_id for node_id in injection_graph.nodes_iter() if not injection_graph.predecessors(node_id)] diff --git a/extras/benchmark/run_benchmarks.py b/extras/benchmark/run_benchmarks.py index 640f175..22e625c 100755 --- a/extras/benchmark/run_benchmarks.py +++ b/extras/benchmark/run_benchmarks.py @@ -22,13 +22,14 @@ import tempfile import os import shutil import itertools +from typing import Dict, List, Tuple, Optional, Any, TypeVar, Callable, Iterable + import numpy import subprocess import yaml from numpy import floor, log10 import scipy import multiprocessing -import sh import json import statsmodels.stats.api as stats from generate_benchmark import generate_benchmark @@ -36,7 +37,7 @@ import git from functools import lru_cache as memoize class CommandFailedException(Exception): - def __init__(self, command, stdout, stderr, error_code): + def __init__(self, command: List[str], stdout: str, stderr: str, error_code: str): self.command = command self.stdout = stdout self.stderr = stderr @@ -53,7 +54,7 @@ class CommandFailedException(Exception): {stderr} ''').format(command=self.command, error_code=self.error_code, stdout=self.stdout, stderr=self.stderr) -def run_command(executable, args=[], cwd=None, env=None): +def run_command(executable: str, args: List[Any]=[], cwd: str=None, env: Dict[str, str]=None) -> Tuple[str, str]: args = [str(arg) for arg in args] command = [executable] + args try: @@ -70,7 +71,7 @@ compile_flags = ['-O2', '-DNDEBUG'] make_args = ['-j', multiprocessing.cpu_count() + 1] -def parse_results(result_lines): +def parse_results(result_lines: List[str]) -> Dict[str, float]: """ Parses results from the format: ['Dimension name1 = 123', @@ -89,7 +90,7 @@ def parse_results(result_lines): # We memoize the result since this might be called repeatedly and it's somewhat expensive. @memoize(maxsize=None) -def determine_compiler_name(compiler_executable_name): +def determine_compiler_name(compiler_executable_name: str) -> str: tmpdir = tempfile.gettempdir() + '/fruit-determine-compiler-version-dir' ensure_empty_dir(tmpdir) with open(tmpdir + '/CMakeLists.txt', 'w') as file: @@ -112,7 +113,7 @@ def determine_compiler_name(compiler_executable_name): # Returns a pair (sha256_hash, version_name), where version_name will be None if no version tag was found at HEAD. @memoize(maxsize=None) -def git_repo_info(repo_path): +def git_repo_info(repo_path: str) -> Tuple[str, str]: repo = git.Repo(repo_path) head_tags = [tag.name for tag in repo.tags if tag.commit == repo.head.commit and re.match('v[0-9].*', tag.name)] if head_tags == []: @@ -129,7 +130,7 @@ def git_repo_info(repo_path): # We put the compiler name/version in the results because the same 'compiler' value might refer to different compiler versions # (e.g. if GCC 6.0.0 is installed when benchmarks are run, then it's updated to GCC 6.0.1 and finally the results are formatted, we # want the formatted results to say "GCC 6.0.0" instead of "GCC 6.0.1"). -def add_synthetic_benchmark_parameters(original_benchmark_parameters, path_to_code_under_test): +def add_synthetic_benchmark_parameters(original_benchmark_parameters: Dict[str, Any], path_to_code_under_test: Optional[str]): benchmark_params = original_benchmark_parameters.copy() benchmark_params['compiler_name'] = determine_compiler_name(original_benchmark_parameters['compiler']) if path_to_code_under_test is not None: @@ -140,8 +141,13 @@ def add_synthetic_benchmark_parameters(original_benchmark_parameters, path_to_co return benchmark_params -class SimpleNewDeleteRunTimeBenchmark: - def __init__(self, benchmark_definition, fruit_benchmark_sources_dir): +class Benchmark: + def prepare(self) -> None: ... + def run(self) -> Dict[str, float]: ... + def describe(self) -> str: ... + +class SimpleNewDeleteRunTimeBenchmark(Benchmark): + def __init__(self, benchmark_definition: Dict[str, Any], fruit_benchmark_sources_dir: str): self.benchmark_definition = add_synthetic_benchmark_parameters(benchmark_definition, path_to_code_under_test=None) self.fruit_benchmark_sources_dir = fruit_benchmark_sources_dir @@ -170,8 +176,8 @@ class SimpleNewDeleteRunTimeBenchmark: return self.benchmark_definition -class FruitSingleFileCompileTimeBenchmark: - def __init__(self, benchmark_definition, fruit_sources_dir, fruit_build_dir, fruit_benchmark_sources_dir): +class FruitSingleFileCompileTimeBenchmark(Benchmark): + def __init__(self, benchmark_definition: Dict[str, Any], fruit_sources_dir: str, fruit_build_dir: str, fruit_benchmark_sources_dir: str): self.benchmark_definition = add_synthetic_benchmark_parameters(benchmark_definition, path_to_code_under_test=fruit_sources_dir) self.fruit_sources_dir = fruit_sources_dir self.fruit_build_dir = fruit_build_dir @@ -207,7 +213,7 @@ class FruitSingleFileCompileTimeBenchmark: return self.benchmark_definition -def ensure_empty_dir(dirname): +def ensure_empty_dir(dirname: str): # We start by creating the directory instead of just calling rmtree with ignore_errors=True because that would ignore # all errors, so we might otherwise go ahead even if the directory wasn't properly deleted. os.makedirs(dirname, exist_ok=True) @@ -215,7 +221,7 @@ def ensure_empty_dir(dirname): os.makedirs(dirname) -class GenericGeneratedSourcesBenchmark: +class GenericGeneratedSourcesBenchmark(Benchmark): def __init__(self, di_library, benchmark_definition, @@ -559,13 +565,13 @@ class SimpleDiWithInterfacesAndNewDeleteExecutableSizeBenchmarkWithoutExceptions super().__init__(use_new_delete=True, **kwargs) -def round_to_significant_digits(n, num_significant_digits): +def round_to_significant_digits(n: float, num_significant_digits: int) -> float: if n <= 0: # We special-case this, otherwise the log10 below will fail. return 0 return round(n, num_significant_digits - int(floor(log10(n))) - 1) -def run_benchmark(benchmark, max_runs, timeout_hours, output_file, min_runs=3): +def run_benchmark(benchmark: Benchmark, max_runs: int, timeout_hours: int, output_file: str, min_runs: int=3) -> None: def run_benchmark_once(): print('Running benchmark... ', end='', flush=True) result = benchmark.run() @@ -627,7 +633,7 @@ def run_benchmark(benchmark, max_runs, timeout_hours, output_file, min_runs=3): print() -def expand_benchmark_definition(benchmark_definition): +def expand_benchmark_definition(benchmark_definition: Dict[str, Any]) -> List[Dict[str, Tuple[Any]]]: """ Takes a benchmark definition, e.g.: [{name: 'foo', compiler: ['g++-5', 'g++-6']}, @@ -650,12 +656,15 @@ def expand_benchmark_definition(benchmark_definition): for value_combination in value_combinations] -def expand_benchmark_definitions(benchmark_definitions): +def expand_benchmark_definitions(benchmark_definitions: List[Dict[str, Any]]): return list(itertools.chain(*[expand_benchmark_definition(benchmark_definition) for benchmark_definition in benchmark_definitions])) -def group_by(l, element_to_key): - """Takes a list and returns a dict of sublists, where the elements are grouped using the provided function""" - result = defaultdict(list) +T = TypeVar('T') +K = TypeVar('K') + +def group_by(l: List[T], element_to_key: Callable[[T], K]) -> Iterable[Tuple[K, List[T]]]: + """Takes a list and returns a list of sublists, where the elements are grouped using the provided function""" + result = defaultdict(list) # type: Dict[K, List[T]] for elem in l: result[element_to_key(elem)].append(elem) return result.items() -- cgit v1.2.3 From 46204017ff05d2b17efcb06b1027590e51b6079c Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Wed, 1 Apr 2020 21:59:06 -0700 Subject: Call nx.DiGraph.nodes instead of .nodes_iter(), the latter no longer exists in recent versions of networkx. --- extras/benchmark/boost_di_source_generator.py | 14 +++++++------- extras/benchmark/fruit_source_generator.py | 8 ++++---- extras/benchmark/no_di_library_source_generator.py | 18 +++++++++--------- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/extras/benchmark/boost_di_source_generator.py b/extras/benchmark/boost_di_source_generator.py index 76be4ef..2576e03 100644 --- a/extras/benchmark/boost_di_source_generator.py +++ b/extras/benchmark/boost_di_source_generator.py @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from typing import Set +from typing import List import networkx as nx @@ -19,19 +19,19 @@ import networkx as nx def generate_files(injection_graph: nx.DiGraph, generate_runtime_bench_code: bool): file_content_by_name = dict() - for node_id in injection_graph.nodes_iter(): + for node_id in injection_graph.nodes: deps = injection_graph.successors(node_id) file_content_by_name['component%s.h' % node_id] = _generate_component_header(node_id, deps) file_content_by_name['component%s.cpp' % node_id] = _generate_component_source(node_id, deps) [toplevel_node] = [node_id - for node_id in injection_graph.nodes_iter() + for node_id in injection_graph.nodes if not injection_graph.predecessors(node_id)] file_content_by_name['main.cpp'] = _generate_main(injection_graph, toplevel_node, generate_runtime_bench_code) return file_content_by_name -def _generate_component_header(component_index: int, deps: Set[int]): +def _generate_component_header(component_index: int, deps: List[int]): fields = ''.join(['std::shared_ptr x%s;\n' % (dep, dep) for dep in deps]) component_deps = ''.join([', std::shared_ptr' % dep for dep in deps]) @@ -73,7 +73,7 @@ auto x{component_index}Component = [] {{ """ return template.format(**locals()) -def _generate_component_source(component_index: int, deps: Set[int]): +def _generate_component_source(component_index: int, deps: List[int]): param_initializers = ', '.join('x%s(x%s)' % (dep, dep) for dep in deps) if param_initializers: @@ -92,10 +92,10 @@ X{component_index}::X{component_index}({component_deps}) def _generate_main(injection_graph: nx.DiGraph, toplevel_component: int, generate_runtime_bench_code: bool): include_directives = ''.join('#include "component%s.h"\n' % index - for index in injection_graph.nodes_iter()) + for index in injection_graph.nodes) injector_params = ', '.join('x%sComponent()' % index - for index in injection_graph.nodes_iter()) + for index in injection_graph.nodes) if generate_runtime_bench_code: template = """ diff --git a/extras/benchmark/fruit_source_generator.py b/extras/benchmark/fruit_source_generator.py index fbb7a2b..e0be36f 100644 --- a/extras/benchmark/fruit_source_generator.py +++ b/extras/benchmark/fruit_source_generator.py @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from typing import Set +from typing import List import networkx as nx @@ -22,12 +22,12 @@ def generate_files(injection_graph: nx.DiGraph, generate_runtime_bench_code: boo file_content_by_name = dict() - for node_id in injection_graph.nodes_iter(): + for node_id in injection_graph.nodes: file_content_by_name['component%s.h' % node_id] = _generate_component_header(node_id) file_content_by_name['component%s.cpp' % node_id] = _generate_component_source(node_id, injection_graph.successors(node_id)) [toplevel_node] = [node_id - for node_id in injection_graph.nodes_iter() + for node_id in injection_graph.nodes if not injection_graph.predecessors(node_id)] file_content_by_name['main.cpp'] = _generate_main(toplevel_node, generate_runtime_bench_code) @@ -57,7 +57,7 @@ struct Interface{component_index} {{ """ return template.format(**locals()) -def _generate_component_source(component_index: int, deps: Set[int]): +def _generate_component_source(component_index: int, deps: List[int]): include_directives = ''.join(['#include "component%s.h"\n' % index for index in deps + [component_index]]) fields = ''.join(['Interface%s& x%s;\n' % (dep, dep) diff --git a/extras/benchmark/no_di_library_source_generator.py b/extras/benchmark/no_di_library_source_generator.py index fcf03d3..ccfb624 100644 --- a/extras/benchmark/no_di_library_source_generator.py +++ b/extras/benchmark/no_di_library_source_generator.py @@ -12,14 +12,14 @@ # See the License for the specific language governing permissions and # limitations under the License. import itertools -from typing import Set +from typing import List import networkx as nx def generate_files(injection_graph: nx.DiGraph, use_new_delete: bool, use_interfaces: bool, generate_runtime_bench_code: bool): file_content_by_name = dict() - for node_id in injection_graph.nodes_iter(): + for node_id in injection_graph.nodes: deps = injection_graph.successors(node_id) if use_interfaces: file_content_by_name['class%s_interface.h' % node_id] = _generate_class_interface_header(node_id) @@ -50,7 +50,7 @@ struct Interface{class_index} {{ """ return template.format(**locals()) -def _generate_class_header_with_interfaces(class_index: int, deps: Set[int]): +def _generate_class_header_with_interfaces(class_index: int, deps: List[int]): include_directives = ''.join('#include "class%s_interface.h"\n' % index for index in itertools.chain(deps, (class_index,))) fields = ''.join('Interface%s& x%s;\n' % (index, index) @@ -77,7 +77,7 @@ struct Class{class_index} : public Interface{class_index} {{ """ return template.format(**locals()) -def _generate_class_header_without_interfaces(class_index: int, deps: Set[int]): +def _generate_class_header_without_interfaces(class_index: int, deps: List[int]): include_directives = ''.join('#include "class%s.h"\n' % index for index in deps) fields = ''.join('Class%s& x%s;\n' % (index, index) @@ -103,7 +103,7 @@ struct Class{class_index} {{ """ return template.format(**locals()) -def _generate_class_cpp_file_with_interfaces(class_index: int, deps: Set[int]): +def _generate_class_cpp_file_with_interfaces(class_index: int, deps: List[int]): constructor_params = ', '.join('Interface%s& x%s' % (index, index) for index in deps) field_initializers = ', '.join('x%s(x%s)' % (index, index) @@ -129,7 +129,7 @@ Class{class_index}::~Class{class_index}() {{ """ return template.format(**locals()) -def _generate_class_cpp_file_without_interfaces(class_index: int, deps: Set[int]): +def _generate_class_cpp_file_without_interfaces(class_index: int, deps: List[int]): constructor_params = ', '.join('Class%s& x%s' % (index, index) for index in deps) field_initializers = ', '.join('x%s(x%s)' % (index, index) @@ -149,12 +149,12 @@ Class{class_index}::Class{class_index}({constructor_params}) def _generate_main(injection_graph: nx.DiGraph, use_interfaces: bool, use_new_delete: bool, generate_runtime_bench_code: bool): [toplevel_class_index] = [node_id - for node_id in injection_graph.nodes_iter() + for node_id in injection_graph.nodes if not injection_graph.predecessors(node_id)] if use_interfaces: include_directives = ''.join('#include "class%s.h"\n' % index - for index in injection_graph.nodes_iter()) + for index in injection_graph.nodes) else: include_directives = '#include "class%s.h"\n' % toplevel_class_index @@ -173,7 +173,7 @@ def _generate_main(injection_graph: nx.DiGraph, use_interfaces: bool, use_new_de for class_index in reversed(list(nx.topological_sort(injection_graph)))) void_casts = ''.join('(void) x%s;\n' % index - for index in injection_graph.nodes_iter()) + for index in injection_graph.nodes) if generate_runtime_bench_code: template = """ -- cgit v1.2.3 From 0974365e6554351fbe5ddc3b81ba7ec427c85595 Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Wed, 1 Apr 2020 22:24:19 -0700 Subject: Fix the benchmark code to work with newer versions of networkx where Graph.predecessors and Graph.successors return an iterable instead of a list. --- extras/benchmark/boost_di_source_generator.py | 4 ++-- extras/benchmark/fruit_source_generator.py | 4 ++-- extras/benchmark/no_di_library_source_generator.py | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/extras/benchmark/boost_di_source_generator.py b/extras/benchmark/boost_di_source_generator.py index 2576e03..cf8cf9a 100644 --- a/extras/benchmark/boost_di_source_generator.py +++ b/extras/benchmark/boost_di_source_generator.py @@ -20,13 +20,13 @@ def generate_files(injection_graph: nx.DiGraph, generate_runtime_bench_code: boo file_content_by_name = dict() for node_id in injection_graph.nodes: - deps = injection_graph.successors(node_id) + deps = list(injection_graph.successors(node_id)) file_content_by_name['component%s.h' % node_id] = _generate_component_header(node_id, deps) file_content_by_name['component%s.cpp' % node_id] = _generate_component_source(node_id, deps) [toplevel_node] = [node_id for node_id in injection_graph.nodes - if not injection_graph.predecessors(node_id)] + if not any(True for p in injection_graph.predecessors(node_id))] file_content_by_name['main.cpp'] = _generate_main(injection_graph, toplevel_node, generate_runtime_bench_code) return file_content_by_name diff --git a/extras/benchmark/fruit_source_generator.py b/extras/benchmark/fruit_source_generator.py index e0be36f..f7bc786 100644 --- a/extras/benchmark/fruit_source_generator.py +++ b/extras/benchmark/fruit_source_generator.py @@ -24,11 +24,11 @@ def generate_files(injection_graph: nx.DiGraph, generate_runtime_bench_code: boo for node_id in injection_graph.nodes: file_content_by_name['component%s.h' % node_id] = _generate_component_header(node_id) - file_content_by_name['component%s.cpp' % node_id] = _generate_component_source(node_id, injection_graph.successors(node_id)) + file_content_by_name['component%s.cpp' % node_id] = _generate_component_source(node_id, list(injection_graph.successors(node_id))) [toplevel_node] = [node_id for node_id in injection_graph.nodes - if not injection_graph.predecessors(node_id)] + if not any(True for p in injection_graph.predecessors(node_id))] file_content_by_name['main.cpp'] = _generate_main(toplevel_node, generate_runtime_bench_code) return file_content_by_name diff --git a/extras/benchmark/no_di_library_source_generator.py b/extras/benchmark/no_di_library_source_generator.py index ccfb624..65046a2 100644 --- a/extras/benchmark/no_di_library_source_generator.py +++ b/extras/benchmark/no_di_library_source_generator.py @@ -20,7 +20,7 @@ def generate_files(injection_graph: nx.DiGraph, use_new_delete: bool, use_interf file_content_by_name = dict() for node_id in injection_graph.nodes: - deps = injection_graph.successors(node_id) + deps = list(injection_graph.successors(node_id)) if use_interfaces: file_content_by_name['class%s_interface.h' % node_id] = _generate_class_interface_header(node_id) file_content_by_name['class%s.h' % node_id] = _generate_class_header_with_interfaces(node_id, deps) @@ -150,7 +150,7 @@ Class{class_index}::Class{class_index}({constructor_params}) def _generate_main(injection_graph: nx.DiGraph, use_interfaces: bool, use_new_delete: bool, generate_runtime_bench_code: bool): [toplevel_class_index] = [node_id for node_id in injection_graph.nodes - if not injection_graph.predecessors(node_id)] + if not any(True for p in injection_graph.predecessors(node_id))] if use_interfaces: include_directives = ''.join('#include "class%s.h"\n' % index -- cgit v1.2.3 From 0b318212e7b87d5d94d8dfefdd98d172cf1dc3aa Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Wed, 1 Apr 2020 22:35:42 -0700 Subject: Fix benchmark code to use the new include path for boost-di's scoped extension. --- extras/benchmark/boost_di_source_generator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/benchmark/boost_di_source_generator.py b/extras/benchmark/boost_di_source_generator.py index cf8cf9a..d2858a1 100644 --- a/extras/benchmark/boost_di_source_generator.py +++ b/extras/benchmark/boost_di_source_generator.py @@ -43,7 +43,7 @@ def _generate_component_header(component_index: int, deps: List[int]): #define COMPONENT{component_index}_H #include -#include +#include #include // Example include that the code might use -- cgit v1.2.3 From 097941111fc22ff9f7dd2b6d5d86404e4ce26df0 Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sun, 5 Apr 2020 17:46:14 -0700 Subject: Compile without -Werror so that we can compare Fruit performance of the latest release vs older releases with recent compilers, even if old Fruit versions would emit warnings with those compilers. --- extras/benchmark/generate_benchmark.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extras/benchmark/generate_benchmark.py b/extras/benchmark/generate_benchmark.py index a642215..411e9a6 100755 --- a/extras/benchmark/generate_benchmark.py +++ b/extras/benchmark/generate_benchmark.py @@ -135,8 +135,8 @@ def generate_benchmark( other_compile_flags.append('-fno-exceptions') if not use_rtti: other_compile_flags.append('-fno-rtti') - compile_command = '%s -std=%s -MMD -MP -O2 -W -Wall -Werror -DNDEBUG -ftemplate-depth=10000 %s %s' % (compiler, cxx_std, include_flags, ' '.join(other_compile_flags)) - link_command = '%s -std=%s -O2 -W -Wall -Werror %s %s' % (compiler, cxx_std, rpath_flags, library_dirs_flags) + compile_command = '%s -std=%s -MMD -MP -O2 -W -Wall -DNDEBUG -ftemplate-depth=10000 %s %s' % (compiler, cxx_std, include_flags, ' '.join(other_compile_flags)) + link_command = '%s -std=%s -O2 -W -Wall %s %s' % (compiler, cxx_std, rpath_flags, library_dirs_flags) # GCC requires passing the -lfruit flag *after* all object files to be linked for some reason. link_command_suffix = link_libraries_flags -- cgit v1.2.3 From bff5507afa56b39c59755b6428e9b22c18bfae1e Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sun, 5 Apr 2020 17:47:21 -0700 Subject: Now the benchmarking code continues with other benchmarks if there's an error while running a benchmark or preparing for it (instead of stopping the entire run). --- extras/benchmark/run_benchmarks.py | 54 ++++++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 23 deletions(-) diff --git a/extras/benchmark/run_benchmarks.py b/extras/benchmark/run_benchmarks.py index 22e625c..fa37c0e 100755 --- a/extras/benchmark/run_benchmarks.py +++ b/extras/benchmark/run_benchmarks.py @@ -22,6 +22,7 @@ import tempfile import os import shutil import itertools +import traceback from typing import Dict, List, Tuple, Optional, Any, TypeVar, Callable, Iterable import numpy @@ -711,24 +712,28 @@ def main(): (benchmark_definition['compiler'], tuple(benchmark_definition['additional_cmake_args']))): print('Preparing for benchmarks with the compiler %s, with additional CMake args %s' % (compiler_executable_name, additional_cmake_args)) - # We compute this here (and memoize the result) so that the benchmark's describe() will retrieve the cached - # value instantly. - determine_compiler_name(compiler_executable_name) - - # Build Fruit in fruit_build_dir, so that fruit_build_dir points to a built Fruit (useful for e.g. the config header). - shutil.rmtree(fruit_build_dir, ignore_errors=True) - os.makedirs(fruit_build_dir) - modified_env = os.environ.copy() - modified_env['CXX'] = compiler_executable_name - run_command('cmake', - args=[ - args.fruit_sources_dir, - '-DCMAKE_BUILD_TYPE=Release', - *additional_cmake_args, - ], - cwd=fruit_build_dir, - env=modified_env) - run_command('make', args=make_args, cwd=fruit_build_dir) + try: + # We compute this here (and memoize the result) so that the benchmark's describe() will retrieve the cached + # value instantly. + determine_compiler_name(compiler_executable_name) + + # Build Fruit in fruit_build_dir, so that fruit_build_dir points to a built Fruit (useful for e.g. the config header). + shutil.rmtree(fruit_build_dir, ignore_errors=True) + os.makedirs(fruit_build_dir) + modified_env = os.environ.copy() + modified_env['CXX'] = compiler_executable_name + run_command('cmake', + args=[ + args.fruit_sources_dir, + '-DCMAKE_BUILD_TYPE=Release', + *additional_cmake_args, + ], + cwd=fruit_build_dir, + env=modified_env) + run_command('make', args=make_args, cwd=fruit_build_dir) + except Exception as e: + print('Exception while preparing for benchmarks with the compiler %s, with additional CMake args %s.\n%s\nGoing ahead with the rest.' % (compiler_executable_name, additional_cmake_args, traceback.format_exc())) + continue for benchmark_definition in benchmark_definitions_with_current_config: benchmark_index += 1 @@ -804,11 +809,14 @@ def main(): if benchmark.describe() in previous_run_completed_benchmarks: print("Skipping benchmark that was already run previously (due to --continue-benchmark):", benchmark.describe()) continue - - run_benchmark(benchmark, - output_file=args.output_file, - max_runs=global_definitions['max_runs'], - timeout_hours=global_definitions['max_hours_per_combination']) + + try: + run_benchmark(benchmark, + output_file=args.output_file, + max_runs=global_definitions['max_runs'], + timeout_hours=global_definitions['max_hours_per_combination']) + except Exception as e: + print('Exception while running benchmark: %s.\n%s\nGoing ahead with the rest.' % (benchmark.describe(), traceback.format_exc())) if __name__ == "__main__": -- cgit v1.2.3 From 6776208e2287724e41a2a78a3040fa09a942c7b2 Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sun, 5 Apr 2020 17:48:11 -0700 Subject: Fix the benchmark table yaml definitions (they were broken by the collection of both incremental and absolute compile time metrics). --- extras/benchmark/tables/fruit_internal.yml | 14 ++++++++++++++ extras/benchmark/tables/fruit_wiki.yml | 28 ++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/extras/benchmark/tables/fruit_internal.yml b/extras/benchmark/tables/fruit_internal.yml index 48ac40e..7d4602e 100644 --- a/extras/benchmark/tables/fruit_internal.yml +++ b/extras/benchmark/tables/fruit_internal.yml @@ -110,6 +110,13 @@ tables: num_classes: 100 benchmark_generation_flags: [] additional_cmake_args: [] + name: [ + "fruit_compile_time", + "boost_di_compile_time", + "simple_di_compile_time", + "simple_di_with_interfaces_compile_time", + "simple_di_with_interfaces_and_new_delete_compile_time", + ] columns: dimension: "name" pretty_printer: @@ -129,6 +136,13 @@ tables: num_classes: 100 benchmark_generation_flags: [] additional_cmake_args: [] + name: [ + "fruit_incremental_compile_time", + "boost_di_incremental_compile_time", + "simple_di_incremental_compile_time", + "simple_di_with_interfaces_incremental_compile_time", + "simple_di_with_interfaces_and_new_delete_incremental_compile_time", + ] columns: dimension: "name" pretty_printer: diff --git a/extras/benchmark/tables/fruit_wiki.yml b/extras/benchmark/tables/fruit_wiki.yml index 0af3b3e..294503a 100644 --- a/extras/benchmark/tables/fruit_wiki.yml +++ b/extras/benchmark/tables/fruit_wiki.yml @@ -92,6 +92,13 @@ tables: num_classes: 100 additional_cmake_args: [] benchmark_generation_flags: [] + name: [ + "fruit_compile_time", + "boost_di_compile_time", + "simple_di_compile_time", + "simple_di_with_interfaces_compile_time", + "simple_di_with_interfaces_and_new_delete_compile_time", + ] columns: dimension: "name" pretty_printer: @@ -111,6 +118,13 @@ tables: num_classes: 1000 additional_cmake_args: [] benchmark_generation_flags: [] + name: [ + "fruit_compile_time", + "boost_di_compile_time", + "simple_di_compile_time", + "simple_di_with_interfaces_compile_time", + "simple_di_with_interfaces_and_new_delete_compile_time", + ] columns: dimension: "name" pretty_printer: @@ -130,6 +144,13 @@ tables: num_classes: 100 additional_cmake_args: [] benchmark_generation_flags: [] + name: [ + "fruit_incremental_compile_time", + "boost_di_incremental_compile_time", + "simple_di_incremental_compile_time", + "simple_di_with_interfaces_incremental_compile_time", + "simple_di_with_interfaces_and_new_delete_incremental_compile_time", + ] columns: dimension: "name" pretty_printer: @@ -149,6 +170,13 @@ tables: num_classes: 1000 additional_cmake_args: [] benchmark_generation_flags: [] + name: [ + "fruit_incremental_compile_time", + "boost_di_incremental_compile_time", + "simple_di_incremental_compile_time", + "simple_di_with_interfaces_incremental_compile_time", + "simple_di_with_interfaces_and_new_delete_incremental_compile_time", + ] columns: dimension: "name" pretty_printer: -- cgit v1.2.3 From b726177764f6f4f2468623ccb84e2502062e8ab4 Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sun, 5 Apr 2020 18:03:36 -0700 Subject: Bump the version to 3.5.0. --- CMakeLists.txt | 2 +- conanfile.py | 2 +- extras/packaging/deploy_to_bintray.bat | 2 +- extras/packaging/deploy_to_bintray.sh | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 524d1f3..d5b6a64 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.2) -project(Fruit VERSION 3.4.0 LANGUAGES CXX) +project(Fruit VERSION 3.5.0 LANGUAGES CXX) set(FRUIT_IS_BEING_BUILT_BY_CONAN FALSE CACHE BOOL "This is set in Conan builds.") if("${FRUIT_IS_BEING_BUILT_BY_CONAN}") diff --git a/conanfile.py b/conanfile.py index 9d2c664..9c87a68 100644 --- a/conanfile.py +++ b/conanfile.py @@ -5,7 +5,7 @@ import os class FruitConan(ConanFile): name = "fruit" - version = "3.4.0" + version = "3.5.0" license = "Apache" url = "https://github.com/google/fruit" homepage = "https://github.com/google/fruit" diff --git a/extras/packaging/deploy_to_bintray.bat b/extras/packaging/deploy_to_bintray.bat index 2473343..1a28914 100644 --- a/extras/packaging/deploy_to_bintray.bat +++ b/extras/packaging/deploy_to_bintray.bat @@ -1,4 +1,4 @@ -set FRUIT_VERSION=3.4.0 +set FRUIT_VERSION=354.0 for %%G in (Release Debug) DO CMD /C for %%H in (True False) DO CMD /C for %%I in (True False) DO conan create . google/stable -o fruit:shared=%%H -o fruit:use_boost=%%I -s build_type=%%G diff --git a/extras/packaging/deploy_to_bintray.sh b/extras/packaging/deploy_to_bintray.sh index 31a80c7..0365a6d 100755 --- a/extras/packaging/deploy_to_bintray.sh +++ b/extras/packaging/deploy_to_bintray.sh @@ -1,6 +1,6 @@ #!/bin/bash -FRUIT_VERSION=3.4.0 +FRUIT_VERSION=3.5.0 # To authenticate: # conan user -p -r fruit-bintray polettimarco -- cgit v1.2.3 From ba361e38c95f4099920af63f4c3e7271b5e600c3 Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sun, 5 Apr 2020 18:51:49 -0700 Subject: Add other supported benchmarks to the (yaml) benchmark suites. --- extras/benchmark/suites/debug.yml | 6 ++++++ extras/benchmark/suites/fruit_full.yml | 6 ++++++ extras/benchmark/suites/fruit_mostly_full.yml | 3 +++ extras/benchmark/suites/fruit_quick.yml | 3 +++ extras/benchmark/suites/simple_di_full.yml | 6 ++++++ extras/benchmark/suites/simple_di_mostly_full.yml | 6 ++++++ 6 files changed, 30 insertions(+) diff --git a/extras/benchmark/suites/debug.yml b/extras/benchmark/suites/debug.yml index 431f1a9..d185f3c 100644 --- a/extras/benchmark/suites/debug.yml +++ b/extras/benchmark/suites/debug.yml @@ -47,16 +47,19 @@ benchmarks: - "simple_di_run_time" - "simple_di_startup_time" - "simple_di_executable_size" + - "simple_di_executable_size_without_exceptions_and_rtti" - "simple_di_with_interfaces_compile_time" - "simple_di_with_interfaces_incremental_compile_time" - "simple_di_with_interfaces_run_time" - "simple_di_with_interfaces_startup_time" - "simple_di_with_interfaces_executable_size" + - "simple_di_with_interfaces_executable_size_without_exceptions_and_rtti" - "simple_di_with_interfaces_and_new_delete_compile_time" - "simple_di_with_interfaces_and_new_delete_incremental_compile_time" - "simple_di_with_interfaces_and_new_delete_run_time" - "simple_di_with_interfaces_and_new_delete_startup_time" - "simple_di_with_interfaces_and_new_delete_executable_size" + - "simple_di_with_interfaces_and_new_delete_executable_size_without_exceptions_and_rtti" loop_factor: 0.01 num_classes: - 100 @@ -74,6 +77,7 @@ benchmarks: - "fruit_startup_time" - "fruit_startup_time_with_normalized_component" - "fruit_executable_size" + - "fruit_executable_size_without_exceptions_and_rtti" loop_factor: 0.01 num_classes: - 100 @@ -93,6 +97,7 @@ benchmarks: - "fruit_startup_time" - "fruit_startup_time_with_normalized_component" - "fruit_executable_size" + - "fruit_executable_size_without_exceptions_and_rtti" loop_factor: 0.01 num_classes: - 100 @@ -109,6 +114,7 @@ benchmarks: - "boost_di_run_time" - "boost_di_startup_time" - "boost_di_executable_size" + - "boost_di_executable_size_without_exceptions_and_rtti" loop_factor: 0.01 num_classes: - 100 diff --git a/extras/benchmark/suites/fruit_full.yml b/extras/benchmark/suites/fruit_full.yml index 262ec32..48928c0 100644 --- a/extras/benchmark/suites/fruit_full.yml +++ b/extras/benchmark/suites/fruit_full.yml @@ -43,7 +43,10 @@ benchmarks: - "fruit_compile_time" - "fruit_incremental_compile_time" - "fruit_run_time" + - "fruit_startup_time" + - "fruit_startup_time_with_normalized_component" - "fruit_executable_size" + - "fruit_executable_size_without_exceptions_and_rtti" loop_factor: 1.0 num_classes: *num_classes compiler: *compilers @@ -57,7 +60,10 @@ benchmarks: - "fruit_compile_time" - "fruit_incremental_compile_time" - "fruit_run_time" + - "fruit_startup_time" + - "fruit_startup_time_with_normalized_component" - "fruit_executable_size" + - "fruit_executable_size_without_exceptions_and_rtti" loop_factor: 1.0 num_classes: *num_classes compiler: *compilers diff --git a/extras/benchmark/suites/fruit_mostly_full.yml b/extras/benchmark/suites/fruit_mostly_full.yml index dcba6fe..f77ec41 100644 --- a/extras/benchmark/suites/fruit_mostly_full.yml +++ b/extras/benchmark/suites/fruit_mostly_full.yml @@ -42,7 +42,10 @@ benchmarks: - "fruit_compile_time" - "fruit_incremental_compile_time" - "fruit_run_time" + - "fruit_startup_time" + - "fruit_startup_time_with_normalized_component" - "fruit_executable_size" + - "fruit_executable_size_without_exceptions_and_rtti" loop_factor: 1.0 num_classes: *num_classes compiler: *compilers diff --git a/extras/benchmark/suites/fruit_quick.yml b/extras/benchmark/suites/fruit_quick.yml index 82bce10..b60a60e 100644 --- a/extras/benchmark/suites/fruit_quick.yml +++ b/extras/benchmark/suites/fruit_quick.yml @@ -40,7 +40,10 @@ benchmarks: - "fruit_compile_time" - "fruit_incremental_compile_time" - "fruit_run_time" + - "fruit_startup_time" + - "fruit_startup_time_with_normalized_component" - "fruit_executable_size" + - "fruit_executable_size_without_exceptions_and_rtti" loop_factor: 1.0 num_classes: *num_classes compiler: *compilers diff --git a/extras/benchmark/suites/simple_di_full.yml b/extras/benchmark/suites/simple_di_full.yml index b280338..23113b1 100644 --- a/extras/benchmark/suites/simple_di_full.yml +++ b/extras/benchmark/suites/simple_di_full.yml @@ -34,15 +34,21 @@ benchmarks: - "simple_di_compile_time" - "simple_di_incremental_compile_time" - "simple_di_run_time" + - "simple_di_startup_time" - "simple_di_executable_size" + - "simple_di_executable_size_without_exceptions_and_rtti" - "simple_di_with_interfaces_compile_time" - "simple_di_with_interfaces_incremental_compile_time" - "simple_di_with_interfaces_run_time" + - "simple_di_with_interfaces_startup_time" - "simple_di_with_interfaces_executable_size" + - "simple_di_with_interfaces_executable_size_without_exceptions_and_rtti" - "simple_di_with_interfaces_and_new_delete_compile_time" - "simple_di_with_interfaces_and_new_delete_incremental_compile_time" - "simple_di_with_interfaces_and_new_delete_run_time" + - "simple_di_with_interfaces_and_new_delete_startup_time" - "simple_di_with_interfaces_and_new_delete_executable_size" + - "simple_di_with_interfaces_and_new_delete_executable_size_without_exceptions_and_rtti" loop_factor: 1.0 num_classes: - 100 diff --git a/extras/benchmark/suites/simple_di_mostly_full.yml b/extras/benchmark/suites/simple_di_mostly_full.yml index f5587fe..125feae 100644 --- a/extras/benchmark/suites/simple_di_mostly_full.yml +++ b/extras/benchmark/suites/simple_di_mostly_full.yml @@ -33,15 +33,21 @@ benchmarks: - "simple_di_compile_time" - "simple_di_incremental_compile_time" - "simple_di_run_time" + - "simple_di_startup_time" - "simple_di_executable_size" + - "simple_di_executable_size_without_exceptions_and_rtti" - "simple_di_with_interfaces_compile_time" - "simple_di_with_interfaces_incremental_compile_time" - "simple_di_with_interfaces_run_time" + - "simple_di_with_interfaces_startup_time" - "simple_di_with_interfaces_executable_size" + - "simple_di_with_interfaces_executable_size_without_exceptions_and_rtti" - "simple_di_with_interfaces_and_new_delete_compile_time" - "simple_di_with_interfaces_and_new_delete_incremental_compile_time" - "simple_di_with_interfaces_and_new_delete_run_time" + - "simple_di_with_interfaces_and_new_delete_startup_time" - "simple_di_with_interfaces_and_new_delete_executable_size" + - "simple_di_with_interfaces_and_new_delete_executable_size_without_exceptions_and_rtti" loop_factor: 1.0 num_classes: - 100 -- cgit v1.2.3 From abeb3ad86eda11420568312c5d0d5778868b426d Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sun, 5 Apr 2020 18:56:30 -0700 Subject: Also run benhchmarks with 250 classes, 1000 is too much for Boost.DI. --- extras/benchmark/suites/boost_di.yml | 1 + extras/benchmark/suites/fruit_full.yml | 1 + extras/benchmark/suites/fruit_mostly_full.yml | 1 - extras/benchmark/suites/simple_di_full.yml | 1 + 4 files changed, 3 insertions(+), 1 deletion(-) diff --git a/extras/benchmark/suites/boost_di.yml b/extras/benchmark/suites/boost_di.yml index f0e1e94..e23fd0f 100644 --- a/extras/benchmark/suites/boost_di.yml +++ b/extras/benchmark/suites/boost_di.yml @@ -31,6 +31,7 @@ benchmarks: loop_factor: 1.0 num_classes: - 100 + - 250 - 1000 compiler: *compilers cxx_std: "c++14" diff --git a/extras/benchmark/suites/fruit_full.yml b/extras/benchmark/suites/fruit_full.yml index 48928c0..ca885b2 100644 --- a/extras/benchmark/suites/fruit_full.yml +++ b/extras/benchmark/suites/fruit_full.yml @@ -23,6 +23,7 @@ constants: - "clang++-10" num_classes: &num_classes - 100 + - 250 - 1000 benchmarks: diff --git a/extras/benchmark/suites/fruit_mostly_full.yml b/extras/benchmark/suites/fruit_mostly_full.yml index f77ec41..41cc5e0 100644 --- a/extras/benchmark/suites/fruit_mostly_full.yml +++ b/extras/benchmark/suites/fruit_mostly_full.yml @@ -23,7 +23,6 @@ constants: - "clang++-10" num_classes: &num_classes - 100 - - 1000 benchmarks: - name: "fruit_single_file_compile_time" diff --git a/extras/benchmark/suites/simple_di_full.yml b/extras/benchmark/suites/simple_di_full.yml index 23113b1..1b88d34 100644 --- a/extras/benchmark/suites/simple_di_full.yml +++ b/extras/benchmark/suites/simple_di_full.yml @@ -26,6 +26,7 @@ constants: - "clang++-10" num_classes: &num_classes - 100 + - 250 - 1000 benchmarks: -- cgit v1.2.3 From f99dd9b4ec1aa663f7a5c871eb8660df38d51189 Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sun, 5 Apr 2020 19:23:52 -0700 Subject: Set the CMake flags needed to run benchs without exceptions/RTTI, otherwise they fail to build. --- extras/benchmark/suites/debug.yml | 58 ++++++++++++++++++++--- extras/benchmark/suites/fruit_full.yml | 25 +++++++++- extras/benchmark/suites/fruit_mostly_full.yml | 12 ++++- extras/benchmark/suites/simple_di_full.yml | 17 +++++-- extras/benchmark/suites/simple_di_mostly_full.yml | 17 +++++-- 5 files changed, 114 insertions(+), 15 deletions(-) diff --git a/extras/benchmark/suites/debug.yml b/extras/benchmark/suites/debug.yml index d185f3c..1d18469 100644 --- a/extras/benchmark/suites/debug.yml +++ b/extras/benchmark/suites/debug.yml @@ -47,19 +47,16 @@ benchmarks: - "simple_di_run_time" - "simple_di_startup_time" - "simple_di_executable_size" - - "simple_di_executable_size_without_exceptions_and_rtti" - "simple_di_with_interfaces_compile_time" - "simple_di_with_interfaces_incremental_compile_time" - "simple_di_with_interfaces_run_time" - "simple_di_with_interfaces_startup_time" - "simple_di_with_interfaces_executable_size" - - "simple_di_with_interfaces_executable_size_without_exceptions_and_rtti" - "simple_di_with_interfaces_and_new_delete_compile_time" - "simple_di_with_interfaces_and_new_delete_incremental_compile_time" - "simple_di_with_interfaces_and_new_delete_run_time" - "simple_di_with_interfaces_and_new_delete_startup_time" - "simple_di_with_interfaces_and_new_delete_executable_size" - - "simple_di_with_interfaces_and_new_delete_executable_size_without_exceptions_and_rtti" loop_factor: 0.01 num_classes: - 100 @@ -70,6 +67,20 @@ benchmarks: benchmark_generation_flags: - [] + - name: + - "simple_di_executable_size_without_exceptions_and_rtti" + - "simple_di_with_interfaces_executable_size_without_exceptions_and_rtti" + - "simple_di_with_interfaces_and_new_delete_executable_size_without_exceptions_and_rtti" + loop_factor: 0.01 + num_classes: + - 100 + compiler: *compilers + cxx_std: "c++11" + additional_cmake_args: + - ['-DCMAKE_CXX_FLAGS=-fno-exceptions -fno-rtti'] + benchmark_generation_flags: + - [] + - name: - "fruit_compile_time" - "fruit_incremental_compile_time" @@ -77,7 +88,6 @@ benchmarks: - "fruit_startup_time" - "fruit_startup_time_with_normalized_component" - "fruit_executable_size" - - "fruit_executable_size_without_exceptions_and_rtti" loop_factor: 0.01 num_classes: - 100 @@ -90,6 +100,20 @@ benchmarks: benchmark_generation_flags: - [] + - name: + - "fruit_executable_size_without_exceptions_and_rtti" + loop_factor: 0.01 + num_classes: + - 100 + compiler: *gcc + cxx_std: "c++11" + additional_cmake_args: + - ['-DCMAKE_CXX_FLAGS=-fno-exceptions -fno-rtti'] + - ['-DFRUIT_USES_BOOST=False', '-DCMAKE_CXX_FLAGS=-fno-exceptions -fno-rtti'] + - ["-DBUILD_SHARED_LIBS=False", '-DCMAKE_CXX_FLAGS=-fno-exceptions -fno-rtti'] + benchmark_generation_flags: + - [] + - name: - "fruit_compile_time" - "fruit_incremental_compile_time" @@ -97,7 +121,6 @@ benchmarks: - "fruit_startup_time" - "fruit_startup_time_with_normalized_component" - "fruit_executable_size" - - "fruit_executable_size_without_exceptions_and_rtti" loop_factor: 0.01 num_classes: - 100 @@ -108,13 +131,24 @@ benchmarks: benchmark_generation_flags: - [] + - name: + - "fruit_executable_size_without_exceptions_and_rtti" + loop_factor: 0.01 + num_classes: + - 100 + compiler: *clang + cxx_std: "c++11" + additional_cmake_args: + - ['-DCMAKE_CXX_FLAGS=-fno-exceptions -fno-rtti'] + benchmark_generation_flags: + - [] + - name: - "boost_di_compile_time" - "boost_di_incremental_compile_time" - "boost_di_run_time" - "boost_di_startup_time" - "boost_di_executable_size" - - "boost_di_executable_size_without_exceptions_and_rtti" loop_factor: 0.01 num_classes: - 100 @@ -124,3 +158,15 @@ benchmarks: - [] benchmark_generation_flags: - [] + + - name: + - "boost_di_executable_size_without_exceptions_and_rtti" + loop_factor: 0.01 + num_classes: + - 100 + compiler: *compilers + cxx_std: "c++14" + additional_cmake_args: + - ['-DCMAKE_CXX_FLAGS=-fno-exceptions -fno-rtti'] + benchmark_generation_flags: + - [] diff --git a/extras/benchmark/suites/fruit_full.yml b/extras/benchmark/suites/fruit_full.yml index ca885b2..84a604e 100644 --- a/extras/benchmark/suites/fruit_full.yml +++ b/extras/benchmark/suites/fruit_full.yml @@ -47,7 +47,6 @@ benchmarks: - "fruit_startup_time" - "fruit_startup_time_with_normalized_component" - "fruit_executable_size" - - "fruit_executable_size_without_exceptions_and_rtti" loop_factor: 1.0 num_classes: *num_classes compiler: *compilers @@ -57,6 +56,17 @@ benchmarks: benchmark_generation_flags: - [] + - name: + - "fruit_executable_size_without_exceptions_and_rtti" + loop_factor: 1.0 + num_classes: *num_classes + compiler: *compilers + cxx_std: "c++11" + additional_cmake_args: + - ['-DCMAKE_CXX_FLAGS=-fno-exceptions -fno-rtti'] + benchmark_generation_flags: + - [] + - name: - "fruit_compile_time" - "fruit_incremental_compile_time" @@ -64,7 +74,6 @@ benchmarks: - "fruit_startup_time" - "fruit_startup_time_with_normalized_component" - "fruit_executable_size" - - "fruit_executable_size_without_exceptions_and_rtti" loop_factor: 1.0 num_classes: *num_classes compiler: *compilers @@ -74,3 +83,15 @@ benchmarks: - ["-DBUILD_SHARED_LIBS=False"] benchmark_generation_flags: - [] + + - name: + - "fruit_executable_size_without_exceptions_and_rtti" + loop_factor: 1.0 + num_classes: *num_classes + compiler: *compilers + cxx_std: "c++11" + additional_cmake_args: + - ['-DFRUIT_USES_BOOST=False', '-DCMAKE_CXX_FLAGS=-fno-exceptions -fno-rtti'] + - ["-DBUILD_SHARED_LIBS=False", '-DCMAKE_CXX_FLAGS=-fno-exceptions -fno-rtti'] + benchmark_generation_flags: + - [] diff --git a/extras/benchmark/suites/fruit_mostly_full.yml b/extras/benchmark/suites/fruit_mostly_full.yml index 41cc5e0..cfdeeb3 100644 --- a/extras/benchmark/suites/fruit_mostly_full.yml +++ b/extras/benchmark/suites/fruit_mostly_full.yml @@ -44,7 +44,6 @@ benchmarks: - "fruit_startup_time" - "fruit_startup_time_with_normalized_component" - "fruit_executable_size" - - "fruit_executable_size_without_exceptions_and_rtti" loop_factor: 1.0 num_classes: *num_classes compiler: *compilers @@ -53,3 +52,14 @@ benchmarks: - [] benchmark_generation_flags: - [] + + - name: + - "fruit_executable_size_without_exceptions_and_rtti" + loop_factor: 1.0 + num_classes: *num_classes + compiler: *compilers + cxx_std: "c++11" + additional_cmake_args: + - ['-DCMAKE_CXX_FLAGS=-fno-exceptions -fno-rtti'] + benchmark_generation_flags: + - [] diff --git a/extras/benchmark/suites/simple_di_full.yml b/extras/benchmark/suites/simple_di_full.yml index 1b88d34..8deaaa7 100644 --- a/extras/benchmark/suites/simple_di_full.yml +++ b/extras/benchmark/suites/simple_di_full.yml @@ -37,19 +37,16 @@ benchmarks: - "simple_di_run_time" - "simple_di_startup_time" - "simple_di_executable_size" - - "simple_di_executable_size_without_exceptions_and_rtti" - "simple_di_with_interfaces_compile_time" - "simple_di_with_interfaces_incremental_compile_time" - "simple_di_with_interfaces_run_time" - "simple_di_with_interfaces_startup_time" - "simple_di_with_interfaces_executable_size" - - "simple_di_with_interfaces_executable_size_without_exceptions_and_rtti" - "simple_di_with_interfaces_and_new_delete_compile_time" - "simple_di_with_interfaces_and_new_delete_incremental_compile_time" - "simple_di_with_interfaces_and_new_delete_run_time" - "simple_di_with_interfaces_and_new_delete_startup_time" - "simple_di_with_interfaces_and_new_delete_executable_size" - - "simple_di_with_interfaces_and_new_delete_executable_size_without_exceptions_and_rtti" loop_factor: 1.0 num_classes: - 100 @@ -59,3 +56,17 @@ benchmarks: - [] benchmark_generation_flags: - [] + + - name: + - "simple_di_executable_size_without_exceptions_and_rtti" + - "simple_di_with_interfaces_executable_size_without_exceptions_and_rtti" + - "simple_di_with_interfaces_and_new_delete_executable_size_without_exceptions_and_rtti" + loop_factor: 1.0 + num_classes: + - 100 + compiler: *compilers + cxx_std: "c++11" + additional_cmake_args: + - ['-DCMAKE_CXX_FLAGS=-fno-exceptions -fno-rtti'] + benchmark_generation_flags: + - [] diff --git a/extras/benchmark/suites/simple_di_mostly_full.yml b/extras/benchmark/suites/simple_di_mostly_full.yml index 125feae..0ce91d1 100644 --- a/extras/benchmark/suites/simple_di_mostly_full.yml +++ b/extras/benchmark/suites/simple_di_mostly_full.yml @@ -35,19 +35,16 @@ benchmarks: - "simple_di_run_time" - "simple_di_startup_time" - "simple_di_executable_size" - - "simple_di_executable_size_without_exceptions_and_rtti" - "simple_di_with_interfaces_compile_time" - "simple_di_with_interfaces_incremental_compile_time" - "simple_di_with_interfaces_run_time" - "simple_di_with_interfaces_startup_time" - "simple_di_with_interfaces_executable_size" - - "simple_di_with_interfaces_executable_size_without_exceptions_and_rtti" - "simple_di_with_interfaces_and_new_delete_compile_time" - "simple_di_with_interfaces_and_new_delete_incremental_compile_time" - "simple_di_with_interfaces_and_new_delete_run_time" - "simple_di_with_interfaces_and_new_delete_startup_time" - "simple_di_with_interfaces_and_new_delete_executable_size" - - "simple_di_with_interfaces_and_new_delete_executable_size_without_exceptions_and_rtti" loop_factor: 1.0 num_classes: - 100 @@ -57,3 +54,17 @@ benchmarks: - [] benchmark_generation_flags: - [] + + - name: + - "simple_di_executable_size_without_exceptions_and_rtti" + - "simple_di_with_interfaces_executable_size_without_exceptions_and_rtti" + - "simple_di_with_interfaces_and_new_delete_executable_size_without_exceptions_and_rtti" + loop_factor: 1.0 + num_classes: + - 100 + compiler: *compilers + cxx_std: "c++11" + additional_cmake_args: + - ['-DCMAKE_CXX_FLAGS=-fno-exceptions -fno-rtti'] + benchmark_generation_flags: + - [] -- cgit v1.2.3 From 2ce1ca7ef39e0e275518203d4ff5b823f304bcc9 Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sun, 5 Apr 2020 19:24:18 -0700 Subject: Add missing Boost.DI benchmarks. --- extras/benchmark/suites/boost_di.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/extras/benchmark/suites/boost_di.yml b/extras/benchmark/suites/boost_di.yml index e23fd0f..ec8a2a5 100644 --- a/extras/benchmark/suites/boost_di.yml +++ b/extras/benchmark/suites/boost_di.yml @@ -27,6 +27,7 @@ benchmarks: - "boost_di_compile_time" - "boost_di_incremental_compile_time" - "boost_di_run_time" + - "boost_di_startup_time" - "boost_di_executable_size" loop_factor: 1.0 num_classes: @@ -39,3 +40,18 @@ benchmarks: - [] benchmark_generation_flags: - [] + + - name: + - "boost_di_executable_size_without_exceptions_and_rtti" + loop_factor: 1.0 + num_classes: + - 100 + - 250 + - 1000 + compiler: *compilers + cxx_std: "c++14" + additional_cmake_args: + - ['-DCMAKE_CXX_FLAGS=-fno-exceptions -fno-rtti'] + benchmark_generation_flags: + - [] + -- cgit v1.2.3 From 5400e8a847c62ab4080efd036cc6a35f34c5ac2f Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Tue, 7 Apr 2020 22:59:53 -0700 Subject: Fix format_bench_results filtering for list-valued dimensions, and print unused benchmark results warnings at the end. --- extras/benchmark/format_bench_results.py | 42 ++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 13 deletions(-) diff --git a/extras/benchmark/format_bench_results.py b/extras/benchmark/format_bench_results.py index 0865d6c..05e65ab 100755 --- a/extras/benchmark/format_bench_results.py +++ b/extras/benchmark/format_bench_results.py @@ -15,32 +15,42 @@ import argparse import json -from typing import Tuple, List, Dict, Union, Callable, Any, Sequence +from typing import Tuple, List, Dict, Union, Callable, Any, Sequence, Set, Iterable import yaml from collections import defaultdict -def extract_results(bench_results: List[Dict[str, Dict[Any, Any]]], fixed_benchmark_params: Dict[str, str], column_dimension: str, row_dimension: str, result_dimension: str) -> Dict[str, Dict[str, Dict[str, Any]]]: +def extract_results(bench_results: List[Dict[str, Dict[Any, Any]]], + fixed_benchmark_params: Dict[str, Union[str, Tuple[str, ...]]], + column_dimension: str, + row_dimension: str, + result_dimension: str) -> Tuple[Dict[str, Dict[str, Dict[str, Any]]], + Set[Tuple[List[Tuple[str, str]], ...]]]: table_data = defaultdict(lambda: dict()) # type: Dict[str, Dict[str, Dict[str, Any]]] remaining_dimensions_by_row_column = dict() + used_bench_results = set() # type: Set[Tuple[List[Tuple[str, str]], ...]] for bench_result in bench_results: try: params = {dimension_name: make_immutable(dimension_value) for dimension_name, dimension_value in bench_result['benchmark'].items()} + original_params = dict(params) results = bench_result['results'] + matches = True + if result_dimension not in results: + # result_dimension not found in this result, skip + matches = False for param_name, param_value in fixed_benchmark_params.items(): - if params.get(param_name) != param_value: + if (isinstance(param_value, tuple) and params.get(param_name) in param_value) or (params.get(param_name) == param_value): + pass + else: # fixed_benchmark_params not satisfied by this result, skip - break - if result_dimension not in results: - # result_dimension not found in this result, skip - break - params.pop(param_name) - else: + matches = False + if matches: # fixed_benchmark_params were satisfied by these params (and were removed) assert row_dimension in params.keys(), '%s not in %s' % (row_dimension, params.keys()) assert column_dimension in params.keys(), '%s not in %s' % (column_dimension, params.keys()) assert result_dimension in results, '%s not in %s' % (result_dimension, results) + used_bench_results.add(tuple(sorted(original_params.items()))) row_value = params[row_dimension] column_value = params[column_dimension] remaining_dimensions = params.copy() @@ -56,7 +66,7 @@ def extract_results(bench_results: List[Dict[str, Dict[Any, Any]]], fixed_benchm remaining_dimensions_by_row_column[(row_value, column_value)] = remaining_dimensions except Exception as e: raise Exception('While processing %s' % bench_result) from e - return table_data + return table_data, used_bench_results # Takes a 2-dimensional array (list of lists) and prints a markdown table with that content. def print_markdown_table(table_data: List[List[str]]) -> None: @@ -291,7 +301,6 @@ def determine_value_pretty_printer(unit: str) -> IntervalPrettyPrinter: return file_size_interval_pretty_printer raise Exception("Unrecognized unit: %s" % unit) - def main(): parser = argparse.ArgumentParser(description='Runs all the benchmarks whose results are on the Fruit website.') parser.add_argument('--benchmark-results', @@ -317,17 +326,19 @@ def main(): baseline_bench_results = None with open(args.benchmark_tables_definition, 'r') as f: + used_bench_results = set() for table_definition in yaml.safe_load(f)["tables"]: try: fixed_benchmark_params = {dimension_name: make_immutable(dimension_value) for dimension_name, dimension_value in table_definition['benchmark_filter'].items()} - table_data = extract_results( + table_data, last_used_bench_results = extract_results( bench_results, fixed_benchmark_params=fixed_benchmark_params, column_dimension=table_definition['columns']['dimension'], row_dimension=table_definition['rows']['dimension'], result_dimension=table_definition['results']['dimension']) + used_bench_results = used_bench_results.union(last_used_bench_results) if baseline_bench_results: - baseline_table_data = extract_results( + baseline_table_data, _ = extract_results( baseline_bench_results, fixed_benchmark_params=fixed_benchmark_params, column_dimension=table_definition['columns']['dimension'], @@ -350,6 +361,11 @@ def main(): print('While processing table:\n' + table_definition) print() raise e + for bench_result in bench_results: + params = {dimension_name: make_immutable(dimension_value) + for dimension_name, dimension_value in bench_result['benchmark'].items()} + if tuple(sorted(params.items())) not in used_bench_results: + print('Warning: benchmark result did not match any tables: %s' % params) if __name__ == "__main__": -- cgit v1.2.3 From cd2bd41ccbb473d42ed471e74f2c0d1c9b34b87f Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Tue, 7 Apr 2020 23:00:59 -0700 Subject: Add support for compile memory benchmarks. --- extras/benchmark/makefile_generator.py | 12 +- extras/benchmark/run_benchmarks.py | 57 ++++ extras/benchmark/suites/boost_di.yml | 1 + extras/benchmark/suites/debug.yml | 6 + extras/benchmark/suites/fruit_full.yml | 2 + extras/benchmark/suites/fruit_mostly_full.yml | 1 + extras/benchmark/suites/fruit_quick.yml | 1 + extras/benchmark/suites/simple_di_full.yml | 3 + extras/benchmark/suites/simple_di_mostly_full.yml | 3 + extras/benchmark/tables/fruit_internal.yml | 32 ++- extras/benchmark/tables/fruit_wiki.yml | 311 ++++++++++++++++++---- 11 files changed, 369 insertions(+), 60 deletions(-) diff --git a/extras/benchmark/makefile_generator.py b/extras/benchmark/makefile_generator.py index 0824355..7781a6e 100644 --- a/extras/benchmark/makefile_generator.py +++ b/extras/benchmark/makefile_generator.py @@ -20,15 +20,21 @@ def generate_makefile(cpp_files: List[str], executable_name: str, compile_comman link_rule_template = """ {executable_name}: {object_files} \t{link_command} {object_files} -o {executable_name} {link_command_suffix} + +{executable_name}_ram.txt: {object_files_ram_txt} +\t(cat {object_files_ram_txt}; /bin/time -v {link_command} {object_files} -o {executable_name}.tmp {link_command_suffix} 2>&1 | fgrep 'Maximum resident set size' | sed 's|.*: ||') >{executable_name}_ram.txt """ compile_rule_template = """ {name}.o: {name}.cpp \t{compile_command} -c {name}.cpp -o {name}.o + +{name}.o_ram.txt: {name}.cpp +\t/bin/time -v {compile_command} -c {name}.cpp -o {name}.o 2>&1 | fgrep 'Maximum resident set size' | sed 's|.*: ||' >{name}.o_ram.txt """ clean_rule_template = """ clean: -\trm -f {object_files} {dep_files} {executable_name} +\trm -f {object_files} {dep_files} {executable_name} {executable_name}_ram.txt {object_files_ram_txt} """ dep_file_deps = """ @@ -41,6 +47,7 @@ include {dep_files} compile_rules = [] object_files = [] + object_files_ram_txt = [] dep_files = [] for cpp_file in cpp_files: assert cpp_file.endswith('.cpp') @@ -51,16 +58,19 @@ include {dep_files} compile_command=compile_command) compile_rules.append(compile_rule) object_files.append('%s.o' % source) + object_files_ram_txt.append('%s.o_ram.txt' % source) dep_files.append('%s.d' % source) link_rule = link_rule_template.format( object_files=' '.join(object_files), + object_files_ram_txt=' '.join(object_files_ram_txt), link_command=link_command, link_command_suffix=link_command_suffix, executable_name=executable_name) clean_rule = clean_rule_template.format( object_files=' '.join(object_files), + object_files_ram_txt=' '.join(object_files_ram_txt), executable_name=executable_name, dep_files=' '.join(dep_files)) diff --git a/extras/benchmark/run_benchmarks.py b/extras/benchmark/run_benchmarks.py index fa37c0e..0bddbc7 100755 --- a/extras/benchmark/run_benchmarks.py +++ b/extras/benchmark/run_benchmarks.py @@ -265,6 +265,10 @@ class GenericGeneratedSourcesBenchmark(Benchmark): self.arbitrary_files = [files[i * (len(files) // (num_files_changed + 2))] for i in range(1, num_files_changed + 1)] + def prepare_compile_memory_benchmark(self): + self.prepare_compile_benchmark() + self.run_compile_memory_benchmark() + def prepare_runtime_benchmark(self): self.prepare_compile_benchmark() self.run_make_build() @@ -296,6 +300,16 @@ class GenericGeneratedSourcesBenchmark(Benchmark): result = {'incremental_compile_time': end - start} return result + def run_compile_memory_benchmark(self): + run_command('make', args=make_args + ['clean'], cwd=self.tmpdir) + run_command('make', args=make_args + ['main_ram.txt'], cwd=self.tmpdir) + with open(self.tmpdir + '/main_ram.txt') as f: + ram_usages = [int(n)*1024 for n in f.readlines()] + return { + 'total_max_ram_usage': sum(ram_usages), + 'max_ram_usage': max(ram_usages), + } + def run_runtime_benchmark(self): num_classes = self.benchmark_definition['num_classes'] loop_factor = self.benchmark_definition['loop_factor'] @@ -347,6 +361,17 @@ class IncrementalCompileTimeBenchmark(GenericGeneratedSourcesBenchmark): def run(self): return self.run_incremental_compile_benchmark() +class CompileMemoryBenchmark(GenericGeneratedSourcesBenchmark): + def __init__(self, **kwargs): + super().__init__(generate_runtime_bench_code=False, + **kwargs) + + def prepare(self): + self.prepare_compile_memory_benchmark() + + def run(self): + return self.run_compile_memory_benchmark() + class StartupTimeBenchmark(GenericGeneratedSourcesBenchmark): def __init__(self, **kwargs): super().__init__(generate_runtime_bench_code=False, @@ -402,6 +427,13 @@ class FruitIncrementalCompileTimeBenchmark(IncrementalCompileTimeBenchmark): fruit_sources_dir=fruit_sources_dir, **kwargs) +class FruitCompileMemoryBenchmark(CompileMemoryBenchmark): + def __init__(self, fruit_sources_dir, **kwargs): + super().__init__(di_library='fruit', + path_to_code_under_test=fruit_sources_dir, + fruit_sources_dir=fruit_sources_dir, + **kwargs) + class FruitRunTimeBenchmark(RunTimeBenchmark): def __init__(self, fruit_sources_dir, **kwargs): super().__init__(di_library='fruit', @@ -451,6 +483,13 @@ class BoostDiIncrementalCompileTimeBenchmark(IncrementalCompileTimeBenchmark): boost_di_sources_dir=boost_di_sources_dir, **kwargs) +class BoostDiCompileMemoryBenchmark(CompileMemoryBenchmark): + def __init__(self, boost_di_sources_dir, **kwargs): + super().__init__(di_library='boost_di', + path_to_code_under_test=boost_di_sources_dir, + boost_di_sources_dir=boost_di_sources_dir, + **kwargs) + class BoostDiRunTimeBenchmark(RunTimeBenchmark): def __init__(self, boost_di_sources_dir, **kwargs): super().__init__(di_library='boost_di', @@ -491,6 +530,11 @@ class SimpleDiIncrementalCompileTimeBenchmark(IncrementalCompileTimeBenchmark): super().__init__(di_library='none', **kwargs) +class SimpleDiCompileMemoryBenchmark(CompileMemoryBenchmark): + def __init__(self, **kwargs): + super().__init__(di_library='none', + **kwargs) + class SimpleDiRunTimeBenchmark(RunTimeBenchmark): def __init__(self, **kwargs): super().__init__(di_library='none', @@ -521,6 +565,10 @@ class SimpleDiWithInterfacesIncrementalCompileTimeBenchmark(SimpleDiIncrementalC def __init__(self, **kwargs): super().__init__(use_interfaces=True, **kwargs) +class SimpleDiWithInterfacesCompileMemoryBenchmark(SimpleDiCompileMemoryBenchmark): + def __init__(self, **kwargs): + super().__init__(use_interfaces=True, **kwargs) + class SimpleDiWithInterfacesRunTimeBenchmark(SimpleDiRunTimeBenchmark): def __init__(self, **kwargs): super().__init__(use_interfaces=True, **kwargs) @@ -547,6 +595,10 @@ class SimpleDiWithInterfacesAndNewDeleteIncrementalCompileTimeBenchmark(SimpleDi def __init__(self, **kwargs): super().__init__(use_new_delete=True, **kwargs) +class SimpleDiWithInterfacesAndNewDeleteCompileMemoryBenchmark(SimpleDiWithInterfacesCompileMemoryBenchmark): + def __init__(self, **kwargs): + super().__init__(use_new_delete=True, **kwargs) + class SimpleDiWithInterfacesAndNewDeleteRunTimeBenchmark(SimpleDiWithInterfacesRunTimeBenchmark): def __init__(self, **kwargs): super().__init__(use_new_delete=True, **kwargs) @@ -758,6 +810,7 @@ def main(): benchmark_class = { 'fruit_compile_time': FruitCompileTimeBenchmark, 'fruit_incremental_compile_time': FruitIncrementalCompileTimeBenchmark, + 'fruit_compile_memory': FruitCompileMemoryBenchmark, 'fruit_run_time': FruitRunTimeBenchmark, 'fruit_startup_time': FruitStartupTimeBenchmark, 'fruit_startup_time_with_normalized_component': FruitStartupTimeWithNormalizedComponentBenchmark, @@ -772,6 +825,7 @@ def main(): benchmark_class = { 'boost_di_compile_time': BoostDiCompileTimeBenchmark, 'boost_di_incremental_compile_time': BoostDiIncrementalCompileTimeBenchmark, + 'boost_di_compile_memory': BoostDiCompileMemoryBenchmark, 'boost_di_run_time': BoostDiRunTimeBenchmark, 'boost_di_startup_time': BoostDiStartupTimeBenchmark, 'boost_di_executable_size': BoostDiExecutableSizeBenchmark, @@ -784,18 +838,21 @@ def main(): benchmark_class = { 'simple_di_compile_time': SimpleDiCompileTimeBenchmark, 'simple_di_incremental_compile_time': SimpleDiIncrementalCompileTimeBenchmark, + 'simple_di_compile_memory': SimpleDiCompileMemoryBenchmark, 'simple_di_run_time': SimpleDiRunTimeBenchmark, 'simple_di_startup_time': SimpleDiStartupTimeBenchmark, 'simple_di_executable_size': SimpleDiExecutableSizeBenchmark, 'simple_di_executable_size_without_exceptions_and_rtti': SimpleDiExecutableSizeBenchmarkWithoutExceptionsAndRtti, 'simple_di_with_interfaces_compile_time': SimpleDiWithInterfacesCompileTimeBenchmark, 'simple_di_with_interfaces_incremental_compile_time': SimpleDiWithInterfacesIncrementalCompileTimeBenchmark, + 'simple_di_with_interfaces_compile_memory': SimpleDiWithInterfacesCompileMemoryBenchmark, 'simple_di_with_interfaces_run_time': SimpleDiWithInterfacesRunTimeBenchmark, 'simple_di_with_interfaces_startup_time': SimpleDiWithInterfacesStartupTimeBenchmark, 'simple_di_with_interfaces_executable_size': SimpleDiWithInterfacesExecutableSizeBenchmark, 'simple_di_with_interfaces_executable_size_without_exceptions_and_rtti': SimpleDiWithInterfacesExecutableSizeBenchmarkWithoutExceptionsAndRtti, 'simple_di_with_interfaces_and_new_delete_compile_time': SimpleDiWithInterfacesAndNewDeleteCompileTimeBenchmark, 'simple_di_with_interfaces_and_new_delete_incremental_compile_time': SimpleDiWithInterfacesAndNewDeleteIncrementalCompileTimeBenchmark, + 'simple_di_with_interfaces_and_new_delete_compile_memory': SimpleDiWithInterfacesAndNewDeleteCompileMemoryBenchmark, 'simple_di_with_interfaces_and_new_delete_run_time': SimpleDiWithInterfacesAndNewDeleteRunTimeBenchmark, 'simple_di_with_interfaces_and_new_delete_startup_time': SimpleDiWithInterfacesAndNewDeleteStartupTimeBenchmark, 'simple_di_with_interfaces_and_new_delete_executable_size': SimpleDiWithInterfacesAndNewDeleteExecutableSizeBenchmark, diff --git a/extras/benchmark/suites/boost_di.yml b/extras/benchmark/suites/boost_di.yml index ec8a2a5..458d11e 100644 --- a/extras/benchmark/suites/boost_di.yml +++ b/extras/benchmark/suites/boost_di.yml @@ -25,6 +25,7 @@ constants: benchmarks: - name: - "boost_di_compile_time" + - "boost_di_compile_memory" - "boost_di_incremental_compile_time" - "boost_di_run_time" - "boost_di_startup_time" diff --git a/extras/benchmark/suites/debug.yml b/extras/benchmark/suites/debug.yml index 1d18469..c31d4d5 100644 --- a/extras/benchmark/suites/debug.yml +++ b/extras/benchmark/suites/debug.yml @@ -43,16 +43,19 @@ benchmarks: - name: - "new_delete_run_time" - "simple_di_compile_time" + - "simple_di_compile_memory" - "simple_di_incremental_compile_time" - "simple_di_run_time" - "simple_di_startup_time" - "simple_di_executable_size" - "simple_di_with_interfaces_compile_time" + - "simple_di_with_interfaces_compile_memory" - "simple_di_with_interfaces_incremental_compile_time" - "simple_di_with_interfaces_run_time" - "simple_di_with_interfaces_startup_time" - "simple_di_with_interfaces_executable_size" - "simple_di_with_interfaces_and_new_delete_compile_time" + - "simple_di_with_interfaces_and_new_delete_compile_memory" - "simple_di_with_interfaces_and_new_delete_incremental_compile_time" - "simple_di_with_interfaces_and_new_delete_run_time" - "simple_di_with_interfaces_and_new_delete_startup_time" @@ -83,6 +86,7 @@ benchmarks: - name: - "fruit_compile_time" + - "fruit_compile_memory" - "fruit_incremental_compile_time" - "fruit_run_time" - "fruit_startup_time" @@ -116,6 +120,7 @@ benchmarks: - name: - "fruit_compile_time" + - "fruit_compile_memory" - "fruit_incremental_compile_time" - "fruit_run_time" - "fruit_startup_time" @@ -145,6 +150,7 @@ benchmarks: - name: - "boost_di_compile_time" + - "boost_di_compile_memory" - "boost_di_incremental_compile_time" - "boost_di_run_time" - "boost_di_startup_time" diff --git a/extras/benchmark/suites/fruit_full.yml b/extras/benchmark/suites/fruit_full.yml index 84a604e..4cd30e8 100644 --- a/extras/benchmark/suites/fruit_full.yml +++ b/extras/benchmark/suites/fruit_full.yml @@ -42,6 +42,7 @@ benchmarks: - name: - "new_delete_run_time" - "fruit_compile_time" + - "fruit_compile_memory" - "fruit_incremental_compile_time" - "fruit_run_time" - "fruit_startup_time" @@ -69,6 +70,7 @@ benchmarks: - name: - "fruit_compile_time" + - "fruit_compile_memory" - "fruit_incremental_compile_time" - "fruit_run_time" - "fruit_startup_time" diff --git a/extras/benchmark/suites/fruit_mostly_full.yml b/extras/benchmark/suites/fruit_mostly_full.yml index cfdeeb3..516807c 100644 --- a/extras/benchmark/suites/fruit_mostly_full.yml +++ b/extras/benchmark/suites/fruit_mostly_full.yml @@ -39,6 +39,7 @@ benchmarks: - name: - "new_delete_run_time" - "fruit_compile_time" + - "fruit_compile_memory" - "fruit_incremental_compile_time" - "fruit_run_time" - "fruit_startup_time" diff --git a/extras/benchmark/suites/fruit_quick.yml b/extras/benchmark/suites/fruit_quick.yml index b60a60e..fd64ae7 100644 --- a/extras/benchmark/suites/fruit_quick.yml +++ b/extras/benchmark/suites/fruit_quick.yml @@ -38,6 +38,7 @@ benchmarks: - name: - "fruit_compile_time" + - "fruit_compile_memory" - "fruit_incremental_compile_time" - "fruit_run_time" - "fruit_startup_time" diff --git a/extras/benchmark/suites/simple_di_full.yml b/extras/benchmark/suites/simple_di_full.yml index 8deaaa7..9d490eb 100644 --- a/extras/benchmark/suites/simple_di_full.yml +++ b/extras/benchmark/suites/simple_di_full.yml @@ -33,15 +33,18 @@ benchmarks: - name: - "new_delete_run_time" - "simple_di_compile_time" + - "simple_di_compile_memory" - "simple_di_incremental_compile_time" - "simple_di_run_time" - "simple_di_startup_time" - "simple_di_executable_size" + - "simple_di_with_interfaces_compile_memory" - "simple_di_with_interfaces_compile_time" - "simple_di_with_interfaces_incremental_compile_time" - "simple_di_with_interfaces_run_time" - "simple_di_with_interfaces_startup_time" - "simple_di_with_interfaces_executable_size" + - "simple_di_with_interfaces_and_new_delete_compile_memory" - "simple_di_with_interfaces_and_new_delete_compile_time" - "simple_di_with_interfaces_and_new_delete_incremental_compile_time" - "simple_di_with_interfaces_and_new_delete_run_time" diff --git a/extras/benchmark/suites/simple_di_mostly_full.yml b/extras/benchmark/suites/simple_di_mostly_full.yml index 0ce91d1..7ab0d00 100644 --- a/extras/benchmark/suites/simple_di_mostly_full.yml +++ b/extras/benchmark/suites/simple_di_mostly_full.yml @@ -31,16 +31,19 @@ benchmarks: - name: - "new_delete_run_time" - "simple_di_compile_time" + - "simple_di_compile_memory" - "simple_di_incremental_compile_time" - "simple_di_run_time" - "simple_di_startup_time" - "simple_di_executable_size" - "simple_di_with_interfaces_compile_time" + - "simple_di_with_interfaces_compile_memory" - "simple_di_with_interfaces_incremental_compile_time" - "simple_di_with_interfaces_run_time" - "simple_di_with_interfaces_startup_time" - "simple_di_with_interfaces_executable_size" - "simple_di_with_interfaces_and_new_delete_compile_time" + - "simple_di_with_interfaces_and_new_delete_compile_memory" - "simple_di_with_interfaces_and_new_delete_incremental_compile_time" - "simple_di_with_interfaces_and_new_delete_run_time" - "simple_di_with_interfaces_and_new_delete_startup_time" diff --git a/extras/benchmark/tables/fruit_internal.yml b/extras/benchmark/tables/fruit_internal.yml index 7d4602e..2649398 100644 --- a/extras/benchmark/tables/fruit_internal.yml +++ b/extras/benchmark/tables/fruit_internal.yml @@ -123,9 +123,9 @@ tables: fixed_map: "fruit_compile_time": "Fruit" "boost_di_compile_time": "Boost.DI" - "simple_di_incremental_compile_time": "Simple DI" - "simple_di_with_interfaces_incremental_compile_time": "Simple DI w/ interfaces" - "simple_di_with_interfaces_and_new_delete_incremental_compile_time": "Simple DI w/ interfaces, new/delete" + "simple_di_compile_time": "Simple DI" + "simple_di_with_interfaces_compile_time": "Simple DI w/ interfaces" + "simple_di_with_interfaces_and_new_delete_compile_time": "Simple DI w/ interfaces, new/delete" rows: *compiler_name_row results: dimension: "compile_time" @@ -157,6 +157,32 @@ tables: dimension: "compile_time" unit: "seconds" + - name: "Compile memory (100 classes)" + benchmark_filter: + num_classes: 100 + benchmark_generation_flags: [] + additional_cmake_args: [] + name: [ + "fruit_compile_memory", + "boost_di_compile_memory", + "simple_di_compile_memory", + "simple_di_with_interfaces_compile_memory", + "simple_di_with_interfaces_and_new_delete_compile_memory", + ] + columns: + dimension: "name" + pretty_printer: + fixed_map: + "fruit_compile_memory": "Fruit" + "boost_di_compile_memory": "Boost.DI" + "simple_di_incremental_compile_memory": "Simple DI" + "simple_di_with_interfaces_incremental_compile_memory": "Simple DI w/ interfaces" + "simple_di_with_interfaces_and_new_delete_incremental_compile_memory": "Simple DI w/ interfaces, new/delete" + rows: *compiler_name_row + results: + dimension: "max_ram_usage" + unit: "bytes" + - name: "Fruit full injection time (100 classes)" benchmark_filter: num_classes: 100 diff --git a/extras/benchmark/tables/fruit_wiki.yml b/extras/benchmark/tables/fruit_wiki.yml index 294503a..28bdccf 100644 --- a/extras/benchmark/tables/fruit_wiki.yml +++ b/extras/benchmark/tables/fruit_wiki.yml @@ -41,26 +41,15 @@ tables: dimension: "compile_time" unit: "seconds" - - name: "Fruit full injection time" + - name: "Fruit startup time" benchmark_filter: - name: "fruit_run_time" - additional_cmake_args: [] - benchmark_generation_flags: [] - columns: *num_classes_column - rows: *compiler_name_row - results: - dimension: "Full injection time" - unit: "seconds" - - - name: "Fruit setup time" - benchmark_filter: - name: "fruit_run_time" + name: "fruit_startup_time" additional_cmake_args: [] benchmark_generation_flags: [] columns: *num_classes_column rows: *compiler_name_row results: - dimension: "Total for setup" + dimension: "startup_time" unit: "seconds" - name: "Fruit per-request time" @@ -113,6 +102,32 @@ tables: dimension: "compile_time" unit: "seconds" + - name: "Compile time (250 classes)" + benchmark_filter: + num_classes: 250 + additional_cmake_args: [] + benchmark_generation_flags: [] + name: [ + "fruit_compile_time", + "boost_di_compile_time", + "simple_di_compile_time", + "simple_di_with_interfaces_compile_time", + "simple_di_with_interfaces_and_new_delete_compile_time", + ] + columns: + dimension: "name" + pretty_printer: + fixed_map: + "fruit_compile_time": "Fruit" + "boost_di_compile_time": "Boost.DI" + "simple_di_compile_time": "Simple DI" + "simple_di_with_interfaces_compile_time": "Simple DI w/ interfaces" + "simple_di_with_interfaces_and_new_delete_compile_time": "Simple DI w/ interfaces, new/delete" + rows: *compiler_name_row + results: + dimension: "compile_time" + unit: "seconds" + - name: "Compile time (1000 classes)" benchmark_filter: num_classes: 1000 @@ -162,7 +177,33 @@ tables: "simple_di_with_interfaces_and_new_delete_incremental_compile_time": "Simple DI w/ interfaces, new/delete" rows: *compiler_name_row results: - dimension: "compile_time" + dimension: "incremental_compile_time" + unit: "seconds" + + - name: "Incremental compile time (250 classes)" + benchmark_filter: + num_classes: 250 + additional_cmake_args: [] + benchmark_generation_flags: [] + name: [ + "fruit_incremental_compile_time", + "boost_di_incremental_compile_time", + "simple_di_incremental_compile_time", + "simple_di_with_interfaces_incremental_compile_time", + "simple_di_with_interfaces_and_new_delete_incremental_compile_time", + ] + columns: + dimension: "name" + pretty_printer: + fixed_map: + "fruit_incremental_compile_time": "Fruit" + "boost_di_incremental_compile_time": "Boost.DI" + "simple_di_incremental_compile_time": "Simple DI" + "simple_di_with_interfaces_incremental_compile_time": "Simple DI w/ interfaces" + "simple_di_with_interfaces_and_new_delete_incremental_compile_time": "Simple DI w/ interfaces, new/delete" + rows: *compiler_name_row + results: + dimension: "incremental_compile_time" unit: "seconds" - name: "Incremental compile time (1000 classes)" @@ -188,48 +229,88 @@ tables: "simple_di_with_interfaces_and_new_delete_incremental_compile_time": "Simple DI w/ interfaces, new/delete" rows: *compiler_name_row results: - dimension: "compile_time" + dimension: "incremental_compile_time" unit: "seconds" - - name: "Full injection time (100 classes)" + - name: "Compile memory (100 classes)" benchmark_filter: num_classes: 100 additional_cmake_args: [] benchmark_generation_flags: [] + name: [ + "fruit_compile_memory", + "boost_di_compile_memory", + "simple_di_compile_memory", + "simple_di_with_interfaces_compile_memory", + "simple_di_with_interfaces_and_new_delete_compile_memory", + ] columns: dimension: "name" pretty_printer: fixed_map: - "fruit_run_time": "Fruit" - "boost_di_run_time": "Boost.DI" - "simple_di_run_time": "Simple DI" - "simple_di_with_interfaces_run_time": "Simple DI w/ interfaces" - "simple_di_with_interfaces_and_new_delete_run_time": "Simple DI w/ interfaces, new/delete" + "fruit_compile_memory": "Fruit" + "boost_di_compile_memory": "Boost.DI" + "simple_di_compile_memory": "Simple DI" + "simple_di_with_interfaces_compile_memory": "Simple DI w/ interfaces" + "simple_di_with_interfaces_and_new_delete_compile_memory": "Simple DI w/ interfaces, new/delete" rows: *compiler_name_row results: - dimension: "Full injection time" - unit: "seconds" + dimension: "max_ram_usage" + unit: "bytes" - - name: "Full injection time (1000 classes)" + - name: "Compile memory (250 classes)" + benchmark_filter: + num_classes: 250 + additional_cmake_args: [] + benchmark_generation_flags: [] + name: [ + "fruit_compile_memory", + "boost_di_compile_memory", + "simple_di_compile_memory", + "simple_di_with_interfaces_compile_memory", + "simple_di_with_interfaces_and_new_delete_compile_memory", + ] + columns: + dimension: "name" + pretty_printer: + fixed_map: + "fruit_compile_memory": "Fruit" + "boost_di_compile_memory": "Boost.DI" + "simple_di_compile_memory": "Simple DI" + "simple_di_with_interfaces_compile_memory": "Simple DI w/ interfaces" + "simple_di_with_interfaces_and_new_delete_compile_memory": "Simple DI w/ interfaces, new/delete" + rows: *compiler_name_row + results: + dimension: "max_ram_usage" + unit: "bytes" + + - name: "Compile memory (1000 classes)" benchmark_filter: num_classes: 1000 additional_cmake_args: [] benchmark_generation_flags: [] + name: [ + "fruit_compile_memory", + "boost_di_compile_memory", + "simple_di_compile_memory", + "simple_di_with_interfaces_compile_memory", + "simple_di_with_interfaces_and_new_delete_compile_memory", + ] columns: dimension: "name" pretty_printer: fixed_map: - "fruit_run_time": "Fruit" - "boost_di_run_time": "Boost.DI" - "simple_di_run_time": "Simple DI" - "simple_di_with_interfaces_run_time": "Simple DI w/ interfaces" - "simple_di_with_interfaces_and_new_delete_run_time": "Simple DI w/ interfaces, new/delete" + "fruit_compile_memory": "Fruit" + "boost_di_compile_memory": "Boost.DI" + "simple_di_compile_memory": "Simple DI" + "simple_di_with_interfaces_compile_memory": "Simple DI w/ interfaces" + "simple_di_with_interfaces_and_new_delete_compile_memory": "Simple DI w/ interfaces, new/delete" rows: *compiler_name_row results: - dimension: "Full injection time" - unit: "seconds" + dimension: "max_ram_usage" + unit: "bytes" - - name: "Setup time (100 classes)" + - name: "Startup time (100 classes)" benchmark_filter: num_classes: 100 additional_cmake_args: [] @@ -238,21 +319,62 @@ tables: dimension: "name" pretty_printer: fixed_map: - "fruit_run_time": "Fruit" - "boost_di_run_time": "Boost.DI" - "simple_di_run_time": "Simple DI" - "simple_di_with_interfaces_run_time": "Simple DI w/ interfaces" - "simple_di_with_interfaces_and_new_delete_run_time": "Simple DI w/ interfaces, new/delete" + "fruit_startup_time": "Fruit" + "fruit_startup_time_with_normalized_component": "Fruit (with normalized component)" + "boost_di_startup_time": "Boost.DI" + "simple_di_startup_time": "Simple DI" + "simple_di_with_interfaces_startup_time": "Simple DI w/ interfaces" + "simple_di_with_interfaces_and_new_delete_startup_time": "Simple DI w/ interfaces, new/delete" rows: *compiler_name_row results: - dimension: "Total for setup" + dimension: "startup_time" unit: "seconds" - - - name: "Setup time (1000 classes)" + + - name: "Startup time (250 classes)" + benchmark_filter: + num_classes: 250 + additional_cmake_args: [] + benchmark_generation_flags: [] + columns: + dimension: "name" + pretty_printer: + fixed_map: + "fruit_startup_time": "Fruit" + "fruit_startup_time_with_normalized_component": "Fruit (with normalized component)" + "boost_di_startup_time": "Boost.DI" + "simple_di_startup_time": "Simple DI" + "simple_di_with_interfaces_startup_time": "Simple DI w/ interfaces" + "simple_di_with_interfaces_and_new_delete_startup_time": "Simple DI w/ interfaces, new/delete" + rows: *compiler_name_row + results: + dimension: "startup_time" + unit: "seconds" + + - name: "Startup time (1000 classes)" benchmark_filter: num_classes: 1000 additional_cmake_args: [] benchmark_generation_flags: [] + columns: + dimension: "name" + pretty_printer: + fixed_map: + "fruit_startup_time": "Fruit" + "fruit_startup_time_with_normalized_component": "Fruit (with normalized component)" + "boost_di_startup_time": "Boost.DI" + "simple_di_startup_time": "Simple DI" + "simple_di_with_interfaces_startup_time": "Simple DI w/ interfaces" + "simple_di_with_interfaces_and_new_delete_startup_time": "Simple DI w/ interfaces, new/delete" + rows: *compiler_name_row + results: + dimension: "startup_time" + unit: "seconds" + + - name: "Per-request time (100 classes)" + benchmark_filter: + num_classes: 100 + additional_cmake_args: [] + benchmark_generation_flags: [] columns: dimension: "name" pretty_printer: @@ -264,12 +386,12 @@ tables: "simple_di_with_interfaces_and_new_delete_run_time": "Simple DI w/ interfaces, new/delete" rows: *compiler_name_row results: - dimension: "Total for setup" + dimension: "Total per request" unit: "seconds" - - name: "Per-request time (100 classes)" + - name: "Per-request time (250 classes)" benchmark_filter: - num_classes: 100 + num_classes: 250 additional_cmake_args: [] benchmark_generation_flags: [] columns: @@ -316,9 +438,28 @@ tables: fixed_map: "fruit_executable_size": "Fruit" "boost_di_executable_size": "Boost.DI" - "simple_di_run_time": "Simple DI" - "simple_di_with_interfaces_run_time": "Simple DI w/ interfaces" - "simple_di_with_interfaces_and_new_delete_run_time": "Simple DI w/ interfaces, new/delete" + "simple_di_executable_size": "Simple DI" + "simple_di_with_interfaces_executable_size": "Simple DI w/ interfaces" + "simple_di_with_interfaces_and_new_delete_executable_size": "Simple DI w/ interfaces, new/delete" + rows: *compiler_name_row + results: + dimension: "num_bytes" + unit: "bytes" + + - name: "Executable size (stripped, 250 classes)" + benchmark_filter: + num_classes: 250 + additional_cmake_args: [] + benchmark_generation_flags: [] + columns: + dimension: "name" + pretty_printer: + fixed_map: + "fruit_executable_size": "Fruit" + "boost_di_executable_size": "Boost.DI" + "simple_di_executable_size": "Simple DI" + "simple_di_with_interfaces_executable_size": "Simple DI w/ interfaces" + "simple_di_with_interfaces_and_new_delete_executable_size": "Simple DI w/ interfaces, new/delete" rows: *compiler_name_row results: dimension: "num_bytes" @@ -335,9 +476,67 @@ tables: fixed_map: "fruit_executable_size": "Fruit" "boost_di_executable_size": "Boost.DI" - "simple_di_run_time": "Simple DI" - "simple_di_with_interfaces_run_time": "Simple DI w/ interfaces" - "simple_di_with_interfaces_and_new_delete_run_time": "Simple DI w/ interfaces, new/delete" + "simple_di_executable_size": "Simple DI" + "simple_di_with_interfaces_executable_size": "Simple DI w/ interfaces" + "simple_di_with_interfaces_and_new_delete_executable_size": "Simple DI w/ interfaces, new/delete" + rows: *compiler_name_row + results: + dimension: "num_bytes" + unit: "bytes" + + + - name: "Executable size (stripped, 100 classes, no exceptions/rtti)" + benchmark_filter: + num_classes: 100 + additional_cmake_args: ['-DCMAKE_CXX_FLAGS=-fno-exceptions -fno-rtti'] + benchmark_generation_flags: [] + columns: + dimension: "name" + pretty_printer: + fixed_map: + "fruit_executable_size_without_exceptions_and_rtti": "Fruit" + "boost_di_executable_size_without_exceptions_and_rtti": "Boost.DI" + "simple_di_executable_size_without_exceptions_and_rtti": "Simple DI" + "simple_di_with_interfaces_executable_size_without_exceptions_and_rtti": "Simple DI w/ interfaces" + "simple_di_with_interfaces_and_new_delete_executable_size_without_exceptions_and_rtti": "Simple DI w/ interfaces, new/delete" + rows: *compiler_name_row + results: + dimension: "num_bytes" + unit: "bytes" + + - name: "Executable size (stripped, 250 classes, no exceptions/rtti)" + benchmark_filter: + num_classes: 250 + additional_cmake_args: ['-DCMAKE_CXX_FLAGS=-fno-exceptions -fno-rtti'] + benchmark_generation_flags: [] + columns: + dimension: "name" + pretty_printer: + fixed_map: + "fruit_executable_size_without_exceptions_and_rtti": "Fruit" + "boost_di_executable_size_without_exceptions_and_rtti": "Boost.DI" + "simple_di_executable_size_without_exceptions_and_rtti": "Simple DI" + "simple_di_with_interfaces_executable_size_without_exceptions_and_rtti": "Simple DI w/ interfaces" + "simple_di_with_interfaces_and_new_delete_executable_size_without_exceptions_and_rtti": "Simple DI w/ interfaces, new/delete" + rows: *compiler_name_row + results: + dimension: "num_bytes" + unit: "bytes" + + - name: "Executable size (stripped, 1000 classes, no exceptions/rtti)" + benchmark_filter: + num_classes: 1000 + additional_cmake_args: ['-DCMAKE_CXX_FLAGS=-fno-exceptions -fno-rtti'] + benchmark_generation_flags: [] + columns: + dimension: "name" + pretty_printer: + fixed_map: + "fruit_executable_size_without_exceptions_and_rtti": "Fruit" + "boost_di_executable_size_without_exceptions_and_rtti": "Boost.DI" + "simple_di_executable_size_without_exceptions_and_rtti": "Simple DI" + "simple_di_with_interfaces_executable_size_without_exceptions_and_rtti": "Simple DI w/ interfaces" + "simple_di_with_interfaces_and_new_delete_executable_size_without_exceptions_and_rtti": "Simple DI w/ interfaces, new/delete" rows: *compiler_name_row results: dimension: "num_bytes" @@ -366,10 +565,10 @@ tables: dimension: "compile_time" unit: "seconds" - - name: "Full injection time (100 classes)" + - name: "Startup time (100 classes)" benchmark_filter: num_classes: 100 - name: "fruit_run_time" + name: "fruit_startup_time" benchmark_generation_flags: [] columns: dimension: "additional_cmake_args" @@ -383,13 +582,13 @@ tables: to: "Statically-linking with Fruit" rows: *compiler_name_row results: - dimension: "Full injection time" + dimension: "startup_time" unit: "seconds" - - name: "Setup time (100 classes)" + - name: "Startup time (100 classes)" benchmark_filter: num_classes: 100 - name: "fruit_run_time" + name: "fruit_startup_time" benchmark_generation_flags: [] columns: dimension: "additional_cmake_args" @@ -403,7 +602,7 @@ tables: to: "Statically-linking with Fruit" rows: *compiler_name_row results: - dimension: "Total for setup" + dimension: "startup_time" unit: "seconds" - name: "Per-request time (100 classes)" -- cgit v1.2.3 From 41e5182758dc9939215135b2937d64b479e51147 Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Wed, 8 Apr 2020 21:35:07 -0700 Subject: Fix a bug in the error reporting code for benchmarks. --- extras/benchmark/format_bench_results.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/benchmark/format_bench_results.py b/extras/benchmark/format_bench_results.py index 05e65ab..6a33781 100755 --- a/extras/benchmark/format_bench_results.py +++ b/extras/benchmark/format_bench_results.py @@ -358,7 +358,7 @@ def main(): print() print() except Exception as e: - print('While processing table:\n' + table_definition) + print('While processing table:\n%s' % table_definition) print() raise e for bench_result in bench_results: -- cgit v1.2.3 From 8b36b4f992354f5409588560c906e29fcb1bc61f Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Wed, 8 Apr 2020 21:35:36 -0700 Subject: Remove duplicated benchs from the Fruit suite definition. --- extras/benchmark/suites/fruit_full.yml | 1 - extras/benchmark/suites/fruit_mostly_full.yml | 1 - 2 files changed, 2 deletions(-) diff --git a/extras/benchmark/suites/fruit_full.yml b/extras/benchmark/suites/fruit_full.yml index 4cd30e8..9709291 100644 --- a/extras/benchmark/suites/fruit_full.yml +++ b/extras/benchmark/suites/fruit_full.yml @@ -40,7 +40,6 @@ benchmarks: - [] - name: - - "new_delete_run_time" - "fruit_compile_time" - "fruit_compile_memory" - "fruit_incremental_compile_time" diff --git a/extras/benchmark/suites/fruit_mostly_full.yml b/extras/benchmark/suites/fruit_mostly_full.yml index 516807c..f1eac70 100644 --- a/extras/benchmark/suites/fruit_mostly_full.yml +++ b/extras/benchmark/suites/fruit_mostly_full.yml @@ -37,7 +37,6 @@ benchmarks: - [] - name: - - "new_delete_run_time" - "fruit_compile_time" - "fruit_compile_memory" - "fruit_incremental_compile_time" -- cgit v1.2.3 From de2352f337d3eb8000e93db0be11fc05ea9fcde1 Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Wed, 8 Apr 2020 21:36:00 -0700 Subject: Run simple DI benchs with 250/1000 classes too. --- extras/benchmark/suites/simple_di_full.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/extras/benchmark/suites/simple_di_full.yml b/extras/benchmark/suites/simple_di_full.yml index 9d490eb..6c104aa 100644 --- a/extras/benchmark/suites/simple_di_full.yml +++ b/extras/benchmark/suites/simple_di_full.yml @@ -51,8 +51,7 @@ benchmarks: - "simple_di_with_interfaces_and_new_delete_startup_time" - "simple_di_with_interfaces_and_new_delete_executable_size" loop_factor: 1.0 - num_classes: - - 100 + num_classes: *num_classes compiler: *compilers cxx_std: "c++11" additional_cmake_args: @@ -65,8 +64,7 @@ benchmarks: - "simple_di_with_interfaces_executable_size_without_exceptions_and_rtti" - "simple_di_with_interfaces_and_new_delete_executable_size_without_exceptions_and_rtti" loop_factor: 1.0 - num_classes: - - 100 + num_classes: *num_classes compiler: *compilers cxx_std: "c++11" additional_cmake_args: -- cgit v1.2.3 From a512c342e0f938063fbceb98d493312d3a55479f Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sat, 11 Apr 2020 15:09:48 -0700 Subject: Add support for 250 classes to new_delete_benchmark.cpp. --- extras/benchmark/new_delete_benchmark.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/extras/benchmark/new_delete_benchmark.cpp b/extras/benchmark/new_delete_benchmark.cpp index 8131eac..d30d835 100644 --- a/extras/benchmark/new_delete_benchmark.cpp +++ b/extras/benchmark/new_delete_benchmark.cpp @@ -29,6 +29,9 @@ #elif MULTIPLIER == 100 #define REPEAT(X) REPEAT_100(X, _) +#elif MULTIPLIER == 250 +#define REPEAT(X) REPEAT_250(X, _) + #elif MULTIPLIER == 1000 #define REPEAT(X) REPEAT_1000(X, _) @@ -48,12 +51,21 @@ R PLACEHOLDER(X, I##5) R PLACEHOLDER(X, I##6) R PLACEHOLDER(X, I##7) R PLACEHOLDER(X, I##8) \ R PLACEHOLDER(X, I##9) +#define META_REPEAT_5(R, X, I) \ + R PLACEHOLDER(X, I##0) R PLACEHOLDER(X, I##1) R PLACEHOLDER(X, I##2) R PLACEHOLDER(X, I##3) R PLACEHOLDER(X, I##4) + #define REPEAT_1(X, I) X(I) +#define REPEAT_5(X, I) META_REPEAT_5(REPEAT_1, X, I) + #define REPEAT_10(X, I) META_REPEAT_10(REPEAT_1, X, I) +#define REPEAT_25(X, I) META_REPEAT_5(REPEAT_5, X, I) + #define REPEAT_100(X, I) META_REPEAT_10(REPEAT_10, X, I) +#define REPEAT_250(X, I) META_REPEAT_10(REPEAT_25, X, I) + #define REPEAT_1000(X, I) META_REPEAT_10(REPEAT_100, X, I) using namespace std; -- cgit v1.2.3 From 9dd77e9d31df4ff72eced73c6fa2ee8ecbc8775c Mon Sep 17 00:00:00 2001 From: Laszlo Nagy Date: Fri, 17 Apr 2020 14:23:20 +1000 Subject: Fix FindFruit.cmake file - The filename forces the module to be called `Fruit`. (Lower case letter as `fruit` makes warning during the configure step.) - The FRUIT_INSTALLED_DIR is a good concept, but needs to annotated as CMake variable, otherwise it uses the string as is. - The library prefix shall allow `lib64` since this is very common prefix in many distro. (Would be also nice to add the debian variants of `lib/i386-linux-gnu` or `lib/x86_64-linux-gnu`.) --- cmake-modules/FindFruit.cmake | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/cmake-modules/FindFruit.cmake b/cmake-modules/FindFruit.cmake index a6155cd..3b4fc24 100644 --- a/cmake-modules/FindFruit.cmake +++ b/cmake-modules/FindFruit.cmake @@ -2,23 +2,23 @@ # set(ENV{FRUIT_INSTALLED_DIR} "/path/to/fruit/build") find_path(FRUIT_INCLUDE_DIR fruit.h - HINTS ( - FRUIT_INSTALLED_DIR - /usr - /usr/local - ) - PATH_SUFFIXES include/fruit include fruit -) + HINTS ( + ${FRUIT_INSTALLED_DIR} + /usr + /usr/local + ) + PATH_SUFFIXES include/fruit + ) find_library(FRUIT_LIBRARY - NAMES fruit - HINTS ( - FRUIT_INSTALLED_DIR - /usr - /usr/local - ) - PATH_SUFFIXES lib ${FRUIT_INSTALLED_DIR} -) + NAMES fruit + HINTS ( + ${FRUIT_INSTALLED_DIR} + /usr + /usr/local + ) + PATH_SUFFIXES lib lib64 + ) include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(fruit DEFAULT_MSG FRUIT_LIBRARY FRUIT_INCLUDE_DIR) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(Fruit DEFAULT_MSG FRUIT_LIBRARY FRUIT_INCLUDE_DIR) -- cgit v1.2.3 From b0fee156740001614e2834f0728d703a0a0e713d Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sat, 2 May 2020 10:57:33 -0700 Subject: Update the Travis CI config to test against Ubuntu 20.04 instead of 19.10 and GCC 10 instead of 9. --- .travis.yml | 66 +++++++++++++++++----------------- extras/scripts/travis_yml_generator.py | 10 +++--- 2 files changed, 38 insertions(+), 38 deletions(-) diff --git a/.travis.yml b/.travis.yml index d111db3..e55e08f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,38 +10,38 @@ matrix: fast_finish: true include: - compiler: gcc - env: COMPILER=gcc-9 UBUNTU=19.10 TEST=ReleasePlain - install: export OS=linux; export COMPILER='gcc-9'; export UBUNTU='19.10'; extras/scripts/travis_ci_install_linux.sh + env: COMPILER=gcc-10 UBUNTU=20.04 TEST=ReleasePlain + install: export OS=linux; export COMPILER='gcc-10'; export UBUNTU='20.04'; extras/scripts/travis_ci_install_linux.sh os: linux - script: export OS=linux; export COMPILER='gcc-9'; export UBUNTU='19.10'; extras/scripts/postsubmit.sh + script: export OS=linux; export COMPILER='gcc-10'; export UBUNTU='20.04'; extras/scripts/postsubmit.sh ReleasePlain - compiler: gcc - env: COMPILER=gcc-9 UBUNTU=19.10 TEST=DebugPlain - install: export OS=linux; export COMPILER='gcc-9'; export UBUNTU='19.10'; extras/scripts/travis_ci_install_linux.sh + env: COMPILER=gcc-10 UBUNTU=20.04 TEST=DebugPlain + install: export OS=linux; export COMPILER='gcc-10'; export UBUNTU='20.04'; extras/scripts/travis_ci_install_linux.sh os: linux - script: export OS=linux; export COMPILER='gcc-9'; export UBUNTU='19.10'; extras/scripts/postsubmit.sh + script: export OS=linux; export COMPILER='gcc-10'; export UBUNTU='20.04'; extras/scripts/postsubmit.sh DebugPlain - compiler: clang - env: COMPILER=clang-6.0 STL=libstdc++ UBUNTU=19.10 TEST=ReleasePlain + env: COMPILER=clang-6.0 STL=libstdc++ UBUNTU=20.04 TEST=ReleasePlain install: export OS=linux; export COMPILER='clang-6.0'; export STL='libstdc++'; - export UBUNTU='19.10'; extras/scripts/travis_ci_install_linux.sh + export UBUNTU='20.04'; extras/scripts/travis_ci_install_linux.sh os: linux script: export OS=linux; export COMPILER='clang-6.0'; export STL='libstdc++'; - export UBUNTU='19.10'; extras/scripts/postsubmit.sh ReleasePlain + export UBUNTU='20.04'; extras/scripts/postsubmit.sh ReleasePlain - compiler: clang - env: COMPILER=clang-6.0 STL=libstdc++ UBUNTU=19.10 TEST=DebugAsanUbsan + env: COMPILER=clang-6.0 STL=libstdc++ UBUNTU=20.04 TEST=DebugAsanUbsan install: export OS=linux; export COMPILER='clang-6.0'; export STL='libstdc++'; - export UBUNTU='19.10'; extras/scripts/travis_ci_install_linux.sh + export UBUNTU='20.04'; extras/scripts/travis_ci_install_linux.sh os: linux script: export OS=linux; export COMPILER='clang-6.0'; export STL='libstdc++'; - export UBUNTU='19.10'; extras/scripts/postsubmit.sh DebugAsanUbsan + export UBUNTU='20.04'; extras/scripts/postsubmit.sh DebugAsanUbsan - compiler: clang - env: COMPILER=clang-6.0 STL=libstdc++ UBUNTU=19.10 TEST=DebugPlain + env: COMPILER=clang-6.0 STL=libstdc++ UBUNTU=20.04 TEST=DebugPlain install: export OS=linux; export COMPILER='clang-6.0'; export STL='libstdc++'; - export UBUNTU='19.10'; extras/scripts/travis_ci_install_linux.sh + export UBUNTU='20.04'; extras/scripts/travis_ci_install_linux.sh os: linux script: export OS=linux; export COMPILER='clang-6.0'; export STL='libstdc++'; - export UBUNTU='19.10'; extras/scripts/postsubmit.sh DebugPlain + export UBUNTU='20.04'; extras/scripts/postsubmit.sh DebugPlain - compiler: gcc env: COMPILER=bazel UBUNTU=18.04 install: export OS=linux; export COMPILER='bazel'; export UBUNTU='18.04'; extras/scripts/travis_ci_install_linux.sh @@ -49,45 +49,45 @@ matrix: script: export OS=linux; export COMPILER='bazel'; export UBUNTU='18.04'; extras/scripts/postsubmit.sh DebugPlain - compiler: gcc - env: COMPILER=gcc-7 UBUNTU=19.10 TEST=ReleasePlain - install: export OS=linux; export COMPILER='gcc-7'; export UBUNTU='19.10'; extras/scripts/travis_ci_install_linux.sh + env: COMPILER=gcc-7 UBUNTU=20.04 TEST=ReleasePlain + install: export OS=linux; export COMPILER='gcc-7'; export UBUNTU='20.04'; extras/scripts/travis_ci_install_linux.sh os: linux - script: export OS=linux; export COMPILER='gcc-7'; export UBUNTU='19.10'; extras/scripts/postsubmit.sh + script: export OS=linux; export COMPILER='gcc-7'; export UBUNTU='20.04'; extras/scripts/postsubmit.sh ReleasePlain - compiler: gcc - env: COMPILER=gcc-7 UBUNTU=19.10 TEST=DebugPlain - install: export OS=linux; export COMPILER='gcc-7'; export UBUNTU='19.10'; extras/scripts/travis_ci_install_linux.sh + env: COMPILER=gcc-7 UBUNTU=20.04 TEST=DebugPlain + install: export OS=linux; export COMPILER='gcc-7'; export UBUNTU='20.04'; extras/scripts/travis_ci_install_linux.sh os: linux - script: export OS=linux; export COMPILER='gcc-7'; export UBUNTU='19.10'; extras/scripts/postsubmit.sh + script: export OS=linux; export COMPILER='gcc-7'; export UBUNTU='20.04'; extras/scripts/postsubmit.sh DebugPlain - compiler: clang - env: COMPILER=clang-10.0 STL=libstdc++ UBUNTU=19.10 TEST=ReleasePlain + env: COMPILER=clang-10.0 STL=libstdc++ UBUNTU=20.04 TEST=ReleasePlain install: export OS=linux; export COMPILER='clang-10.0'; export STL='libstdc++'; - export UBUNTU='19.10'; extras/scripts/travis_ci_install_linux.sh + export UBUNTU='20.04'; extras/scripts/travis_ci_install_linux.sh os: linux script: export OS=linux; export COMPILER='clang-10.0'; export STL='libstdc++'; - export UBUNTU='19.10'; extras/scripts/postsubmit.sh ReleasePlain + export UBUNTU='20.04'; extras/scripts/postsubmit.sh ReleasePlain - compiler: clang - env: COMPILER=clang-10.0 STL=libstdc++ UBUNTU=19.10 TEST=DebugAsanUbsan + env: COMPILER=clang-10.0 STL=libstdc++ UBUNTU=20.04 TEST=DebugAsanUbsan install: export OS=linux; export COMPILER='clang-10.0'; export STL='libstdc++'; - export UBUNTU='19.10'; extras/scripts/travis_ci_install_linux.sh + export UBUNTU='20.04'; extras/scripts/travis_ci_install_linux.sh os: linux script: export OS=linux; export COMPILER='clang-10.0'; export STL='libstdc++'; - export UBUNTU='19.10'; extras/scripts/postsubmit.sh DebugAsanUbsan + export UBUNTU='20.04'; extras/scripts/postsubmit.sh DebugAsanUbsan - compiler: clang - env: COMPILER=clang-9.0 STL=libc++ UBUNTU=19.10 TEST=ReleasePlainNoPchNoClangTidy + env: COMPILER=clang-9.0 STL=libc++ UBUNTU=20.04 TEST=ReleasePlainNoPchNoClangTidy install: export OS=linux; export COMPILER='clang-9.0'; export STL='libc++'; export - UBUNTU='19.10'; extras/scripts/travis_ci_install_linux.sh + UBUNTU='20.04'; extras/scripts/travis_ci_install_linux.sh os: linux script: export OS=linux; export COMPILER='clang-9.0'; export STL='libc++'; export - UBUNTU='19.10'; extras/scripts/postsubmit.sh ReleasePlainNoPchNoClangTidy + UBUNTU='20.04'; extras/scripts/postsubmit.sh ReleasePlainNoPchNoClangTidy - compiler: clang - env: COMPILER=clang-9.0 STL=libc++ UBUNTU=19.10 TEST=DebugAsanUbsanNoPchNoClangTidy + env: COMPILER=clang-9.0 STL=libc++ UBUNTU=20.04 TEST=DebugAsanUbsanNoPchNoClangTidy install: export OS=linux; export COMPILER='clang-9.0'; export STL='libc++'; export - UBUNTU='19.10'; extras/scripts/travis_ci_install_linux.sh + UBUNTU='20.04'; extras/scripts/travis_ci_install_linux.sh os: linux script: export OS=linux; export COMPILER='clang-9.0'; export STL='libc++'; export - UBUNTU='19.10'; extras/scripts/postsubmit.sh DebugAsanUbsanNoPchNoClangTidy + UBUNTU='20.04'; extras/scripts/postsubmit.sh DebugAsanUbsanNoPchNoClangTidy - compiler: gcc env: COMPILER=gcc-5 UBUNTU=18.04 TEST=ReleasePlain install: export OS=linux; export COMPILER='gcc-5'; export UBUNTU='18.04'; extras/scripts/travis_ci_install_linux.sh diff --git a/extras/scripts/travis_yml_generator.py b/extras/scripts/travis_yml_generator.py index 82c9388..8a67784 100755 --- a/extras/scripts/travis_yml_generator.py +++ b/extras/scripts/travis_yml_generator.py @@ -146,14 +146,14 @@ def add_bazel_tests(ubuntu_version, smoke_tests=[]): # TODO: re-enable ASan/UBSan once they work in Travis CI. ATM (as of 18 November 2017) they fail due to https://github.com/google/sanitizers/issues/837 -add_ubuntu_tests(ubuntu_version='19.10', compiler='gcc-7', asan=False, ubsan=False) -add_ubuntu_tests(ubuntu_version='19.10', compiler='gcc-9', asan=False, ubsan=False, +add_ubuntu_tests(ubuntu_version='20.04', compiler='gcc-7', asan=False, ubsan=False) +add_ubuntu_tests(ubuntu_version='20.04', compiler='gcc-10', asan=False, ubsan=False, smoke_tests=['DebugPlain', 'ReleasePlain']) -add_ubuntu_tests(ubuntu_version='19.10', compiler='clang-6.0', stl='libstdc++', +add_ubuntu_tests(ubuntu_version='20.04', compiler='clang-6.0', stl='libstdc++', smoke_tests=['DebugPlain', 'DebugAsanUbsan', 'ReleasePlain']) -add_ubuntu_tests(ubuntu_version='19.10', compiler='clang-10.0', stl='libstdc++') +add_ubuntu_tests(ubuntu_version='20.04', compiler='clang-10.0', stl='libstdc++') # Using Clang 10 + libc++ doesn't work as of March 2020, it can't find STL headers. -add_ubuntu_tests(ubuntu_version='19.10', compiler='clang-9.0', stl='libc++', +add_ubuntu_tests(ubuntu_version='20.04', compiler='clang-9.0', stl='libc++', # Disabled due to https://bugs.llvm.org/show_bug.cgi?id=41625. use_precompiled_headers_in_tests=False, # As of March 2020, Clang tidy segfaults and can't find STL headers (not sure if these issues are related or independent). -- cgit v1.2.3 From af6fb8328f35b493fac0e1196879af01469699bb Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sat, 2 May 2020 12:15:10 -0700 Subject: Add dockerfiles for Ubuntu 20.04. --- extras/benchmark/format_bench_results.py | 61 ++- extras/benchmark/run_benchmarks.py | 2 +- extras/benchmark/tables/fruit_internal.yml | 710 +++++++++++++++++++++++----- extras/dockerfiles/Dockerfile.ubuntu-20.04 | 9 + extras/dockerfiles/rebuild_all.sh | 2 +- extras/dockerfiles/ubuntu-20.04_custom.list | 0 extras/dockerfiles/ubuntu-20.04_install.sh | 31 ++ 7 files changed, 677 insertions(+), 138 deletions(-) create mode 100644 extras/dockerfiles/Dockerfile.ubuntu-20.04 create mode 100644 extras/dockerfiles/ubuntu-20.04_custom.list create mode 100644 extras/dockerfiles/ubuntu-20.04_install.sh diff --git a/extras/benchmark/format_bench_results.py b/extras/benchmark/format_bench_results.py index 6a33781..614db07 100755 --- a/extras/benchmark/format_bench_results.py +++ b/extras/benchmark/format_bench_results.py @@ -25,10 +25,13 @@ def extract_results(bench_results: List[Dict[str, Dict[Any, Any]]], column_dimension: str, row_dimension: str, result_dimension: str) -> Tuple[Dict[str, Dict[str, Dict[str, Any]]], - Set[Tuple[List[Tuple[str, str]], ...]]]: + Set[Tuple[List[Tuple[str, str]], ...]], + Set[Tuple[Tuple[List[Tuple[str, str]], ...], + str]]]: table_data = defaultdict(lambda: dict()) # type: Dict[str, Dict[str, Dict[str, Any]]] remaining_dimensions_by_row_column = dict() used_bench_results = set() # type: Set[Tuple[List[Tuple[str, str]], ...]] + used_bench_result_values = set() # type: Set[Tuple[Tuple[List[Tuple[str, str]], ...], str]] for bench_result in bench_results: try: params = {dimension_name: make_immutable(dimension_value) @@ -51,6 +54,8 @@ def extract_results(bench_results: List[Dict[str, Dict[Any, Any]]], assert column_dimension in params.keys(), '%s not in %s' % (column_dimension, params.keys()) assert result_dimension in results, '%s not in %s' % (result_dimension, results) used_bench_results.add(tuple(sorted(original_params.items()))) + used_bench_result_values.add((tuple(sorted(original_params.items())), + result_dimension)) row_value = params[row_dimension] column_value = params[column_dimension] remaining_dimensions = params.copy() @@ -60,13 +65,13 @@ def extract_results(bench_results: List[Dict[str, Dict[Any, Any]]], previous_remaining_dimensions = remaining_dimensions_by_row_column[(row_value, column_value)] raise Exception( 'Found multiple benchmark results with the same fixed benchmark params, benchmark param for row and benchmark param for column, so a result can\'t be uniquely determined. ' - + 'Consider adding additional values in fixed_benchmark_params. Remaining dimensions: %s vs %s' % ( + + 'Consider adding additional values in fixed_benchmark_params. Remaining dimensions:\n%s\nvs\n%s' % ( remaining_dimensions, previous_remaining_dimensions)) table_data[row_value][column_value] = results[result_dimension] remaining_dimensions_by_row_column[(row_value, column_value)] = remaining_dimensions except Exception as e: raise Exception('While processing %s' % bench_result) from e - return table_data, used_bench_results + return table_data, used_bench_results, used_bench_result_values # Takes a 2-dimensional array (list of lists) and prints a markdown table with that content. def print_markdown_table(table_data: List[List[str]]) -> None: @@ -133,16 +138,17 @@ def print_confidence_intervals_table(table_name, baseline_table_data, column_header_pretty_printer: DimensionPrettyPrinter, row_header_pretty_printer: DimensionPrettyPrinter, - value_pretty_printer: IntervalPrettyPrinter): + value_pretty_printer: IntervalPrettyPrinter, + row_sort_key: Callable[[Any], Any]): if table_data == {}: print('%s: (no data)' % table_name) return - row_headers = sorted(list(table_data.keys())) + row_headers = sorted(list(table_data.keys()), key=row_sort_key) # We need to compute the union of the headers of all rows; some rows might be missing values for certain columns. column_headers = sorted(set().union(*[list(row_values.keys()) for row_values in table_data.values()])) if baseline_table_data: - baseline_row_headers = sorted(list(baseline_table_data.keys())) + baseline_row_headers = sorted(list(baseline_table_data.keys()), key=row_sort_key) baseline_column_headers = sorted(set().union(*[list(row_values.keys()) for row_values in baseline_table_data.values()])) unmached_baseline_column_headers = set(baseline_row_headers) - set(row_headers) if unmached_baseline_column_headers: @@ -186,6 +192,11 @@ def format_string_pretty_printer(format_string: str) -> Callable[[str], str]: return pretty_print +def float_to_str(x: float) -> str: + if x > 100: + return str(int(x)) + else: + return '%.2g' % x def interval_pretty_printer(interval: Interval, unit: str, multiplier: float) -> str: interval = list(interval) # type: List[Any] @@ -198,11 +209,11 @@ def interval_pretty_printer(interval: Interval, unit: str, multiplier: float) -> if int(interval[0]) == interval[0] and interval[0] >= 10: interval[0] = int(interval[0]) else: - interval[0] = '%.3g' % interval[0] + interval[0] = float_to_str(interval[0]) if int(interval[1]) == interval[1] and interval[1] >= 10: interval[1] = int(interval[1]) else: - interval[1] = '%.3g' % interval[1] + interval[1] = float_to_str(interval[1]) if interval[0] == interval[1]: return '%s %s' % (interval[0], unit) @@ -294,6 +305,13 @@ def determine_column_pretty_printer(pretty_printer_definition: Dict[str, Any]) - def determine_row_pretty_printer(pretty_printer_definition: Dict[str, Any]) -> DimensionPrettyPrinter: return determine_column_pretty_printer(pretty_printer_definition) +def determine_row_sort_key(pretty_printer_definition: Dict[str, Any]) -> Callable[[Any], Any]: + if 'fixed_map' in pretty_printer_definition: + indexes = {x: i for i, x in enumerate(pretty_printer_definition['fixed_map'].keys())} + return lambda s: indexes[s] + + return lambda x: x + def determine_value_pretty_printer(unit: str) -> IntervalPrettyPrinter: if unit == "seconds": return time_interval_pretty_printer @@ -327,18 +345,22 @@ def main(): with open(args.benchmark_tables_definition, 'r') as f: used_bench_results = set() - for table_definition in yaml.safe_load(f)["tables"]: + # Set of (Benchmark definition, Benchmark result name) pairs + used_bench_result_values = set() + config = yaml.full_load(f) + for table_definition in config["tables"]: try: fixed_benchmark_params = {dimension_name: make_immutable(dimension_value) for dimension_name, dimension_value in table_definition['benchmark_filter'].items()} - table_data, last_used_bench_results = extract_results( + table_data, last_used_bench_results, last_used_bench_result_values = extract_results( bench_results, fixed_benchmark_params=fixed_benchmark_params, column_dimension=table_definition['columns']['dimension'], row_dimension=table_definition['rows']['dimension'], result_dimension=table_definition['results']['dimension']) used_bench_results = used_bench_results.union(last_used_bench_results) + used_bench_result_values = used_bench_result_values.union(last_used_bench_result_values) if baseline_bench_results: - baseline_table_data, _ = extract_results( + baseline_table_data, _, _ = extract_results( baseline_bench_results, fixed_benchmark_params=fixed_benchmark_params, column_dimension=table_definition['columns']['dimension'], @@ -354,18 +376,29 @@ def main(): baseline_table_data, column_header_pretty_printer=determine_column_pretty_printer(columns_pretty_printer_definition), row_header_pretty_printer=determine_row_pretty_printer(rows_pretty_printer_definition), - value_pretty_printer=determine_value_pretty_printer(results_unit)) + value_pretty_printer=determine_value_pretty_printer(results_unit), + row_sort_key=determine_row_sort_key(rows_pretty_printer_definition)) print() print() except Exception as e: print('While processing table:\n%s' % table_definition) print() raise e + allowed_unused_benchmarks = set(config.get('allowed_unused_benchmarks', [])) + allowed_unused_benchmark_results = set(config.get('allowed_unused_benchmark_results', [])) for bench_result in bench_results: params = {dimension_name: make_immutable(dimension_value) for dimension_name, dimension_value in bench_result['benchmark'].items()} - if tuple(sorted(params.items())) not in used_bench_results: - print('Warning: benchmark result did not match any tables: %s' % params) + benchmark_defn = tuple(sorted(params.items())) + if benchmark_defn not in used_bench_results: + if params['name'] not in allowed_unused_benchmarks: + print('Warning: benchmark result did not match any tables: %s' % params) + else: + unused_result_dimensions = {result_dimension + for result_dimension in bench_result['results'].keys() + if (benchmark_defn, result_dimension) not in used_bench_result_values and result_dimension not in allowed_unused_benchmark_results} + if unused_result_dimensions: + print('Warning: unused result dimensions %s in benchmark result %s' % (unused_result_dimensions, params)) if __name__ == "__main__": diff --git a/extras/benchmark/run_benchmarks.py b/extras/benchmark/run_benchmarks.py index 0bddbc7..1fc3fd4 100755 --- a/extras/benchmark/run_benchmarks.py +++ b/extras/benchmark/run_benchmarks.py @@ -752,7 +752,7 @@ def main(): fruit_build_dir = tempfile.gettempdir() + '/fruit-benchmark-build-dir' with open(args.benchmark_definition, 'r') as f: - yaml_file_content = yaml.safe_load(f) + yaml_file_content = yaml.full_load(f) global_definitions = yaml_file_content['global'] benchmark_definitions = expand_benchmark_definitions(yaml_file_content['benchmarks']) diff --git a/extras/benchmark/tables/fruit_internal.yml b/extras/benchmark/tables/fruit_internal.yml index 2649398..dfc7a27 100644 --- a/extras/benchmark/tables/fruit_internal.yml +++ b/extras/benchmark/tables/fruit_internal.yml @@ -16,179 +16,283 @@ constants: pretty_printer: format_string: "%s" +allowed_unused_benchmarks: + - new_delete_run_time + - fruit_single_file_compile_time + +allowed_unused_benchmark_results: + - total_max_ram_usage + tables: - - name: "Fruit compile time (single file)" - benchmark_filter: - name: "fruit_single_file_compile_time" - benchmark_generation_flags: [] - additional_cmake_args: [] - columns: *num_bindings_column - rows: *compiler_name_row - results: - dimension: "compile_time" - unit: "seconds" - - - name: "Fruit compile time" + + # Fruit vs Boost.DI and "no DI" + + - name: "Compile time (Clang)" benchmark_filter: - name: "fruit_compile_time" benchmark_generation_flags: [] additional_cmake_args: [] + compiler: "clang++-10" + name: [ + "fruit_compile_time", + "boost_di_compile_time", + "simple_di_compile_time", + "simple_di_with_interfaces_compile_time", + "simple_di_with_interfaces_and_new_delete_compile_time", + ] + rows: + dimension: "name" + pretty_printer: + fixed_map: + "fruit_compile_time": "Fruit" + "boost_di_compile_time": "Boost.DI" + "simple_di_compile_time": "Simple DI" + "simple_di_with_interfaces_compile_time": "Simple DI w/ interfaces" + "simple_di_with_interfaces_and_new_delete_compile_time": "Simple DI w/ interfaces, new/delete" columns: *num_classes_column - rows: *compiler_name_row results: dimension: "compile_time" unit: "seconds" - - name: "Fruit incremental compile time" + - name: "Compile time (GCC)" benchmark_filter: - name: "fruit_incremental_compile_time" benchmark_generation_flags: [] additional_cmake_args: [] + compiler: "g++-9" + name: [ + "fruit_compile_time", + "boost_di_compile_time", + "simple_di_compile_time", + "simple_di_with_interfaces_compile_time", + "simple_di_with_interfaces_and_new_delete_compile_time", + ] + rows: + dimension: "name" + pretty_printer: + fixed_map: + "fruit_compile_time": "Fruit" + "boost_di_compile_time": "Boost.DI" + "simple_di_compile_time": "Simple DI" + "simple_di_with_interfaces_compile_time": "Simple DI w/ interfaces" + "simple_di_with_interfaces_and_new_delete_compile_time": "Simple DI w/ interfaces, new/delete" columns: *num_classes_column - rows: *compiler_name_row results: dimension: "compile_time" unit: "seconds" - - name: "Fruit full injection time" + - name: "Incremental compile time (Clang)" benchmark_filter: - name: "fruit_run_time" benchmark_generation_flags: [] additional_cmake_args: [] + compiler: "clang++-10" + name: [ + "fruit_incremental_compile_time", + "boost_di_incremental_compile_time", + "simple_di_incremental_compile_time", + "simple_di_with_interfaces_incremental_compile_time", + "simple_di_with_interfaces_and_new_delete_incremental_compile_time", + ] + rows: + dimension: "name" + pretty_printer: + fixed_map: + "fruit_incremental_compile_time": "Fruit" + "boost_di_incremental_compile_time": "Boost.DI" + "simple_di_incremental_compile_time": "Simple DI" + "simple_di_with_interfaces_incremental_compile_time": "Simple DI w/ interfaces" + "simple_di_with_interfaces_and_new_delete_incremental_compile_time": "Simple DI w/ interfaces, new/delete" columns: *num_classes_column - rows: *compiler_name_row results: - dimension: "Full injection time" + dimension: "incremental_compile_time" unit: "seconds" - - name: "Fruit component normalization time" + - name: "Incremental compile time (GCC)" benchmark_filter: - name: "fruit_run_time" benchmark_generation_flags: [] additional_cmake_args: [] + compiler: "g++-9" + name: [ + "fruit_incremental_compile_time", + "boost_di_incremental_compile_time", + "simple_di_incremental_compile_time", + "simple_di_with_interfaces_incremental_compile_time", + "simple_di_with_interfaces_and_new_delete_incremental_compile_time", + ] + rows: + dimension: "name" + pretty_printer: + fixed_map: + "fruit_incremental_compile_time": "Fruit" + "boost_di_incremental_compile_time": "Boost.DI" + "simple_di_incremental_compile_time": "Simple DI" + "simple_di_with_interfaces_incremental_compile_time": "Simple DI w/ interfaces" + "simple_di_with_interfaces_and_new_delete_incremental_compile_time": "Simple DI w/ interfaces, new/delete" columns: *num_classes_column - rows: *compiler_name_row results: - dimension: "componentNormalizationTime" + dimension: "incremental_compile_time" unit: "seconds" - - name: "Fruit setup time" + - name: "Compile memory (Clang)" benchmark_filter: - name: "fruit_run_time" benchmark_generation_flags: [] additional_cmake_args: [] + compiler: "clang++-10" + name: [ + "fruit_compile_memory", + "boost_di_compile_memory", + "simple_di_compile_memory", + "simple_di_with_interfaces_compile_memory", + "simple_di_with_interfaces_and_new_delete_compile_memory", + ] + rows: + dimension: "name" + pretty_printer: + fixed_map: + "fruit_compile_memory": "Fruit" + "boost_di_compile_memory": "Boost.DI" + "simple_di_compile_memory": "Simple DI" + "simple_di_with_interfaces_compile_memory": "Simple DI w/ interfaces" + "simple_di_with_interfaces_and_new_delete_compile_memory": "Simple DI w/ interfaces, new/delete" columns: *num_classes_column - rows: *compiler_name_row results: - dimension: "Total for setup" - unit: "seconds" + dimension: "max_ram_usage" + unit: "bytes" - - name: "Fruit per-request time" + - name: "Compile memory (GCC)" benchmark_filter: - name: "fruit_run_time" benchmark_generation_flags: [] additional_cmake_args: [] + compiler: "g++-9" + name: [ + "fruit_compile_memory", + "boost_di_compile_memory", + "simple_di_compile_memory", + "simple_di_with_interfaces_compile_memory", + "simple_di_with_interfaces_and_new_delete_compile_memory", + ] + rows: + dimension: "name" + pretty_printer: + fixed_map: + "fruit_compile_memory": "Fruit" + "boost_di_compile_memory": "Boost.DI" + "simple_di_compile_memory": "Simple DI" + "simple_di_with_interfaces_compile_memory": "Simple DI w/ interfaces" + "simple_di_with_interfaces_and_new_delete_compile_memory": "Simple DI w/ interfaces, new/delete" columns: *num_classes_column - rows: *compiler_name_row results: - dimension: "Total per request" - unit: "seconds" - - - name: "New/delete time" - benchmark_filter: - name: "new_delete_run_time" + dimension: "max_ram_usage" + unit: "bytes" + + - name: "Startup time (Clang)" + benchmark_filter: + compiler: "clang++-10" benchmark_generation_flags: [] additional_cmake_args: [] + name: [ + "fruit_startup_time", + "boost_di_startup_time", + "simple_di_startup_time", + "simple_di_with_interfaces_startup_time", + "simple_di_with_interfaces_and_new_delete_startup_time", + ] + rows: + dimension: "name" + pretty_printer: + fixed_map: + "fruit_startup_time": "Fruit" + "boost_di_startup_time": "Boost.DI" + "simple_di_startup_time": "Simple DI" + "simple_di_with_interfaces_startup_time": "Simple DI w/ interfaces" + "simple_di_with_interfaces_and_new_delete_startup_time": "Simple DI w/ interfaces, new/delete" columns: *num_classes_column - rows: *compiler_name_row results: - dimension: "Total" + dimension: "startup_time" unit: "seconds" - - - name: "Compile time (100 classes)" + + - name: "Startup time (GCC)" benchmark_filter: - num_classes: 100 + compiler: "g++-9" benchmark_generation_flags: [] additional_cmake_args: [] name: [ - "fruit_compile_time", - "boost_di_compile_time", - "simple_di_compile_time", - "simple_di_with_interfaces_compile_time", - "simple_di_with_interfaces_and_new_delete_compile_time", + "fruit_startup_time", + "boost_di_startup_time", + "simple_di_startup_time", + "simple_di_with_interfaces_startup_time", + "simple_di_with_interfaces_and_new_delete_startup_time", ] - columns: + rows: dimension: "name" pretty_printer: fixed_map: - "fruit_compile_time": "Fruit" - "boost_di_compile_time": "Boost.DI" - "simple_di_compile_time": "Simple DI" - "simple_di_with_interfaces_compile_time": "Simple DI w/ interfaces" - "simple_di_with_interfaces_and_new_delete_compile_time": "Simple DI w/ interfaces, new/delete" - rows: *compiler_name_row + "fruit_startup_time": "Fruit" + "boost_di_startup_time": "Boost.DI" + "simple_di_startup_time": "Simple DI" + "simple_di_with_interfaces_startup_time": "Simple DI w/ interfaces" + "simple_di_with_interfaces_and_new_delete_startup_time": "Simple DI w/ interfaces, new/delete" + columns: *num_classes_column results: - dimension: "compile_time" + dimension: "startup_time" unit: "seconds" - - - name: "Incremental compile time (100 classes)" + + - name: "Startup time with normalized component (Clang)" benchmark_filter: - num_classes: 100 + compiler: "clang++-10" benchmark_generation_flags: [] additional_cmake_args: [] name: [ - "fruit_incremental_compile_time", - "boost_di_incremental_compile_time", - "simple_di_incremental_compile_time", - "simple_di_with_interfaces_incremental_compile_time", - "simple_di_with_interfaces_and_new_delete_incremental_compile_time", + "fruit_startup_time_with_normalized_component", + "boost_di_startup_time_with_normalized_component", + "simple_di_startup_time_with_normalized_component", + "simple_di_with_interfaces_startup_time_with_normalized_component", + "simple_di_with_interfaces_and_new_delete_startup_time_with_normalized_component", ] - columns: + rows: dimension: "name" pretty_printer: fixed_map: - "fruit_incremental_compile_time": "Fruit" - "boost_di_incremental_compile_time": "Boost.DI" - "simple_di_incremental_compile_time": "Simple DI" - "simple_di_with_interfaces_incremental_compile_time": "Simple DI w/ interfaces" - "simple_di_with_interfaces_and_new_delete_incremental_compile_time": "Simple DI w/ interfaces, new/delete" - rows: *compiler_name_row + "fruit_startup_time_with_normalized_component": "Fruit" + "boost_di_startup_time_with_normalized_component": "Boost.DI" + "simple_di_startup_time_with_normalized_component": "Simple DI" + "simple_di_with_interfaces_startup_time_with_normalized_component": "Simple DI w/ interfaces" + "simple_di_with_interfaces_and_new_delete_startup_time_with_normalized_component": "Simple DI w/ interfaces, new/delete" + columns: *num_classes_column results: - dimension: "compile_time" + dimension: "fruit_startup_time_with_normalized_component" unit: "seconds" - - name: "Compile memory (100 classes)" + - name: "Startup time with normalized component (GCC)" benchmark_filter: - num_classes: 100 + compiler: "g++-9" benchmark_generation_flags: [] additional_cmake_args: [] name: [ - "fruit_compile_memory", - "boost_di_compile_memory", - "simple_di_compile_memory", - "simple_di_with_interfaces_compile_memory", - "simple_di_with_interfaces_and_new_delete_compile_memory", + "fruit_startup_time_with_normalized_component", + "boost_di_startup_time_with_normalized_component", + "simple_di_startup_time_with_normalized_component", + "simple_di_with_interfaces_startup_time_with_normalized_component", + "simple_di_with_interfaces_and_new_delete_startup_time_with_normalized_component", ] - columns: + rows: dimension: "name" pretty_printer: fixed_map: - "fruit_compile_memory": "Fruit" - "boost_di_compile_memory": "Boost.DI" - "simple_di_incremental_compile_memory": "Simple DI" - "simple_di_with_interfaces_incremental_compile_memory": "Simple DI w/ interfaces" - "simple_di_with_interfaces_and_new_delete_incremental_compile_memory": "Simple DI w/ interfaces, new/delete" - rows: *compiler_name_row + "fruit_startup_time_with_normalized_component": "Fruit" + "boost_di_startup_time_with_normalized_component": "Boost.DI" + "simple_di_startup_time_with_normalized_component": "Simple DI" + "simple_di_with_interfaces_startup_time_with_normalized_component": "Simple DI w/ interfaces" + "simple_di_with_interfaces_and_new_delete_startup_time_with_normalized_component": "Simple DI w/ interfaces, new/delete" + columns: *num_classes_column results: - dimension: "max_ram_usage" - unit: "bytes" + dimension: "fruit_startup_time_with_normalized_component" + unit: "seconds" - - name: "Fruit full injection time (100 classes)" + - name: "Component normalization time (Clang)" benchmark_filter: - num_classes: 100 + compiler: "clang++-10" benchmark_generation_flags: [] additional_cmake_args: [] - columns: + rows: dimension: "name" pretty_printer: fixed_map: @@ -197,17 +301,17 @@ tables: "simple_di_incremental_run_time": "Simple DI" "simple_di_with_interfaces_incremental_run_time": "Simple DI w/ interfaces" "simple_di_with_interfaces_and_new_delete_incremental_run_time": "Simple DI w/ interfaces, new/delete" - rows: *compiler_name_row + columns: *num_classes_column results: - dimension: "Full injection time" + dimension: "componentNormalizationTime" unit: "seconds" - - name: "Fruit component normalization time (100 classes)" + - name: "Component normalization time (GCC)" benchmark_filter: - num_classes: 100 + compiler: "g++-9" benchmark_generation_flags: [] additional_cmake_args: [] - columns: + rows: dimension: "name" pretty_printer: fixed_map: @@ -216,65 +320,427 @@ tables: "simple_di_incremental_run_time": "Simple DI" "simple_di_with_interfaces_incremental_run_time": "Simple DI w/ interfaces" "simple_di_with_interfaces_and_new_delete_incremental_run_time": "Simple DI w/ interfaces, new/delete" - rows: *compiler_name_row + columns: *num_classes_column results: dimension: "componentNormalizationTime" unit: "seconds" - - - name: "Setup time (100 classes)" + - name: "Per-request time (Clang)" benchmark_filter: - num_classes: 100 + compiler: "clang++-10" benchmark_generation_flags: [] additional_cmake_args: [] - columns: + rows: dimension: "name" pretty_printer: fixed_map: "fruit_run_time": "Fruit" "boost_di_run_time": "Boost.DI" - "simple_di_incremental_run_time": "Simple DI" - "simple_di_with_interfaces_incremental_run_time": "Simple DI w/ interfaces" - "simple_di_with_interfaces_and_new_delete_incremental_run_time": "Simple DI w/ interfaces, new/delete" - rows: *compiler_name_row + "simple_di_run_time": "Simple DI" + "simple_di_with_interfaces_run_time": "Simple DI w/ interfaces" + "simple_di_with_interfaces_and_new_delete_run_time": "Simple DI w/ interfaces, new/delete" + columns: *num_classes_column results: - dimension: "Total for setup" + dimension: "Total per request" unit: "seconds" - - name: "Per-request time (100 classes)" + - name: "Per-request time (GCC)" benchmark_filter: - num_classes: 100 + compiler: "g++-9" benchmark_generation_flags: [] additional_cmake_args: [] - columns: + rows: dimension: "name" pretty_printer: fixed_map: "fruit_run_time": "Fruit" "boost_di_run_time": "Boost.DI" - "simple_di_incremental_run_time": "Simple DI" - "simple_di_with_interfaces_incremental_run_time": "Simple DI w/ interfaces" - "simple_di_with_interfaces_and_new_delete_incremental_run_time": "Simple DI w/ interfaces, new/delete" - rows: *compiler_name_row + "simple_di_run_time": "Simple DI" + "simple_di_with_interfaces_run_time": "Simple DI w/ interfaces" + "simple_di_with_interfaces_and_new_delete_run_time": "Simple DI w/ interfaces, new/delete" + columns: *num_classes_column results: dimension: "Total per request" unit: "seconds" - - - name: "Executable size (stripped, 100 classes)" + + - name: "Executable size (stripped, Clang)" benchmark_filter: - num_classes: 100 + compiler: "clang++-10" benchmark_generation_flags: [] additional_cmake_args: [] - columns: + rows: dimension: "name" pretty_printer: fixed_map: "fruit_executable_size": "Fruit" "boost_di_executable_size": "Boost.DI" - "simple_di_incremental_run_time": "Simple DI" - "simple_di_with_interfaces_incremental_run_time": "Simple DI w/ interfaces" - "simple_di_with_interfaces_and_new_delete_incremental_run_time": "Simple DI w/ interfaces, new/delete" - rows: *compiler_name_row + "simple_di_executable_size": "Simple DI" + "simple_di_with_interfaces_executable_size": "Simple DI w/ interfaces" + "simple_di_with_interfaces_and_new_delete_executable_size": "Simple DI w/ interfaces, new/delete" + columns: *num_classes_column + results: + dimension: "num_bytes" + unit: "bytes" + + - name: "Executable size (stripped, GCC)" + benchmark_filter: + compiler: "g++-9" + benchmark_generation_flags: [] + additional_cmake_args: [] + rows: + dimension: "name" + pretty_printer: + fixed_map: + "fruit_executable_size": "Fruit" + "boost_di_executable_size": "Boost.DI" + "simple_di_executable_size": "Simple DI" + "simple_di_with_interfaces_executable_size": "Simple DI w/ interfaces" + "simple_di_with_interfaces_and_new_delete_executable_size": "Simple DI w/ interfaces, new/delete" + columns: *num_classes_column + results: + dimension: "num_bytes" + unit: "bytes" + + - name: "Executable size (stripped, no exceptions/RTTI, Clang)" + benchmark_filter: + compiler: "clang++-10" + benchmark_generation_flags: [] + additional_cmake_args: ['-DCMAKE_CXX_FLAGS=-fno-exceptions -fno-rtti'] + rows: + dimension: "name" + pretty_printer: + fixed_map: + "fruit_executable_size_without_exceptions_and_rtti": "Fruit" + "boost_di_executable_size_without_exceptions_and_rtti": "Boost.DI" + "simple_di_executable_size_without_exceptions_and_rtti": "Simple DI" + "simple_di_with_interfaces_executable_size_without_exceptions_and_rtti": "Simple DI w/ interfaces" + "simple_di_with_interfaces_and_new_delete_executable_size_without_exceptions_and_rtti": "Simple DI w/ interfaces, new/delete" + columns: *num_classes_column + results: + dimension: "num_bytes" + unit: "bytes" + + - name: "Executable size (stripped, no exceptions/RTTI, GCC)" + benchmark_filter: + compiler: "g++-9" + benchmark_generation_flags: [] + additional_cmake_args: ['-DCMAKE_CXX_FLAGS=-fno-exceptions -fno-rtti'] + rows: + dimension: "name" + pretty_printer: + fixed_map: + "fruit_executable_size_without_exceptions_and_rtti": "Fruit" + "boost_di_executable_size_without_exceptions_and_rtti": "Boost.DI" + "simple_di_executable_size_without_exceptions_and_rtti": "Simple DI" + "simple_di_with_interfaces_executable_size_without_exceptions_and_rtti": "Simple DI w/ interfaces" + "simple_di_with_interfaces_and_new_delete_executable_size_without_exceptions_and_rtti": "Simple DI w/ interfaces, new/delete" + columns: *num_classes_column + results: + dimension: "num_bytes" + unit: "bytes" + + # Fruit: performance by default and with various compiler options. + + - name: "Fruit compile time (Clang)" + benchmark_filter: + benchmark_generation_flags: [] + compiler: "clang++-10" + name: "fruit_compile_time" + rows: + dimension: "additional_cmake_args" + pretty_printer: + fixed_map: + !!python/tuple []: "(defaults)" + !!python/tuple ["-DBUILD_SHARED_LIBS=False"]: "statically linked" + !!python/tuple ["-DFRUIT_USES_BOOST=False"]: "without boost" + columns: *num_classes_column + results: + dimension: "compile_time" + unit: "seconds" + + - name: "Fruit compile time (GCC)" + benchmark_filter: + benchmark_generation_flags: [] + compiler: "g++-9" + name: "fruit_compile_time" + rows: + dimension: "additional_cmake_args" + pretty_printer: + fixed_map: + !!python/tuple []: "(defaults)" + !!python/tuple ["-DBUILD_SHARED_LIBS=False"]: "statically linked" + !!python/tuple ["-DFRUIT_USES_BOOST=False"]: "without boost" + columns: *num_classes_column + results: + dimension: "compile_time" + unit: "seconds" + + - name: "Fruit incremental compile time (Clang)" + benchmark_filter: + benchmark_generation_flags: [] + compiler: "clang++-10" + name: "fruit_incremental_compile_time" + rows: + dimension: "additional_cmake_args" + pretty_printer: + fixed_map: + !!python/tuple []: "(defaults)" + !!python/tuple ["-DBUILD_SHARED_LIBS=False"]: "statically linked" + !!python/tuple ["-DFRUIT_USES_BOOST=False"]: "without boost" + columns: *num_classes_column + results: + dimension: "incremental_compile_time" + unit: "seconds" + + - name: "Fruit incremental compile time (GCC)" + benchmark_filter: + benchmark_generation_flags: [] + compiler: "g++-9" + name: "fruit_incremental_compile_time" + rows: + dimension: "additional_cmake_args" + pretty_printer: + fixed_map: + !!python/tuple []: "(defaults)" + !!python/tuple ["-DBUILD_SHARED_LIBS=False"]: "statically linked" + !!python/tuple ["-DFRUIT_USES_BOOST=False"]: "without boost" + columns: *num_classes_column + results: + dimension: "incremental_compile_time" + unit: "seconds" + + - name: "Fruit compile memory (Clang)" + benchmark_filter: + benchmark_generation_flags: [] + compiler: "clang++-10" + name: "fruit_compile_memory" + rows: + dimension: "additional_cmake_args" + pretty_printer: + fixed_map: + !!python/tuple []: "(defaults)" + !!python/tuple ["-DBUILD_SHARED_LIBS=False"]: "statically linked" + !!python/tuple ["-DFRUIT_USES_BOOST=False"]: "without boost" + columns: *num_classes_column + results: + dimension: "max_ram_usage" + unit: "bytes" + + - name: "Fruit compile memory (GCC)" + benchmark_filter: + benchmark_generation_flags: [] + compiler: "g++-9" + name: "fruit_compile_memory" + rows: + dimension: "additional_cmake_args" + pretty_printer: + fixed_map: + !!python/tuple []: "(defaults)" + !!python/tuple ["-DBUILD_SHARED_LIBS=False"]: "statically linked" + !!python/tuple ["-DFRUIT_USES_BOOST=False"]: "without boost" + columns: *num_classes_column + results: + dimension: "max_ram_usage" + unit: "bytes" + + - name: "Fruit startup time (Clang)" + benchmark_filter: + compiler: "clang++-10" + benchmark_generation_flags: [] + name: "fruit_startup_time" + rows: + dimension: "additional_cmake_args" + pretty_printer: + fixed_map: + !!python/tuple []: "(defaults)" + !!python/tuple ["-DBUILD_SHARED_LIBS=False"]: "statically linked" + !!python/tuple ["-DFRUIT_USES_BOOST=False"]: "without boost" + columns: *num_classes_column + results: + dimension: "startup_time" + unit: "seconds" + + - name: "Fruit startup time (GCC)" + benchmark_filter: + compiler: "g++-9" + benchmark_generation_flags: [] + name: "fruit_startup_time" + rows: + dimension: "additional_cmake_args" + pretty_printer: + fixed_map: + !!python/tuple []: "(defaults)" + !!python/tuple ["-DBUILD_SHARED_LIBS=False"]: "statically linked" + !!python/tuple ["-DFRUIT_USES_BOOST=False"]: "without boost" + columns: *num_classes_column + results: + dimension: "startup_time" + unit: "seconds" + + - name: "Fruit startup time with normalized component (Clang)" + benchmark_filter: + compiler: "clang++-10" + benchmark_generation_flags: [] + name: "fruit_startup_time_with_normalized_component" + rows: + dimension: "additional_cmake_args" + pretty_printer: + fixed_map: + !!python/tuple []: "(defaults)" + !!python/tuple ["-DBUILD_SHARED_LIBS=False"]: "statically linked" + !!python/tuple ["-DFRUIT_USES_BOOST=False"]: "without boost" + columns: *num_classes_column + results: + dimension: "startup_time" + unit: "seconds" + + - name: "Fruit startup time with normalized component (GCC)" + benchmark_filter: + compiler: "g++-9" + benchmark_generation_flags: [] + name: "fruit_startup_time_with_normalized_component" + rows: + dimension: "additional_cmake_args" + pretty_printer: + fixed_map: + !!python/tuple []: "(defaults)" + !!python/tuple ["-DBUILD_SHARED_LIBS=False"]: "statically linked" + !!python/tuple ["-DFRUIT_USES_BOOST=False"]: "without boost" + columns: *num_classes_column + results: + dimension: "startup_time" + unit: "seconds" + + - name: "Fruit component normalization time (Clang)" + benchmark_filter: + compiler: "clang++-10" + benchmark_generation_flags: [] + rows: + dimension: "additional_cmake_args" + pretty_printer: + fixed_map: + !!python/tuple []: "(defaults)" + !!python/tuple ["-DBUILD_SHARED_LIBS=False"]: "statically linked" + !!python/tuple ["-DFRUIT_USES_BOOST=False"]: "without boost" + columns: *num_classes_column + results: + dimension: "componentNormalizationTime" + unit: "seconds" + + - name: "Fruit component normalization time (GCC)" + benchmark_filter: + compiler: "g++-9" + benchmark_generation_flags: [] + rows: + dimension: "additional_cmake_args" + pretty_printer: + fixed_map: + !!python/tuple []: "(defaults)" + !!python/tuple ["-DBUILD_SHARED_LIBS=False"]: "statically linked" + !!python/tuple ["-DFRUIT_USES_BOOST=False"]: "without boost" + columns: *num_classes_column + results: + dimension: "componentNormalizationTime" + unit: "seconds" + + - name: "Fruit per-request time (Clang)" + benchmark_filter: + compiler: "clang++-10" + benchmark_generation_flags: [] + name: "fruit_run_time" + rows: + dimension: "additional_cmake_args" + pretty_printer: + fixed_map: + !!python/tuple []: "(defaults)" + !!python/tuple ["-DBUILD_SHARED_LIBS=False"]: "statically linked" + !!python/tuple ["-DFRUIT_USES_BOOST=False"]: "without boost" + columns: *num_classes_column + results: + dimension: "Total per request" + unit: "seconds" + + - name: "Fruit per-request time (GCC)" + benchmark_filter: + compiler: "g++-9" + benchmark_generation_flags: [] + name: "fruit_run_time" + rows: + dimension: "additional_cmake_args" + pretty_printer: + fixed_map: + !!python/tuple []: "(defaults)" + !!python/tuple ["-DBUILD_SHARED_LIBS=False"]: "statically linked" + !!python/tuple ["-DFRUIT_USES_BOOST=False"]: "without boost" + columns: *num_classes_column + results: + dimension: "Total per request" + unit: "seconds" + + - name: "Fruit executable size (stripped, Clang)" + benchmark_filter: + compiler: "clang++-10" + benchmark_generation_flags: [] + name: "fruit_executable_size" + rows: + dimension: "additional_cmake_args" + pretty_printer: + fixed_map: + !!python/tuple []: "(defaults)" + !!python/tuple ["-DBUILD_SHARED_LIBS=False"]: "statically linked" + !!python/tuple ["-DFRUIT_USES_BOOST=False"]: "without boost" + columns: *num_classes_column + results: + dimension: "num_bytes" + unit: "bytes" + + - name: "Fruit executable size (stripped, GCC)" + benchmark_filter: + compiler: "g++-9" + benchmark_generation_flags: [] + name: "fruit_executable_size" + rows: + dimension: "additional_cmake_args" + pretty_printer: + fixed_map: + !!python/tuple []: "(defaults)" + !!python/tuple ["-DBUILD_SHARED_LIBS=False"]: "statically linked" + !!python/tuple ["-DFRUIT_USES_BOOST=False"]: "without boost" + columns: *num_classes_column + results: + dimension: "num_bytes" + unit: "bytes" + + - name: "Fruit executable size (stripped, no exceptions/RTTI, Clang)" + benchmark_filter: + compiler: "clang++-10" + benchmark_generation_flags: [] + name: "fruit_executable_size_without_exceptions_and_rtti" + rows: + dimension: "additional_cmake_args" + pretty_printer: + fixed_map: + !!python/tuple ['-DCMAKE_CXX_FLAGS=-fno-exceptions -fno-rtti']: "(defaults)" + !!python/tuple ["-DBUILD_SHARED_LIBS=False", '-DCMAKE_CXX_FLAGS=-fno-exceptions -fno-rtti']: "statically linked" + !!python/tuple ["-DFRUIT_USES_BOOST=False", '-DCMAKE_CXX_FLAGS=-fno-exceptions -fno-rtti']: "without boost" + columns: *num_classes_column + results: + dimension: "num_bytes" + unit: "bytes" + + - name: "Fruit executable size (stripped, no exceptions/RTTI, GCC)" + benchmark_filter: + compiler: "g++-9" + benchmark_generation_flags: [] + name: "fruit_executable_size_without_exceptions_and_rtti" + rows: + dimension: "additional_cmake_args" + pretty_printer: + fixed_map: + !!python/tuple ['-DCMAKE_CXX_FLAGS=-fno-exceptions -fno-rtti']: "(defaults)" + !!python/tuple ["-DBUILD_SHARED_LIBS=False", '-DCMAKE_CXX_FLAGS=-fno-exceptions -fno-rtti']: "statically linked" + !!python/tuple ["-DFRUIT_USES_BOOST=False", '-DCMAKE_CXX_FLAGS=-fno-exceptions -fno-rtti']: "without boost" + columns: *num_classes_column results: dimension: "num_bytes" unit: "bytes" diff --git a/extras/dockerfiles/Dockerfile.ubuntu-20.04 b/extras/dockerfiles/Dockerfile.ubuntu-20.04 new file mode 100644 index 0000000..bf8d5af --- /dev/null +++ b/extras/dockerfiles/Dockerfile.ubuntu-20.04 @@ -0,0 +1,9 @@ +FROM ubuntu:20.04 +MAINTAINER Marco Poletti + +COPY ubuntu-20.04_custom.list /etc/apt/sources.list.d/ +COPY common_install.sh common_cleanup.sh ubuntu-20.04_install.sh / + +RUN bash -x /common_install.sh && \ + bash -x /ubuntu-20.04_install.sh && \ + bash -x /common_cleanup.sh diff --git a/extras/dockerfiles/rebuild_all.sh b/extras/dockerfiles/rebuild_all.sh index f84dbbd..a0c6760 100755 --- a/extras/dockerfiles/rebuild_all.sh +++ b/extras/dockerfiles/rebuild_all.sh @@ -7,7 +7,7 @@ docker run --rm --privileged multiarch/qemu-user-static:register --reset COMMANDS=() -for V in 16.04 18.04 19.04 16.04 19.10 +for V in 16.04 18.04 19.04 16.04 19.10 20.04 do C="docker build -t polettimarco/fruit-basesystem:ubuntu-$V -f Dockerfile.ubuntu-$V ." COMMANDS+=("$C || { echo; echo FAILED: '$C'; echo; exit 1; }") diff --git a/extras/dockerfiles/ubuntu-20.04_custom.list b/extras/dockerfiles/ubuntu-20.04_custom.list new file mode 100644 index 0000000..e69de29 diff --git a/extras/dockerfiles/ubuntu-20.04_install.sh b/extras/dockerfiles/ubuntu-20.04_install.sh new file mode 100644 index 0000000..b671533 --- /dev/null +++ b/extras/dockerfiles/ubuntu-20.04_install.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +set -e + +cat </etc/apt/sources.list.d/ubuntu-20.04_custom.list +# i386 not available +deb http://apt.llvm.org/focal/ llvm-toolchain-focal main +deb-src http://apt.llvm.org/focal/ llvm-toolchain-focal main +deb http://apt.llvm.org/focal/ llvm-toolchain-focal-9 main +deb-src http://apt.llvm.org/focal/ llvm-toolchain-focal-9 main +deb http://apt.llvm.org/focal/ llvm-toolchain-focal-10 main +deb-src http://apt.llvm.org/focal/ llvm-toolchain-focal-10 main +EOF + +apt-get update + +apt-get install -y --allow-unauthenticated --no-install-recommends \ + g++-7 \ + g++-8 \ + g++-9 \ + g++-10 \ + clang-6.0 \ + clang-7 \ + clang-8 \ + clang-9 \ + clang-10 \ + python \ + python3-sh \ + python3-typed-ast \ + clang-tidy \ + clang-format -- cgit v1.2.3 From efe2796ae5314e087add0a813c81001ccc04815c Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sat, 2 May 2020 13:05:27 -0700 Subject: Add GCC 10 to the CI test script. --- extras/scripts/postsubmit-helper.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/extras/scripts/postsubmit-helper.sh b/extras/scripts/postsubmit-helper.sh index 9b463bc..e32bec4 100755 --- a/extras/scripts/postsubmit-helper.sh +++ b/extras/scripts/postsubmit-helper.sh @@ -37,6 +37,11 @@ gcc-9) export CXX=g++-9 ;; +gcc-10) + export CC=gcc-10 + export CXX=g++-10 + ;; + clang-3.5) export CC=clang-3.5 export CXX=clang++-3.5 -- cgit v1.2.3 From a2a9ab1cd324b49b00570727e84c814afda621cf Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sat, 2 May 2020 13:08:40 -0700 Subject: Switch OS X CI tests with XCode 9.x back to 9.3 because the 9.4 image in Travis CI seems to have problems. --- .travis.yml | 4 ++-- extras/scripts/travis_yml_generator.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index e55e08f..58d7393 100644 --- a/.travis.yml +++ b/.travis.yml @@ -249,7 +249,7 @@ matrix: install: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; travis_wait extras/scripts/travis_ci_install_osx.sh os: osx - osx_image: xcode9.4 + osx_image: xcode9.3 script: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; extras/scripts/postsubmit.sh ReleasePlainNoClangTidy - compiler: clang @@ -257,7 +257,7 @@ matrix: install: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; travis_wait extras/scripts/travis_ci_install_osx.sh os: osx - osx_image: xcode9.4 + osx_image: xcode9.3 script: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; extras/scripts/postsubmit.sh DebugAsanUbsanNoClangTidy - compiler: clang diff --git a/extras/scripts/travis_yml_generator.py b/extras/scripts/travis_yml_generator.py index 8a67784..05a68af 100755 --- a/extras/scripts/travis_yml_generator.py +++ b/extras/scripts/travis_yml_generator.py @@ -191,7 +191,7 @@ add_osx_tests(compiler='clang-8.0', xcode_version='11.4', stl='libc++', smoke_te # Disabled due to https://bugs.llvm.org/show_bug.cgi?id=41625. use_precompiled_headers_in_tests=False) -add_osx_tests(compiler='clang-default', xcode_version='9.4', stl='libc++', clang_tidy=False) +add_osx_tests(compiler='clang-default', xcode_version='9.3', stl='libc++', clang_tidy=False) add_osx_tests(compiler='clang-default', xcode_version='11.4', stl='libc++', clang_tidy=False, smoke_tests=['DebugPlain']) # ** Disabled combinations ** -- cgit v1.2.3 From bbd21e29e153d61a4a4eef9ba318a0e77b6ebd52 Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sat, 2 May 2020 13:12:37 -0700 Subject: Switch stdc++ Clang CI tests to use Clang 10 instead of 9, to see if it works. Also re-enable asan/ubsan in gcc CI tests to see if they work now. --- .travis.yml | 26 ++++++++++++++++---------- extras/scripts/travis_yml_generator.py | 12 +++--------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/.travis.yml b/.travis.yml index 58d7393..5f216d8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -55,11 +55,17 @@ matrix: script: export OS=linux; export COMPILER='gcc-7'; export UBUNTU='20.04'; extras/scripts/postsubmit.sh ReleasePlain - compiler: gcc - env: COMPILER=gcc-7 UBUNTU=20.04 TEST=DebugPlain + env: COMPILER=gcc-7 UBUNTU=20.04 TEST=DebugAsanUbsan install: export OS=linux; export COMPILER='gcc-7'; export UBUNTU='20.04'; extras/scripts/travis_ci_install_linux.sh os: linux script: export OS=linux; export COMPILER='gcc-7'; export UBUNTU='20.04'; extras/scripts/postsubmit.sh - DebugPlain + DebugAsanUbsan + - compiler: gcc + env: COMPILER=gcc-10 UBUNTU=20.04 TEST=DebugAsanUbsan + install: export OS=linux; export COMPILER='gcc-10'; export UBUNTU='20.04'; extras/scripts/travis_ci_install_linux.sh + os: linux + script: export OS=linux; export COMPILER='gcc-10'; export UBUNTU='20.04'; extras/scripts/postsubmit.sh + DebugAsanUbsan - compiler: clang env: COMPILER=clang-10.0 STL=libstdc++ UBUNTU=20.04 TEST=ReleasePlain install: export OS=linux; export COMPILER='clang-10.0'; export STL='libstdc++'; @@ -75,19 +81,19 @@ matrix: script: export OS=linux; export COMPILER='clang-10.0'; export STL='libstdc++'; export UBUNTU='20.04'; extras/scripts/postsubmit.sh DebugAsanUbsan - compiler: clang - env: COMPILER=clang-9.0 STL=libc++ UBUNTU=20.04 TEST=ReleasePlainNoPchNoClangTidy - install: export OS=linux; export COMPILER='clang-9.0'; export STL='libc++'; export + env: COMPILER=clang-10.0 STL=libc++ UBUNTU=20.04 TEST=ReleasePlain + install: export OS=linux; export COMPILER='clang-10.0'; export STL='libc++'; export UBUNTU='20.04'; extras/scripts/travis_ci_install_linux.sh os: linux - script: export OS=linux; export COMPILER='clang-9.0'; export STL='libc++'; export - UBUNTU='20.04'; extras/scripts/postsubmit.sh ReleasePlainNoPchNoClangTidy + script: export OS=linux; export COMPILER='clang-10.0'; export STL='libc++'; export + UBUNTU='20.04'; extras/scripts/postsubmit.sh ReleasePlain - compiler: clang - env: COMPILER=clang-9.0 STL=libc++ UBUNTU=20.04 TEST=DebugAsanUbsanNoPchNoClangTidy - install: export OS=linux; export COMPILER='clang-9.0'; export STL='libc++'; export + env: COMPILER=clang-10.0 STL=libc++ UBUNTU=20.04 TEST=DebugAsanUbsan + install: export OS=linux; export COMPILER='clang-10.0'; export STL='libc++'; export UBUNTU='20.04'; extras/scripts/travis_ci_install_linux.sh os: linux - script: export OS=linux; export COMPILER='clang-9.0'; export STL='libc++'; export - UBUNTU='20.04'; extras/scripts/postsubmit.sh DebugAsanUbsanNoPchNoClangTidy + script: export OS=linux; export COMPILER='clang-10.0'; export STL='libc++'; export + UBUNTU='20.04'; extras/scripts/postsubmit.sh DebugAsanUbsan - compiler: gcc env: COMPILER=gcc-5 UBUNTU=18.04 TEST=ReleasePlain install: export OS=linux; export COMPILER='gcc-5'; export UBUNTU='18.04'; extras/scripts/travis_ci_install_linux.sh diff --git a/extras/scripts/travis_yml_generator.py b/extras/scripts/travis_yml_generator.py index 05a68af..488f770 100755 --- a/extras/scripts/travis_yml_generator.py +++ b/extras/scripts/travis_yml_generator.py @@ -145,19 +145,13 @@ def add_bazel_tests(ubuntu_version, smoke_tests=[]): build_matrix_rows.append(test_environment) -# TODO: re-enable ASan/UBSan once they work in Travis CI. ATM (as of 18 November 2017) they fail due to https://github.com/google/sanitizers/issues/837 -add_ubuntu_tests(ubuntu_version='20.04', compiler='gcc-7', asan=False, ubsan=False) -add_ubuntu_tests(ubuntu_version='20.04', compiler='gcc-10', asan=False, ubsan=False, +add_ubuntu_tests(ubuntu_version='20.04', compiler='gcc-7') +add_ubuntu_tests(ubuntu_version='20.04', compiler='gcc-10', smoke_tests=['DebugPlain', 'ReleasePlain']) add_ubuntu_tests(ubuntu_version='20.04', compiler='clang-6.0', stl='libstdc++', smoke_tests=['DebugPlain', 'DebugAsanUbsan', 'ReleasePlain']) add_ubuntu_tests(ubuntu_version='20.04', compiler='clang-10.0', stl='libstdc++') -# Using Clang 10 + libc++ doesn't work as of March 2020, it can't find STL headers. -add_ubuntu_tests(ubuntu_version='20.04', compiler='clang-9.0', stl='libc++', - # Disabled due to https://bugs.llvm.org/show_bug.cgi?id=41625. - use_precompiled_headers_in_tests=False, - # As of March 2020, Clang tidy segfaults and can't find STL headers (not sure if these issues are related or independent). - clang_tidy=False) +add_ubuntu_tests(ubuntu_version='20.04', compiler='clang-10.0', stl='libc++') add_ubuntu_tests(ubuntu_version='18.04', compiler='gcc-5', asan=False, ubsan=False) add_ubuntu_tests(ubuntu_version='18.04', compiler='gcc-8', asan=False, ubsan=False) -- cgit v1.2.3 From abcd4898d92ea4fa90042398c9029a1cf4098e69 Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sat, 2 May 2020 13:49:35 -0700 Subject: Fix dockerfiles for CI builds so that they only install stable LLVM packages. Before they were installing an unstable clang-tidy binary that reports many spurious warnings. --- extras/dockerfiles/ubuntu-20.04_install.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/extras/dockerfiles/ubuntu-20.04_install.sh b/extras/dockerfiles/ubuntu-20.04_install.sh index b671533..6b883bf 100644 --- a/extras/dockerfiles/ubuntu-20.04_install.sh +++ b/extras/dockerfiles/ubuntu-20.04_install.sh @@ -3,9 +3,6 @@ set -e cat </etc/apt/sources.list.d/ubuntu-20.04_custom.list -# i386 not available -deb http://apt.llvm.org/focal/ llvm-toolchain-focal main -deb-src http://apt.llvm.org/focal/ llvm-toolchain-focal main deb http://apt.llvm.org/focal/ llvm-toolchain-focal-9 main deb-src http://apt.llvm.org/focal/ llvm-toolchain-focal-9 main deb http://apt.llvm.org/focal/ llvm-toolchain-focal-10 main -- cgit v1.2.3 From 1ea5c6b71aaac47e10d193ae6b2002173e4b1d73 Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sat, 2 May 2020 13:51:44 -0700 Subject: Run OS X CI tests with XCode 9.4 and 11.3 instead of 9.3 and 11.4. A previous commit downgraded the wrong one to fix CI tests, and now both are broken. --- .travis.yml | 10 +++++----- extras/scripts/travis_yml_generator.py | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5f216d8..01bccd6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -255,7 +255,7 @@ matrix: install: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; travis_wait extras/scripts/travis_ci_install_osx.sh os: osx - osx_image: xcode9.3 + osx_image: xcode9.4 script: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; extras/scripts/postsubmit.sh ReleasePlainNoClangTidy - compiler: clang @@ -263,7 +263,7 @@ matrix: install: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; travis_wait extras/scripts/travis_ci_install_osx.sh os: osx - osx_image: xcode9.3 + osx_image: xcode9.4 script: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; extras/scripts/postsubmit.sh DebugAsanUbsanNoClangTidy - compiler: clang @@ -271,7 +271,7 @@ matrix: install: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; travis_wait extras/scripts/travis_ci_install_osx.sh os: osx - osx_image: xcode11.4 + osx_image: xcode11.3 script: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; extras/scripts/postsubmit.sh ReleasePlainNoClangTidy - compiler: clang @@ -279,7 +279,7 @@ matrix: install: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; travis_wait extras/scripts/travis_ci_install_osx.sh os: osx - osx_image: xcode11.4 + osx_image: xcode11.3 script: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; extras/scripts/postsubmit.sh DebugAsanUbsanNoClangTidy - compiler: clang @@ -287,7 +287,7 @@ matrix: install: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; travis_wait extras/scripts/travis_ci_install_osx.sh os: osx - osx_image: xcode11.4 + osx_image: xcode11.3 script: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; extras/scripts/postsubmit.sh DebugPlainNoClangTidy services: diff --git a/extras/scripts/travis_yml_generator.py b/extras/scripts/travis_yml_generator.py index 488f770..30147b3 100755 --- a/extras/scripts/travis_yml_generator.py +++ b/extras/scripts/travis_yml_generator.py @@ -185,8 +185,8 @@ add_osx_tests(compiler='clang-8.0', xcode_version='11.4', stl='libc++', smoke_te # Disabled due to https://bugs.llvm.org/show_bug.cgi?id=41625. use_precompiled_headers_in_tests=False) -add_osx_tests(compiler='clang-default', xcode_version='9.3', stl='libc++', clang_tidy=False) -add_osx_tests(compiler='clang-default', xcode_version='11.4', stl='libc++', clang_tidy=False, smoke_tests=['DebugPlain']) +add_osx_tests(compiler='clang-default', xcode_version='9.4', stl='libc++', clang_tidy=False) +add_osx_tests(compiler='clang-default', xcode_version='11.3', stl='libc++', clang_tidy=False, smoke_tests=['DebugPlain']) # ** Disabled combinations ** # -- cgit v1.2.3 From e1afb1bb9b2e8c548b36e9bdd434a2e5d52663ce Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sat, 2 May 2020 14:16:10 -0700 Subject: Update expected error regexes in tests to allow error messages from latest MSVC 2019. --- tests/test_component_functions.py | 3 ++- tests/test_normalized_component.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/test_component_functions.py b/tests/test_component_functions.py index ec70bfc..8dc6a76 100755 --- a/tests/test_component_functions.py +++ b/tests/test_component_functions.py @@ -187,7 +187,8 @@ class TestComponentFunctions(parameterized.TestCase): r'error: use of deleted function .Arg::Arg\(Arg&&\).' r'|error: call to deleted constructor of .Arg.' r'|.Arg::Arg\(Arg &&\).: cannot convert argument 1 from .std::_Tuple_val. to .int.' - r'|error: copying parameter of type .Arg. invokes deleted constructor', + r'|error: copying parameter of type .Arg. invokes deleted constructor' + r'|error C2280: .Arg::Arg\(Arg &&\).: attempting to reference a deleted function', COMMON_DEFINITIONS, source) diff --git a/tests/test_normalized_component.py b/tests/test_normalized_component.py index ba21242..8888019 100755 --- a/tests/test_normalized_component.py +++ b/tests/test_normalized_component.py @@ -175,7 +175,7 @@ class TestNormalizedComponent(parameterized.TestCase): expect_generic_compile_error( r'no matching function for call to .fruit::NormalizedComponent::NormalizedComponent\(fruit::Component \(&\)\(\)\).' r'|no matching constructor for initialization of .fruit::NormalizedComponent.' - r'|.fruit::NormalizedComponent::NormalizedComponent.: none of the 2 overloads could convert all the argument types', + r'|.fruit::NormalizedComponent::NormalizedComponent.: none of the .* overloads could convert all the argument types', COMMON_DEFINITIONS, source, locals()) -- cgit v1.2.3 From cd154e310d2032e83e5a2ad6472a32cce9ca31e9 Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sat, 2 May 2020 15:01:01 -0700 Subject: Disable PCH generation for XCode 11.x CI tests, it's also affected by https://bugs.llvm.org/show_bug.cgi?id=41625. --- .travis.yml | 12 ++++++------ extras/scripts/travis_yml_generator.py | 5 ++++- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 01bccd6..2b7f4b8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -267,29 +267,29 @@ matrix: script: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; extras/scripts/postsubmit.sh DebugAsanUbsanNoClangTidy - compiler: clang - env: COMPILER=clang-default STL=libc++ TEST=ReleasePlainNoClangTidy + env: COMPILER=clang-default STL=libc++ TEST=ReleasePlainNoPchNoClangTidy install: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; travis_wait extras/scripts/travis_ci_install_osx.sh os: osx osx_image: xcode11.3 script: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; extras/scripts/postsubmit.sh - ReleasePlainNoClangTidy + ReleasePlainNoPchNoClangTidy - compiler: clang - env: COMPILER=clang-default STL=libc++ TEST=DebugAsanUbsanNoClangTidy + env: COMPILER=clang-default STL=libc++ TEST=DebugAsanUbsanNoPchNoClangTidy install: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; travis_wait extras/scripts/travis_ci_install_osx.sh os: osx osx_image: xcode11.3 script: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; extras/scripts/postsubmit.sh - DebugAsanUbsanNoClangTidy + DebugAsanUbsanNoPchNoClangTidy - compiler: clang - env: COMPILER=clang-default STL=libc++ TEST=DebugPlainNoClangTidy + env: COMPILER=clang-default STL=libc++ TEST=DebugPlainNoPchNoClangTidy install: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; travis_wait extras/scripts/travis_ci_install_osx.sh os: osx osx_image: xcode11.3 script: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; extras/scripts/postsubmit.sh - DebugPlainNoClangTidy + DebugPlainNoPchNoClangTidy services: - docker sudo: required diff --git a/extras/scripts/travis_yml_generator.py b/extras/scripts/travis_yml_generator.py index 30147b3..93a5a1b 100755 --- a/extras/scripts/travis_yml_generator.py +++ b/extras/scripts/travis_yml_generator.py @@ -186,7 +186,10 @@ add_osx_tests(compiler='clang-8.0', xcode_version='11.4', stl='libc++', smoke_te use_precompiled_headers_in_tests=False) add_osx_tests(compiler='clang-default', xcode_version='9.4', stl='libc++', clang_tidy=False) -add_osx_tests(compiler='clang-default', xcode_version='11.3', stl='libc++', clang_tidy=False, smoke_tests=['DebugPlain']) +add_osx_tests(compiler='clang-default', xcode_version='11.3', stl='libc++', clang_tidy=False, + # Disabled due to https://bugs.llvm.org/show_bug.cgi?id=41625. + use_precompiled_headers_in_tests=False, + smoke_tests=['DebugPlain']) # ** Disabled combinations ** # -- cgit v1.2.3 From 2358d8128ab240ab139c96f316dfd0ff6ca44b7c Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sat, 2 May 2020 15:02:00 -0700 Subject: Setting the compiler via the CC/CXX env vars doesn't work with recent versions of XCode, set it as cmake params too. --- extras/scripts/postsubmit-helper.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/extras/scripts/postsubmit-helper.sh b/extras/scripts/postsubmit-helper.sh index e32bec4..550c0b0 100755 --- a/extras/scripts/postsubmit-helper.sh +++ b/extras/scripts/postsubmit-helper.sh @@ -156,6 +156,8 @@ then ReleaseValgrindNoPchNoClangTidy) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Release -DFRUIT_ENABLE_CLANG_TIDY=FALSE -DCMAKE_CXX_FLAGS="$COMMON_CXX_FLAGS" -DRUN_TESTS_UNDER_VALGRIND=TRUE -DFRUIT_TESTS_USE_PRECOMPILED_HEADERS=OFF) ;; *) echo "Error: you need to specify one of the supported postsubmit modes (see postsubmit.sh)."; exit 1 ;; esac + # Setting compilers only via env vars doesn't work when using recent versions of XCode. + CMAKE_ARGS+=(-DCMAKE_C_COMPILER=$CC -DCMAKE_CXX_COMPILER=$CXX) SOURCES_PATH="$PWD" -- cgit v1.2.3 From 0e6445db21645f8978143f43e73dc1d64bd70951 Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sat, 2 May 2020 22:00:11 -0700 Subject: Stop CI testing with MSVC 2015, it's failing and it's not clear why (the same thing works in 2017 and 2019). MSVC 2017 should be old enough that most people have upgraded at this point. --- appveyor.yml | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index eceb425..2406142 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -13,11 +13,6 @@ environment: VCVARSALL_DIR: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build' ADDITIONAL_CMAKE_ARGS: '-DFRUIT_USES_BOOST=False -DCMAKE_CXX_FLAGS="/WX /DFRUIT_DEBUG /DFRUIT_EXTRA_DEBUG /D_ITERATOR_DEBUG_LEVEL=2" -T host=x64 -A x64' CONFIGURATION: Debug - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - CMAKE_GENERATOR: 'Visual Studio 14 2015 Win64' - VCVARSALL_DIR: 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC' - ADDITIONAL_CMAKE_ARGS: '-DFRUIT_USES_BOOST=False -DCMAKE_CXX_FLAGS="/WX /DFRUIT_DEBUG /DFRUIT_EXTRA_DEBUG /D_ITERATOR_DEBUG_LEVEL=2" -T host=x64' - CONFIGURATION: Debug - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 CMAKE_GENERATOR: 'Visual Studio 15 2017 Win64' VCVARSALL_DIR: 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build' @@ -33,11 +28,6 @@ environment: VCVARSALL_DIR: 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build' ADDITIONAL_CMAKE_ARGS: '-DFRUIT_USES_BOOST=False -DCMAKE_CXX_FLAGS="/WX" -T host=x64' CONFIGURATION: Release - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - CMAKE_GENERATOR: 'Visual Studio 14 2015 Win64' - VCVARSALL_DIR: 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC' - ADDITIONAL_CMAKE_ARGS: '-DFRUIT_USES_BOOST=False -DCMAKE_CXX_FLAGS="/WX" -T host=x64' - CONFIGURATION: Release - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 CMAKE_GENERATOR: 'Visual Studio 16 2019' VCVARSALL_DIR: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build' @@ -48,11 +38,6 @@ environment: VCVARSALL_DIR: 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build' ADDITIONAL_CMAKE_ARGS: '-DFRUIT_USES_BOOST=False -DBUILD_SHARED_LIBS=False -DCMAKE_CXX_FLAGS="/WX" -T host=x64' CONFIGURATION: Release - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - CMAKE_GENERATOR: 'Visual Studio 14 2015 Win64' - VCVARSALL_DIR: 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC' - ADDITIONAL_CMAKE_ARGS: '-DFRUIT_USES_BOOST=False -DBUILD_SHARED_LIBS=False -DCMAKE_CXX_FLAGS="/WX" -T host=x64' - CONFIGURATION: Release - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 MINGW_PATH: 'C:\mingw-w64\x86_64-7.2.0-posix-seh-rt_v5-rev1\mingw64\bin' -- cgit v1.2.3 From 259901542351574918de762080bfe1759e463a0e Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sun, 3 May 2020 14:02:53 -0700 Subject: Lots of changes to dockerfiles used for CI testing of Fruit and TMPPy: merge the *install.sh scripts back into the dockerfiles, use squash in rebuild_all, retire Ubuntu 16.04, add Ubuntu 20.04 for ARM too, install a backported python 3.8 in old versions of Ubuntu too (needed for TMPPy). --- extras/dockerfiles/.dockerignore | 2 + extras/dockerfiles/Dockerfile.ubuntu-16.04 | 9 ----- extras/dockerfiles/Dockerfile.ubuntu-18.04 | 52 +++++++++++++++++++++++-- extras/dockerfiles/Dockerfile.ubuntu-19.04 | 9 ----- extras/dockerfiles/Dockerfile.ubuntu-19.10 | 39 +++++++++++++++++-- extras/dockerfiles/Dockerfile.ubuntu-20.04 | 40 +++++++++++++++++-- extras/dockerfiles/Dockerfile.ubuntu_arm-16.04 | 9 ----- extras/dockerfiles/Dockerfile.ubuntu_arm-18.04 | 21 +++++++--- extras/dockerfiles/Dockerfile.ubuntu_arm-20.04 | 22 +++++++++++ extras/dockerfiles/common_install.sh | 16 ++------ extras/dockerfiles/rebuild_all.sh | 13 +++---- extras/dockerfiles/ubuntu-16.04_custom.list | 0 extras/dockerfiles/ubuntu-16.04_install.sh | 51 ------------------------ extras/dockerfiles/ubuntu-18.04_custom.list | 17 ++++++++ extras/dockerfiles/ubuntu-18.04_install.sh | 51 ------------------------ extras/dockerfiles/ubuntu-19.04_custom.list | 0 extras/dockerfiles/ubuntu-19.04_install.sh | 29 -------------- extras/dockerfiles/ubuntu-19.10_custom.list | 6 +++ extras/dockerfiles/ubuntu-19.10_install.sh | 29 -------------- extras/dockerfiles/ubuntu-20.04_custom.list | 4 ++ extras/dockerfiles/ubuntu-20.04_install.sh | 28 ------------- extras/dockerfiles/ubuntu_arm-16.04_install.sh | 16 -------- extras/dockerfiles/ubuntu_arm-18.04_custom.list | 0 extras/dockerfiles/ubuntu_arm-18.04_install.sh | 17 -------- 24 files changed, 195 insertions(+), 285 deletions(-) create mode 100644 extras/dockerfiles/.dockerignore delete mode 100644 extras/dockerfiles/Dockerfile.ubuntu-16.04 delete mode 100644 extras/dockerfiles/Dockerfile.ubuntu-19.04 delete mode 100644 extras/dockerfiles/Dockerfile.ubuntu_arm-16.04 create mode 100644 extras/dockerfiles/Dockerfile.ubuntu_arm-20.04 delete mode 100644 extras/dockerfiles/ubuntu-16.04_custom.list delete mode 100644 extras/dockerfiles/ubuntu-16.04_install.sh delete mode 100644 extras/dockerfiles/ubuntu-18.04_install.sh delete mode 100644 extras/dockerfiles/ubuntu-19.04_custom.list delete mode 100644 extras/dockerfiles/ubuntu-19.04_install.sh delete mode 100644 extras/dockerfiles/ubuntu-19.10_install.sh delete mode 100644 extras/dockerfiles/ubuntu-20.04_install.sh delete mode 100644 extras/dockerfiles/ubuntu_arm-16.04_install.sh delete mode 100644 extras/dockerfiles/ubuntu_arm-18.04_custom.list delete mode 100644 extras/dockerfiles/ubuntu_arm-18.04_install.sh diff --git a/extras/dockerfiles/.dockerignore b/extras/dockerfiles/.dockerignore new file mode 100644 index 0000000..4e1954c --- /dev/null +++ b/extras/dockerfiles/.dockerignore @@ -0,0 +1,2 @@ +Dockerfile.* +rebuild_all.sh diff --git a/extras/dockerfiles/Dockerfile.ubuntu-16.04 b/extras/dockerfiles/Dockerfile.ubuntu-16.04 deleted file mode 100644 index b53b883..0000000 --- a/extras/dockerfiles/Dockerfile.ubuntu-16.04 +++ /dev/null @@ -1,9 +0,0 @@ -FROM ubuntu:16.04 -MAINTAINER Marco Poletti - -COPY ubuntu-16.04_custom.list /etc/apt/sources.list.d/ -COPY common_install.sh common_cleanup.sh ubuntu-16.04_install.sh / - -RUN bash -x /common_install.sh && \ - bash -x /ubuntu-16.04_install.sh && \ - bash -x /common_cleanup.sh diff --git a/extras/dockerfiles/Dockerfile.ubuntu-18.04 b/extras/dockerfiles/Dockerfile.ubuntu-18.04 index ec5d5cb..d458bb4 100644 --- a/extras/dockerfiles/Dockerfile.ubuntu-18.04 +++ b/extras/dockerfiles/Dockerfile.ubuntu-18.04 @@ -1,9 +1,53 @@ FROM ubuntu:18.04 MAINTAINER Marco Poletti +COPY common_install.sh common_cleanup.sh / + +RUN bash -x /common_install.sh +RUN apt-get install -y --no-install-recommends curl + +# For the Bazel repository +RUN curl https://bazel.build/bazel-release.pub.gpg | apt-key add - + +RUN echo 'deb [arch=amd64] http://storage.googleapis.com/bazel-apt stable jdk1.8' >> /etc/apt/sources.list.d/bazel.list + COPY ubuntu-18.04_custom.list /etc/apt/sources.list.d/ -COPY common_install.sh common_cleanup.sh ubuntu-18.04_install.sh / -RUN bash -x /common_install.sh && \ - bash -x /ubuntu-18.04_install.sh && \ - bash -x /common_cleanup.sh +RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys F23C5A6CF475977595C89F51BA6932366A755776 + +RUN apt-get update -qq + +RUN apt-get remove -y python3-pip +RUN python3 -m easy_install pip + +RUN apt-get install -y --allow-unauthenticated --no-install-recommends \ + g++-8 \ + g++-7 \ + g++-6 \ + g++-5 \ + clang-3.9 \ + clang-4.0 \ + clang-5.0 \ + clang-6.0 \ + clang-7 \ + clang-8 \ + clang-9 \ + clang-10 \ + bazel \ + git \ + python3.8 \ + clang-tidy \ + clang-format + +RUN python3.8 -m easy_install pip + +RUN pip3 install absl-py +RUN pip3 install bidict +RUN pip3 install pytest +RUN pip3 install pytest-xdist +RUN pip3 install sh +RUN pip3 install setuptools +RUN pip3 install networkx +RUN pip3 install wheel + +RUN bash -x /common_cleanup.sh diff --git a/extras/dockerfiles/Dockerfile.ubuntu-19.04 b/extras/dockerfiles/Dockerfile.ubuntu-19.04 deleted file mode 100644 index 7939990..0000000 --- a/extras/dockerfiles/Dockerfile.ubuntu-19.04 +++ /dev/null @@ -1,9 +0,0 @@ -FROM ubuntu:19.04 -MAINTAINER Marco Poletti - -COPY ubuntu-19.04_custom.list /etc/apt/sources.list.d/ -COPY common_install.sh common_cleanup.sh ubuntu-19.04_install.sh / - -RUN bash -x /common_install.sh && \ - bash -x /ubuntu-19.04_install.sh && \ - bash -x /common_cleanup.sh diff --git a/extras/dockerfiles/Dockerfile.ubuntu-19.10 b/extras/dockerfiles/Dockerfile.ubuntu-19.10 index 5ee6178..ca6be96 100644 --- a/extras/dockerfiles/Dockerfile.ubuntu-19.10 +++ b/extras/dockerfiles/Dockerfile.ubuntu-19.10 @@ -1,9 +1,40 @@ FROM ubuntu:19.10 MAINTAINER Marco Poletti +COPY common_install.sh common_cleanup.sh / + +RUN bash -x /common_install.sh + COPY ubuntu-19.10_custom.list /etc/apt/sources.list.d/ -COPY common_install.sh common_cleanup.sh ubuntu-19.10_install.sh / -RUN bash -x /common_install.sh && \ - bash -x /ubuntu-19.10_install.sh && \ - bash -x /common_cleanup.sh +RUN apt-get update + +RUN apt-get install -y --allow-unauthenticated --no-install-recommends \ + g++-7 \ + g++-8 \ + g++-9 \ + clang-6.0 \ + clang-7 \ + clang-8 \ + clang-9 \ + clang-10 \ + python3-sh \ + python3-typed-ast \ + python3-pip \ + python3-setuptools \ + python3-networkx \ + clang-tidy \ + clang-format + +RUN pip3 install --upgrade pip + +RUN pip3 install absl-py +RUN pip3 install bidict +RUN pip3 install pytest +RUN pip3 install pytest-xdist +RUN pip3 install sh +RUN pip3 install setuptools +RUN pip3 install networkx +RUN pip3 install wheel + +RUN bash -x /common_cleanup.sh diff --git a/extras/dockerfiles/Dockerfile.ubuntu-20.04 b/extras/dockerfiles/Dockerfile.ubuntu-20.04 index bf8d5af..3ce7d9c 100644 --- a/extras/dockerfiles/Dockerfile.ubuntu-20.04 +++ b/extras/dockerfiles/Dockerfile.ubuntu-20.04 @@ -1,9 +1,41 @@ FROM ubuntu:20.04 MAINTAINER Marco Poletti +COPY common_install.sh common_cleanup.sh / + +RUN bash -x /common_install.sh + COPY ubuntu-20.04_custom.list /etc/apt/sources.list.d/ -COPY common_install.sh common_cleanup.sh ubuntu-20.04_install.sh / -RUN bash -x /common_install.sh && \ - bash -x /ubuntu-20.04_install.sh && \ - bash -x /common_cleanup.sh +RUN apt-get update + +RUN apt-get remove -y python3-pip +RUN python3 -m easy_install pip + +RUN apt-get install -y --allow-unauthenticated --no-install-recommends \ + g++-7 \ + g++-8 \ + g++-9 \ + g++-10 \ + clang-6.0 \ + clang-7 \ + clang-8 \ + clang-9 \ + clang-10 \ + python3.8 \ + python3.8-distutils \ + clang-tidy \ + clang-format + +RUN python3.8 -m easy_install pip + +RUN pip3 install absl-py +RUN pip3 install bidict +RUN pip3 install pytest +RUN pip3 install pytest-xdist +RUN pip3 install sh +RUN pip3 install setuptools +RUN pip3 install networkx +RUN pip3 install wheel + +RUN bash -x /common_cleanup.sh diff --git a/extras/dockerfiles/Dockerfile.ubuntu_arm-16.04 b/extras/dockerfiles/Dockerfile.ubuntu_arm-16.04 deleted file mode 100644 index 35342b9..0000000 --- a/extras/dockerfiles/Dockerfile.ubuntu_arm-16.04 +++ /dev/null @@ -1,9 +0,0 @@ -FROM multiarch/ubuntu-core:arm64-xenial -MAINTAINER Marco Poletti - -COPY ubuntu_arm-16.04_custom.list /etc/apt/sources.list.d/ -COPY common_install.sh common_cleanup.sh ubuntu_arm-16.04_install.sh / - -RUN bash -x /common_install.sh && \ - bash -x /ubuntu_arm-16.04_install.sh && \ - bash -x /common_cleanup.sh diff --git a/extras/dockerfiles/Dockerfile.ubuntu_arm-18.04 b/extras/dockerfiles/Dockerfile.ubuntu_arm-18.04 index 852abb5..8ecab4d 100644 --- a/extras/dockerfiles/Dockerfile.ubuntu_arm-18.04 +++ b/extras/dockerfiles/Dockerfile.ubuntu_arm-18.04 @@ -1,9 +1,20 @@ FROM multiarch/ubuntu-core:arm64-bionic MAINTAINER Marco Poletti -COPY ubuntu_arm-18.04_custom.list /etc/apt/sources.list.d/ -COPY common_install.sh common_cleanup.sh ubuntu_arm-18.04_install.sh / +COPY common_install.sh common_cleanup.sh / -RUN bash -x /common_install.sh && \ - bash -x /ubuntu_arm-18.04_install.sh && \ - bash -x /common_cleanup.sh +RUN bash -x /common_install.sh +RUN apt-get install -y --allow-unauthenticated --no-install-recommends \ + g++-8 \ + g++-7 \ + g++-5 \ + clang-3.9 \ + clang-4.0 \ + clang-5.0 \ + clang-6.0 \ + python \ + python3-sh \ + python3-typed-ast \ + clang-tidy \ + clang-format +RUN bash -x /common_cleanup.sh diff --git a/extras/dockerfiles/Dockerfile.ubuntu_arm-20.04 b/extras/dockerfiles/Dockerfile.ubuntu_arm-20.04 new file mode 100644 index 0000000..6d84554 --- /dev/null +++ b/extras/dockerfiles/Dockerfile.ubuntu_arm-20.04 @@ -0,0 +1,22 @@ +FROM multiarch/ubuntu-core:arm64-focal +MAINTAINER Marco Poletti + +COPY common_install.sh common_cleanup.sh / + +RUN bash -x /common_install.sh +RUN apt-get install -y --allow-unauthenticated --no-install-recommends \ + g++-7 \ + g++-8 \ + g++-9 \ + g++-10 \ + clang-6.0 \ + clang-7 \ + clang-8 \ + clang-9 \ + clang-10 \ + python \ + python3-sh \ + python3-typed-ast \ + clang-tidy \ + clang-format +RUN bash -x /common_cleanup.sh diff --git a/extras/dockerfiles/common_install.sh b/extras/dockerfiles/common_install.sh index 1e0b58b..7eff017 100644 --- a/extras/dockerfiles/common_install.sh +++ b/extras/dockerfiles/common_install.sh @@ -24,15 +24,7 @@ apt-get install -y --allow-unauthenticated --no-install-recommends \ libc++-dev \ libc++abi1 \ libc++abi-dev \ - python3-pip \ - python3-setuptools \ - python3-networkx \ - dirmngr - -pip3 install --upgrade pip -python3 -m pip install absl-py -python3 -m pip install bidict -python3 -m pip install pytest -python3 -m pip install pytest-xdist -python3 -m pip install sh -python3 -m pip install wheel + dirmngr \ + python \ + python3 \ + python3-setuptools diff --git a/extras/dockerfiles/rebuild_all.sh b/extras/dockerfiles/rebuild_all.sh index a0c6760..77153aa 100755 --- a/extras/dockerfiles/rebuild_all.sh +++ b/extras/dockerfiles/rebuild_all.sh @@ -7,15 +7,15 @@ docker run --rm --privileged multiarch/qemu-user-static:register --reset COMMANDS=() -for V in 16.04 18.04 19.04 16.04 19.10 20.04 +for V in 18.04 19.10 20.04 do - C="docker build -t polettimarco/fruit-basesystem:ubuntu-$V -f Dockerfile.ubuntu-$V ." + C="docker build --squash -t polettimarco/fruit-basesystem:ubuntu-$V -f Dockerfile.ubuntu-$V ." COMMANDS+=("$C || { echo; echo FAILED: '$C'; echo; exit 1; }") done -for V in 16.04 18.04 +for V in 18.04 20.04 do - C="docker build -t polettimarco/fruit-basesystem:ubuntu_arm-$V -f Dockerfile.ubuntu_arm-$V ." + C="docker build --squash -t polettimarco/fruit-basesystem:ubuntu_arm-$V -f Dockerfile.ubuntu_arm-$V ." COMMANDS+=("$C || { echo; echo FAILED: '$C'; echo; exit 1; }") done @@ -28,10 +28,7 @@ done | xargs -P 0 -L 1 -d '\n' bash -c || { # This way we get better diagnostics. for C in "${COMMANDS[@]}" do - $C || { - echo "Failed: $C" - exit 1 - } + bash -c "$C" || exit 1 done } diff --git a/extras/dockerfiles/ubuntu-16.04_custom.list b/extras/dockerfiles/ubuntu-16.04_custom.list deleted file mode 100644 index e69de29..0000000 diff --git a/extras/dockerfiles/ubuntu-16.04_install.sh b/extras/dockerfiles/ubuntu-16.04_install.sh deleted file mode 100644 index 071fda1..0000000 --- a/extras/dockerfiles/ubuntu-16.04_install.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash - -set -e - -cat </etc/apt/sources.list.d/custom.list -deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial main -deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial main -deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-3.8 main -deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial-3.8 main -deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-3.9 main -deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial-3.9 main -deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-4.0 main -deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial-4.0 main -deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-5.0 main -deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial-5.0 main -deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-6.0 main -deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial-6.0 main -deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-7 main -deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial-7 main -deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-8 main -deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial-8 main -deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-9 main -deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial-9 main -deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-10 main -deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial-10 main -EOF - -apt-get update -qq - -apt-get install -y --allow-unauthenticated --no-install-recommends \ - clang-3.5 \ - clang-3.6 \ - clang-3.7 \ - clang-3.8 \ - clang-3.9 \ - clang-4.0 \ - clang-5.0 \ - clang-6.0 \ - clang-7 \ - clang-8 \ - clang-9 \ - clang-10 \ - g++-5 \ - g++-4.9 \ - g++-6 \ - python \ - git \ - clang-tidy \ - clang-format - -pip3 install typed_ast diff --git a/extras/dockerfiles/ubuntu-18.04_custom.list b/extras/dockerfiles/ubuntu-18.04_custom.list index e69de29..171b878 100644 --- a/extras/dockerfiles/ubuntu-18.04_custom.list +++ b/extras/dockerfiles/ubuntu-18.04_custom.list @@ -0,0 +1,17 @@ +deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic main +deb-src http://apt.llvm.org/bionic/ llvm-toolchain-bionic main +deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-5.0 main +deb-src http://apt.llvm.org/bionic/ llvm-toolchain-bionic-5.0 main +deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-6.0 main +deb-src http://apt.llvm.org/bionic/ llvm-toolchain-bionic-6.0 main +deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-7 main +deb-src http://apt.llvm.org/bionic/ llvm-toolchain-bionic-7 main +deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-8 main +deb-src http://apt.llvm.org/bionic/ llvm-toolchain-bionic-8 main +deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-9 main +deb-src http://apt.llvm.org/bionic/ llvm-toolchain-bionic-9 main +deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-10 main +deb-src http://apt.llvm.org/bionic/ llvm-toolchain-bionic-10 main + +deb http://ppa.launchpad.net/deadsnakes/ppa/ubuntu bionic main +deb-src http://ppa.launchpad.net/deadsnakes/ppa/ubuntu bionic main diff --git a/extras/dockerfiles/ubuntu-18.04_install.sh b/extras/dockerfiles/ubuntu-18.04_install.sh deleted file mode 100644 index 7c1aa3d..0000000 --- a/extras/dockerfiles/ubuntu-18.04_install.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash - -set -e - -apt-get install -y --no-install-recommends \ - curl - -# For the Bazel repository -curl https://bazel.build/bazel-release.pub.gpg | apt-key add - - -echo 'deb [arch=amd64] http://storage.googleapis.com/bazel-apt stable jdk1.8' >> /etc/apt/sources.list.d/bazel.list - -cat </etc/apt/sources.list.d/custom.list -deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic main -deb-src http://apt.llvm.org/bionic/ llvm-toolchain-bionic main -deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-5.0 main -deb-src http://apt.llvm.org/bionic/ llvm-toolchain-bionic-5.0 main -deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-6.0 main -deb-src http://apt.llvm.org/bionic/ llvm-toolchain-bionic-6.0 main -deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-7 main -deb-src http://apt.llvm.org/bionic/ llvm-toolchain-bionic-7 main -deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-8 main -deb-src http://apt.llvm.org/bionic/ llvm-toolchain-bionic-8 main -deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-9 main -deb-src http://apt.llvm.org/bionic/ llvm-toolchain-bionic-9 main -deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-10 main -deb-src http://apt.llvm.org/bionic/ llvm-toolchain-bionic-10 main -EOF - -apt-get update -qq - -apt-get install -y --allow-unauthenticated --no-install-recommends \ - g++-8 \ - g++-7 \ - g++-6 \ - g++-5 \ - clang-3.9 \ - clang-4.0 \ - clang-5.0 \ - clang-6.0 \ - clang-7 \ - clang-8 \ - clang-9 \ - clang-10 \ - bazel \ - git \ - python \ - python3-sh \ - python3-typed-ast \ - clang-tidy \ - clang-format diff --git a/extras/dockerfiles/ubuntu-19.04_custom.list b/extras/dockerfiles/ubuntu-19.04_custom.list deleted file mode 100644 index e69de29..0000000 diff --git a/extras/dockerfiles/ubuntu-19.04_install.sh b/extras/dockerfiles/ubuntu-19.04_install.sh deleted file mode 100644 index 076073c..0000000 --- a/extras/dockerfiles/ubuntu-19.04_install.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash - -set -e - -cat </etc/apt/sources.list.d/ubuntu-19.10_custom.list -deb http://apt.llvm.org/disco/ llvm-toolchain-disco main -deb-src http://apt.llvm.org/disco/ llvm-toolchain-disco main -# 9 -deb http://apt.llvm.org/disco/ llvm-toolchain-disco-9 main -deb-src http://apt.llvm.org/disco/ llvm-toolchain-disco-9 main -# 10 -deb http://apt.llvm.org/disco/ llvm-toolchain-disco-10 main -deb-src http://apt.llvm.org/disco/ llvm-toolchain-disco-10 main -EOF - -apt-get update - -apt-get install -y --allow-unauthenticated --no-install-recommends \ - g++-7 \ - g++-8 \ - g++-9 \ - clang-6.0 \ - clang-7 \ - clang-8 \ - python \ - python3-sh \ - python3-typed-ast \ - clang-tidy \ - clang-format diff --git a/extras/dockerfiles/ubuntu-19.10_custom.list b/extras/dockerfiles/ubuntu-19.10_custom.list index e69de29..ac1b4bd 100644 --- a/extras/dockerfiles/ubuntu-19.10_custom.list +++ b/extras/dockerfiles/ubuntu-19.10_custom.list @@ -0,0 +1,6 @@ +deb http://apt.llvm.org/eoan/ llvm-toolchain-eoan main +deb-src http://apt.llvm.org/eoan/ llvm-toolchain-eoan main +deb http://apt.llvm.org/eoan/ llvm-toolchain-eoan-9 main +deb-src http://apt.llvm.org/eoan/ llvm-toolchain-eoan-9 main +deb http://apt.llvm.org/eoan/ llvm-toolchain-eoan-10 main +deb-src http://apt.llvm.org/eoan/ llvm-toolchain-eoan-10 main diff --git a/extras/dockerfiles/ubuntu-19.10_install.sh b/extras/dockerfiles/ubuntu-19.10_install.sh deleted file mode 100644 index 464c400..0000000 --- a/extras/dockerfiles/ubuntu-19.10_install.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash - -set -e - -cat </etc/apt/sources.list.d/ubuntu-19.10_custom.list -deb http://apt.llvm.org/eoan/ llvm-toolchain-eoan main -deb-src http://apt.llvm.org/eoan/ llvm-toolchain-eoan main -deb http://apt.llvm.org/eoan/ llvm-toolchain-eoan-9 main -deb-src http://apt.llvm.org/eoan/ llvm-toolchain-eoan-9 main -deb http://apt.llvm.org/eoan/ llvm-toolchain-eoan-10 main -deb-src http://apt.llvm.org/eoan/ llvm-toolchain-eoan-10 main -EOF - -apt-get update - -apt-get install -y --allow-unauthenticated --no-install-recommends \ - g++-7 \ - g++-8 \ - g++-9 \ - clang-6.0 \ - clang-7 \ - clang-8 \ - clang-9 \ - clang-10 \ - python \ - python3-sh \ - python3-typed-ast \ - clang-tidy \ - clang-format diff --git a/extras/dockerfiles/ubuntu-20.04_custom.list b/extras/dockerfiles/ubuntu-20.04_custom.list index e69de29..c26e2d9 100644 --- a/extras/dockerfiles/ubuntu-20.04_custom.list +++ b/extras/dockerfiles/ubuntu-20.04_custom.list @@ -0,0 +1,4 @@ +deb http://apt.llvm.org/focal/ llvm-toolchain-focal-9 main +deb-src http://apt.llvm.org/focal/ llvm-toolchain-focal-9 main +deb http://apt.llvm.org/focal/ llvm-toolchain-focal-10 main +deb-src http://apt.llvm.org/focal/ llvm-toolchain-focal-10 main diff --git a/extras/dockerfiles/ubuntu-20.04_install.sh b/extras/dockerfiles/ubuntu-20.04_install.sh deleted file mode 100644 index 6b883bf..0000000 --- a/extras/dockerfiles/ubuntu-20.04_install.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash - -set -e - -cat </etc/apt/sources.list.d/ubuntu-20.04_custom.list -deb http://apt.llvm.org/focal/ llvm-toolchain-focal-9 main -deb-src http://apt.llvm.org/focal/ llvm-toolchain-focal-9 main -deb http://apt.llvm.org/focal/ llvm-toolchain-focal-10 main -deb-src http://apt.llvm.org/focal/ llvm-toolchain-focal-10 main -EOF - -apt-get update - -apt-get install -y --allow-unauthenticated --no-install-recommends \ - g++-7 \ - g++-8 \ - g++-9 \ - g++-10 \ - clang-6.0 \ - clang-7 \ - clang-8 \ - clang-9 \ - clang-10 \ - python \ - python3-sh \ - python3-typed-ast \ - clang-tidy \ - clang-format diff --git a/extras/dockerfiles/ubuntu_arm-16.04_install.sh b/extras/dockerfiles/ubuntu_arm-16.04_install.sh deleted file mode 100644 index d692fb4..0000000 --- a/extras/dockerfiles/ubuntu_arm-16.04_install.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -set -e - -apt-get install -y --allow-unauthenticated --no-install-recommends \ - clang-3.5 \ - clang-3.6 \ - clang-3.7 \ - clang-3.9 \ - clang-4.0 \ - g++-5 \ - g++-4.9 \ - g++-6 \ - python \ - clang-tidy \ - clang-format diff --git a/extras/dockerfiles/ubuntu_arm-18.04_custom.list b/extras/dockerfiles/ubuntu_arm-18.04_custom.list deleted file mode 100644 index e69de29..0000000 diff --git a/extras/dockerfiles/ubuntu_arm-18.04_install.sh b/extras/dockerfiles/ubuntu_arm-18.04_install.sh deleted file mode 100644 index ea2d240..0000000 --- a/extras/dockerfiles/ubuntu_arm-18.04_install.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -set -e - -apt-get install -y --allow-unauthenticated --no-install-recommends \ - g++-8 \ - g++-7 \ - g++-5 \ - clang-3.9 \ - clang-4.0 \ - clang-5.0 \ - clang-6.0 \ - python \ - python3-sh \ - python3-typed-ast \ - clang-tidy \ - clang-format -- cgit v1.2.3 From 45fa33d27da5a9b21471094f34e7f26c21e71f5b Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sun, 17 May 2020 17:14:57 -0700 Subject: Add a bazel flag to the CI script, needed until Bazel is available in Ubuntu 20.04. --- extras/scripts/postsubmit-helper.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/extras/scripts/postsubmit-helper.sh b/extras/scripts/postsubmit-helper.sh index 550c0b0..7be3b88 100755 --- a/extras/scripts/postsubmit-helper.sh +++ b/extras/scripts/postsubmit-helper.sh @@ -194,8 +194,12 @@ then make install else # COMPILER=bazel - - BAZEL_FLAGS=("--python_path=$(which python3)") + + # In recent versions of Bazel (as of May 2020), --python_path is ignored unless + # --noincompatible_use_python_toolchains is also used. + # Ignoring --python_path is ok in Ubuntu 20.04 since 3.8 is the default Python there, but causes problems in docker + # images with older Ubuntu versions that have both 3.8 and another 3.x version installed. + BAZEL_FLAGS=("--python_path=$(which python3.8)" "--noincompatible_use_python_toolchains") case "$1" in DebugPlain) ;; ReleasePlain) BAZEL_FLAGS+=("-c" "opt") ;; -- cgit v1.2.3 From faa69229324e7b0393e2196b9fb919e5056dc675 Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sat, 13 Jun 2020 18:14:11 -0700 Subject: Declare the dep on boost in bazel, so that Fruit builds even on systems where Boost isn't installed. This required some refactoring of the testing code, since we can't depend on the Boost headers as a fileset (that we'd need) so generated code in tests can't include Boost anymore. --- BUILD | 4 ++- extras/bazel_root/WORKSPACE | 10 +++++++ tests/BUILD | 20 ++++++++++---- tests/CMakeLists.txt | 5 ++++ tests/build_defs.bzl | 1 + tests/data_structures/test_semistatic_graph.py | 20 -------------- tests/fruit_test_common.py | 14 ++++++++-- tests/test_common.cpp | 36 ++++++++++++++++++++++++++ tests/test_common.h | 25 +++++++++++++++--- 9 files changed, 104 insertions(+), 31 deletions(-) create mode 100644 tests/test_common.cpp diff --git a/BUILD b/BUILD index 463ddc9..7d781ee 100644 --- a/BUILD +++ b/BUILD @@ -18,6 +18,8 @@ cc_library( "configuration/bazel/**/*.h"]), hdrs = glob(["include/fruit/*.h"]), includes = ["include", "configuration/bazel"], - deps = [], + deps = [ + "@boost//:unordered", + ], linkopts = ["-lm"], ) diff --git a/extras/bazel_root/WORKSPACE b/extras/bazel_root/WORKSPACE index 8622415..d74dafe 100644 --- a/extras/bazel_root/WORKSPACE +++ b/extras/bazel_root/WORKSPACE @@ -6,3 +6,13 @@ git_repository( # GTest HEAD as of August 2018. commit = "9c96f500a39df6915f8f1ab53b60be9889f1572b", ) + +git_repository( + name = "com_github_nelhage_rules_boost", + commit = "1e3a69bf2d5cd10c34b74f066054cd335d033d71", + remote = "https://github.com/nelhage/rules_boost", + shallow_since = "1591047380 -0700", +) + +load("@com_github_nelhage_rules_boost//:boost/boost.bzl", "boost_deps") +boost_deps() diff --git a/tests/BUILD b/tests/BUILD index 4fc016d..b7ff089 100644 --- a/tests/BUILD +++ b/tests/BUILD @@ -15,10 +15,14 @@ filegroup( cc_library( name = "test_headers", - srcs = [], + srcs = ["test_common.cpp"], hdrs = TEST_HEADERS, visibility = ["//third_party/fruit/tests:__subpackages__"], includes = ["."], + deps = [ + "//third_party/fruit", + "@boost//:unordered", + ] ) [cc_test( @@ -30,7 +34,7 @@ cc_library( ] ) for filename in glob( ["*.cpp"], - exclude = ["include_test.cpp"])] + exclude = ["include_test.cpp", "test_common.cpp"])] FRUIT_PUBLIC_HEADERS = [ "component", @@ -47,13 +51,15 @@ genrule( srcs = [ "//third_party/fruit", "//third_party/fruit:fruit_headers", + ":test_headers", ":test_headers_filegroup", ], - # Here we copy libfruit.so to work around an issue with py_test where the outputs of a cc_library in the data - # attribute of a py_test are not taken into account. + # Here we copy libfruit.so and test_headers.so to work around an issue with py_test where the outputs of a + # cc_library in the data attribute of a py_test are not taken into account. outs = [ "fruit_test_config.py", - "libfruit.so" + "libfruit.so", + "libtest_headers_copy.so", ], toolchains = [ # For $(CC_FLAGS) @@ -66,7 +72,9 @@ genrule( + "FRUIT_HEADERS_LOCATION=`for f in $(locations //third_party/fruit:fruit_headers); do echo \"$$f\"; done | fgrep configuration/bazel/ | head -n 1 | sed 's|configuration/bazel/.*|./|'`;" + "TEST_HEADERS_LOCATION=`for f in $(locations :test_headers_filegroup); do echo \"$$f\"; done | fgrep test_macros.h | sed 's|test_macros.h|./|'`;" + "LIBFRUIT_LOCATION=`for f in $(locations //third_party/fruit); do echo \"$$f\"; done | fgrep libfruit.so | head -n 1 | sed 's|libfruit.so|./|'`;" + + "LIBTEST_HEADERS_LOCATION=`for f in $(locations //third_party/fruit/tests:test_headers); do echo \"$$f\"; done | fgrep libtest_headers.so | head -n 1 | sed 's|libtest_headers.so|./|'`;" + "cp $${LIBFRUIT_LOCATION}/libfruit.so $(@D)/;" + + "cp $${LIBTEST_HEADERS_LOCATION}/libtest_headers.so $(@D)/libtest_headers_copy.so;" + "echo -e \"" + "CXX='$(CC)'\n" + "CXX_COMPILER_NAME='GNU'\n" @@ -76,6 +84,8 @@ genrule( + "CMAKE_BUILD_TYPE=None\n" + "PATH_TO_COMPILED_FRUIT='third_party/fruit/tests'\n" + "PATH_TO_COMPILED_FRUIT_LIB='third_party/fruit/tests'\n" + + "PATH_TO_COMPILED_TEST_HEADERS='third_party/fruit/tests/test_headers'\n" + + "PATH_TO_COMPILED_TEST_HEADERS_LIB='third_party/fruit/tests/test_headers'\n" + "PATH_TO_FRUIT_STATIC_HEADERS='$${FRUIT_HEADERS_LOCATION}/include'\n" + "PATH_TO_FRUIT_GENERATED_HEADERS='$${FRUIT_HEADERS_LOCATION}/configuration/bazel'\n" + "PATH_TO_FRUIT_TEST_HEADERS='$${TEST_HEADERS_LOCATION}'\n" diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index bf78890..479b8aa 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -81,6 +81,9 @@ if("${CMAKE_CXX_COMPILER_ID}" MATCHES "^(MSVC)$") set(FRUIT_TESTONLY_CXXFLAGS "${FRUIT_TESTONLY_CXXFLAGS} /wd4702 /wd4503") endif() +add_library(test_headers_copy SHARED test_common.cpp) +target_link_libraries(test_headers_copy fruit) + # Escape the backslash which is a Windows path separator. string(REPLACE "\\" "\\\\" ADDITIONAL_INCLUDE_DIRS "${Boost_INCLUDE_DIRS}") @@ -98,6 +101,8 @@ CMAKE_BUILD_TYPE='${CMAKE_BUILD_TYPE}' PATH_TO_COMPILED_FRUIT='$' PATH_TO_COMPILED_FRUIT_LIB='$' +PATH_TO_COMPILED_TEST_HEADERS='$' +PATH_TO_COMPILED_TEST_HEADERS_LIB='$' PATH_TO_FRUIT_STATIC_HEADERS='${CMAKE_CURRENT_SOURCE_DIR}/../include' PATH_TO_FRUIT_GENERATED_HEADERS='${CMAKE_CURRENT_BINARY_DIR}/../include' PATH_TO_FRUIT_TEST_HEADERS='${CMAKE_CURRENT_SOURCE_DIR}' diff --git a/tests/build_defs.bzl b/tests/build_defs.bzl index 13d3005..05bd13c 100644 --- a/tests/build_defs.bzl +++ b/tests/build_defs.bzl @@ -12,6 +12,7 @@ def fruit_py_tests(srcs, data=[]): data = data + [ "//third_party/fruit:fruit_headers", "//third_party/fruit/tests:libfruit.so", + "//third_party/fruit/tests:libtest_headers_copy.so", "//third_party/fruit/tests:test_headers_filegroup", ], shard_count = 32, diff --git a/tests/data_structures/test_semistatic_graph.py b/tests/data_structures/test_semistatic_graph.py index e0510da..95629e7 100644 --- a/tests/data_structures/test_semistatic_graph.py +++ b/tests/data_structures/test_semistatic_graph.py @@ -19,30 +19,10 @@ from fruit_test_common import * COMMON_DEFINITIONS = ''' #include "test_common.h" - #define IN_FRUIT_CPP_FILE 1 - #include - using namespace std; using namespace fruit::impl; - using Graph = SemistaticGraph; - using node_iterator = Graph::node_iterator; - using edge_iterator = Graph::edge_iterator; - vector no_neighbors{}; - - struct SimpleNode { - int id; - const char* value; - const vector* neighbors; - bool is_terminal; - - int getId() { return id; } - const char* getValue() { return value; } - bool isTerminal() { return is_terminal; } - vector::const_iterator getEdgesBegin() { return neighbors->begin(); } - vector::const_iterator getEdgesEnd() { return neighbors->end(); } - }; ''' class TestSemistaticGraph(parameterized.TestCase): diff --git a/tests/fruit_test_common.py b/tests/fruit_test_common.py index 064dc82..36e5b20 100644 --- a/tests/fruit_test_common.py +++ b/tests/fruit_test_common.py @@ -200,14 +200,21 @@ if CXX_COMPILER_NAME == 'MSVC': path_to_fruit_lib = PATH_TO_COMPILED_FRUIT_LIB[:-4] + '.lib' else: path_to_fruit_lib = PATH_TO_COMPILED_FRUIT_LIB - fruit_tests_linker_flags = [path_to_fruit_lib] + if PATH_TO_COMPILED_TEST_HEADERS_LIB.endswith('.dll'): + path_to_test_headers_lib = PATH_TO_COMPILED_TEST_HEADERS_LIB[:-4] + '.lib' + else: + path_to_test_headers_lib = PATH_TO_COMPILED_TEST_HEADERS_LIB + fruit_tests_linker_flags = [path_to_fruit_lib, path_to_test_headers_lib] fruit_error_message_extraction_regex = 'error C2338: (.*)' else: compiler = PosixCompiler() fruit_tests_linker_flags = [ '-lfruit', + '-ltest_headers_copy', '-L' + PATH_TO_COMPILED_FRUIT, '-Wl,-rpath,' + PATH_TO_COMPILED_FRUIT, + '-L' + PATH_TO_COMPILED_TEST_HEADERS, + '-Wl,-rpath,' + PATH_TO_COMPILED_TEST_HEADERS, ] fruit_error_message_extraction_regex = 'static.assert(.*)' @@ -222,9 +229,12 @@ _assert_helper = unittest.TestCase() def modify_env_for_compiled_executables(env): env = env.copy() path_to_fruit_lib_dir = os.path.dirname(PATH_TO_COMPILED_FRUIT_LIB) + path_to_fruit_test_headers_dir = os.path.dirname(PATH_TO_COMPILED_TEST_HEADERS_LIB) print('PATH_TO_COMPILED_FRUIT_LIB:', PATH_TO_COMPILED_FRUIT_LIB) + print('PATH_TO_COMPILED_TEST_HEADERS_LIB:', PATH_TO_COMPILED_TEST_HEADERS_LIB) print('Adding directory to PATH:', path_to_fruit_lib_dir) - env["PATH"] += os.pathsep + path_to_fruit_lib_dir + print('Adding directory to PATH:', path_to_fruit_test_headers_dir) + env["PATH"] += os.pathsep + path_to_fruit_lib_dir + os.pathsep + path_to_fruit_test_headers_dir return env def _create_temporary_file(file_content, file_name_suffix=''): diff --git a/tests/test_common.cpp b/tests/test_common.cpp new file mode 100644 index 0000000..868827f --- /dev/null +++ b/tests/test_common.cpp @@ -0,0 +1,36 @@ +/* + * Copyright 2014 Google Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#define IN_FRUIT_CPP_FILE 1 + +#include "test_common.h" + +#include + +// Clang requires the following instantiation to be in its namespace. +namespace fruit { +namespace impl { + +template class SemistaticGraph; +template SemistaticGraph::SemistaticGraph(std::vector::iterator first, std::vector::iterator last, MemoryPool& memory_pool); +template SemistaticGraph::SemistaticGraph(const fruit::impl::SemistaticGraph& graph, std::vector::iterator first, std::vector::iterator last, MemoryPool& memory_pool); +template class SemistaticMap; + +} // namespace impl +} // namespace fruit + + + diff --git a/tests/test_common.h b/tests/test_common.h index d48f110..56e2b13 100644 --- a/tests/test_common.h +++ b/tests/test_common.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef FRUIT_TEST_COMMON_H -#define FRUIT_TEST_COMMON_H +#ifndef FRUIT_COMMON_H +#define FRUIT_COMMON_H // This file includes headers used in various tests. // This allows to improve compilation speed (and therefore test time) by pre-compiling this header. @@ -27,4 +27,23 @@ #include #include -#endif // FRUIT_TEST_COMMON_H +// These are here because including Boost in test code would require depending on its headers but those files don't have +// public visibility in the bazel repo. +#include +using Graph = fruit::impl::SemistaticGraph; +using node_iterator = Graph::node_iterator; +using edge_iterator = Graph::edge_iterator; +struct SimpleNode { + int id; + const char* value; + const std::vector* neighbors; + bool is_terminal; + + int getId() { return id; } + const char* getValue() { return value; } + bool isTerminal() { return is_terminal; } + std::vector::const_iterator getEdgesBegin() { return neighbors->begin(); } + std::vector::const_iterator getEdgesEnd() { return neighbors->end(); } +}; + +#endif // FRUIT_COMMON_H -- cgit v1.2.3 From 3ccb5e1cd707fbb8a683a1ddbc81ec97e499010c Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sat, 11 Jul 2020 15:25:22 -0700 Subject: Report a more user-friendly error when passing a signature with Assisted params to registerConstructor or when attempting to use implicit constructor injection for a constructor that has assisted params. --- include/fruit/impl/component_functors.defn.h | 6 ++-- include/fruit/impl/injection_errors.h | 15 ++++++++++ tests/test_register_constructor.py | 41 ++++++++++++++++++++++++++++ 3 files changed, 59 insertions(+), 3 deletions(-) diff --git a/include/fruit/impl/component_functors.defn.h b/include/fruit/impl/component_functors.defn.h index b12f723..83ef385 100644 --- a/include/fruit/impl/component_functors.defn.h +++ b/include/fruit/impl/component_functors.defn.h @@ -570,8 +570,8 @@ struct PreProcessRegisterConstructor { using CDeps = NormalizeTypeVector(AnnotatedArgs); using CNonConstDeps = NormalizedNonConstTypesIn(AnnotatedArgs); using R = AddProvidedType(Comp, AnnotatedC, Bool, CDeps, CNonConstDeps); - using type = If( - Not(IsValidSignature(AnnotatedSignature)), ConstructError(NotASignatureErrorTag, AnnotatedSignature), + using type = If(Not(IsValidSignature(AnnotatedSignature)), ConstructError(NotASignatureErrorTag, AnnotatedSignature), + If(Not(IsSame(RemoveAssisted(Args), Args)), ConstructError(AssistedParamInRegisterConstructorSignatureErrorTag, AnnotatedSignature), PropagateError(CheckInjectableType(RemoveAnnotations(C)), PropagateError(CheckInjectableTypeVector(RemoveAnnotationsFromVector(Args)), If(IsAbstract(RemoveAnnotations(SignatureType(AnnotatedSignature))), @@ -579,7 +579,7 @@ struct PreProcessRegisterConstructor { RemoveAnnotations(SignatureType(AnnotatedSignature))), If(Not(IsConstructibleWithVector(C, Args)), ConstructError(NoConstructorMatchingInjectSignatureErrorTag, C, Signature), - PropagateError(R, ComponentFunctorIdentity(R))))))); + PropagateError(R, ComponentFunctorIdentity(R)))))))); }; }; diff --git a/include/fruit/impl/injection_errors.h b/include/fruit/impl/injection_errors.h index a0e9def..68247d2 100644 --- a/include/fruit/impl/injection_errors.h +++ b/include/fruit/impl/injection_errors.h @@ -124,6 +124,16 @@ struct NotASignatureError { "the form MyClass(int, float)."); }; +template +struct AssistedParamInRegisterConstructorSignatureError { + static_assert(AlwaysFalse::value, + "CandidateSignature was used as signature for a registerConstructor() (explicit or implicit via the " + "INJECT macro / Inject typedef) but it contains an assisted parameter. When using assisted parameters" + "You need to inject a factory like std::function(int, float)> instead of " + "injecting MyClass directly. If you used an explicit registerConstructor(), you also need to switch " + "that to registerFactory()."); +}; + template struct NotALambdaError { static_assert(AlwaysFalse::value, @@ -494,6 +504,11 @@ struct NotASignatureErrorTag { using apply = NotASignatureError; }; +struct AssistedParamInRegisterConstructorSignatureErrorTag { + template + using apply = AssistedParamInRegisterConstructorSignatureError; +}; + struct NotALambdaErrorTag { template using apply = NotALambdaError; diff --git a/tests/test_register_constructor.py b/tests/test_register_constructor.py index 3e5137e..b78191f 100755 --- a/tests/test_register_constructor.py +++ b/tests/test_register_constructor.py @@ -587,5 +587,46 @@ class TestRegisterConstructor(parameterized.TestCase): source, locals()) + def test_register_constructor_error_assisted_param(self): + source = ''' + struct X { + INJECT(X(ASSISTED(double) factor)) { + (void) factor; + } + }; + + fruit::Component getComponent() { + return fruit::createComponent() + .registerConstructor)>(); + } + ''' + expect_compile_error( + 'AssistedParamInRegisterConstructorSignatureError\\)>', + 'CandidateSignature was used as signature for a registerConstructor.* but it contains an assisted parameter.', + COMMON_DEFINITIONS, + source, + locals()) + + def test_implicit_register_constructor_error_assisted_param(self): + source = ''' + struct X { + INJECT(X(ASSISTED(double) factor)) { + (void) factor; + } + }; + + fruit::Component getComponent() { + return fruit::createComponent(); + } + ''' + expect_compile_error( + 'AssistedParamInRegisterConstructorSignatureError\\)>', + 'CandidateSignature was used as signature for a registerConstructor.* but it contains an assisted parameter.', + COMMON_DEFINITIONS, + source, + locals()) + + + if __name__ == '__main__': absltest.main() -- cgit v1.2.3 From 987716be45d64c81fc5117a72335c437b7e36b5a Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sat, 11 Jul 2020 15:31:10 -0700 Subject: Pass another flag to force installation of required brew packages in OS X CI tests. --- extras/scripts/travis_ci_install_osx.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/scripts/travis_ci_install_osx.sh b/extras/scripts/travis_ci_install_osx.sh index 2cbd357..d3cc7c8 100755 --- a/extras/scripts/travis_ci_install_osx.sh +++ b/extras/scripts/travis_ci_install_osx.sh @@ -12,7 +12,7 @@ done install_brew_package() { time (brew install "$@" || brew outdated "$1" || brew upgrade "$@" || true) # Some formulas are not linked into /usr/local by default, make sure they are. - time (brew link --force "$@" || true) + time (brew link --force --overwrite "$@" || true) } # For md5sum, timeout -- cgit v1.2.3 From c60370e7a9ff2abcba86e5289a9904213983dfc6 Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sun, 12 Jul 2020 00:32:31 -0700 Subject: Make the test_headers_copy library a static library. This fixes CI tests for Visual Studio, where otherwise it would generate a .dll instead of the expected .lib file. --- tests/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 479b8aa..095d3db 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -81,7 +81,7 @@ if("${CMAKE_CXX_COMPILER_ID}" MATCHES "^(MSVC)$") set(FRUIT_TESTONLY_CXXFLAGS "${FRUIT_TESTONLY_CXXFLAGS} /wd4702 /wd4503") endif() -add_library(test_headers_copy SHARED test_common.cpp) +add_library(test_headers_copy STATIC test_common.cpp) target_link_libraries(test_headers_copy fruit) # Escape the backslash which is a Windows path separator. -- cgit v1.2.3 From aeb903162f2c6bbcc378e8024142995cae79e6f8 Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sun, 12 Jul 2020 09:59:08 -0700 Subject: Configure the Github source code language analyzer to skip py files, otherwise Fruit gets listed as a Python project since there's more Python (in tests) than C++ (in the implementation). --- .gitattributes | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..912b302 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +*.py linguist-detectable=false -- cgit v1.2.3 From 29c9fd265cfa72ee72fb64257fe4b72198d87264 Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sun, 12 Jul 2020 10:02:58 -0700 Subject: Bump the Fruit version to 3.6.0. --- CMakeLists.txt | 2 +- conanfile.py | 2 +- extras/packaging/deploy_to_bintray.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d5b6a64..7efcf7b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.2) -project(Fruit VERSION 3.5.0 LANGUAGES CXX) +project(Fruit VERSION 3.6.0 LANGUAGES CXX) set(FRUIT_IS_BEING_BUILT_BY_CONAN FALSE CACHE BOOL "This is set in Conan builds.") if("${FRUIT_IS_BEING_BUILT_BY_CONAN}") diff --git a/conanfile.py b/conanfile.py index 9c87a68..a96d39c 100644 --- a/conanfile.py +++ b/conanfile.py @@ -5,7 +5,7 @@ import os class FruitConan(ConanFile): name = "fruit" - version = "3.5.0" + version = "3.6.0" license = "Apache" url = "https://github.com/google/fruit" homepage = "https://github.com/google/fruit" diff --git a/extras/packaging/deploy_to_bintray.sh b/extras/packaging/deploy_to_bintray.sh index 0365a6d..78d5c51 100755 --- a/extras/packaging/deploy_to_bintray.sh +++ b/extras/packaging/deploy_to_bintray.sh @@ -1,6 +1,6 @@ #!/bin/bash -FRUIT_VERSION=3.5.0 +FRUIT_VERSION=3.6.0 # To authenticate: # conan user -p -r fruit-bintray polettimarco -- cgit v1.2.3 From 94cefefb42f3685c1d64664e6aa9cbaf834b25ee Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sun, 9 Aug 2020 11:02:44 -0700 Subject: Automatically detect compiler features when running under Bazel. Before this commit, bazel builds used a hardcoded configuration, but that doesn't work e.g. on Windows where MSVC needs a different config. --- BUILD | 7 +- configuration/bazel/BUILD | 8 ++ configuration/bazel/always_inline_attribute.cpp | 7 ++ configuration/bazel/attribute_deprecated.cpp | 5 ++ configuration/bazel/build_defs.bzl | 85 ++++++++++++++++++++++ configuration/bazel/builtin_unreachable.cpp | 13 ++++ .../clang_arbitrary_overload_resolution_bug.cpp | 11 +++ configuration/bazel/constexpr_typeid.cpp | 6 ++ configuration/bazel/cxa_demangle.cpp | 6 ++ configuration/bazel/declspec_deprecated.cpp | 5 ++ configuration/bazel/force_inline.cpp | 7 ++ configuration/bazel/fruit/impl/fruit-config-base.h | 70 ------------------ configuration/bazel/gcc_attribute_deprecated.cpp | 5 ++ configuration/bazel/has_trivial_copy.cpp | 5 ++ configuration/bazel/is_trivially_copyable.cpp | 5 ++ configuration/bazel/max_align_t.cpp | 5 ++ configuration/bazel/msvc_assume.cpp | 13 ++++ .../bazel/std_is_trivially_copy_constructible.cpp | 6 ++ configuration/bazel/std_is_trivially_copyable.cpp | 6 ++ configuration/bazel/std_max_align_t.cpp | 5 ++ configuration/bazel/typeid.cpp | 5 ++ 21 files changed, 212 insertions(+), 73 deletions(-) create mode 100644 configuration/bazel/BUILD create mode 100644 configuration/bazel/always_inline_attribute.cpp create mode 100644 configuration/bazel/attribute_deprecated.cpp create mode 100644 configuration/bazel/build_defs.bzl create mode 100644 configuration/bazel/builtin_unreachable.cpp create mode 100644 configuration/bazel/clang_arbitrary_overload_resolution_bug.cpp create mode 100644 configuration/bazel/constexpr_typeid.cpp create mode 100644 configuration/bazel/cxa_demangle.cpp create mode 100644 configuration/bazel/declspec_deprecated.cpp create mode 100644 configuration/bazel/force_inline.cpp delete mode 100644 configuration/bazel/fruit/impl/fruit-config-base.h create mode 100644 configuration/bazel/gcc_attribute_deprecated.cpp create mode 100644 configuration/bazel/has_trivial_copy.cpp create mode 100644 configuration/bazel/is_trivially_copyable.cpp create mode 100644 configuration/bazel/max_align_t.cpp create mode 100644 configuration/bazel/msvc_assume.cpp create mode 100644 configuration/bazel/std_is_trivially_copy_constructible.cpp create mode 100644 configuration/bazel/std_is_trivially_copyable.cpp create mode 100644 configuration/bazel/std_max_align_t.cpp create mode 100644 configuration/bazel/typeid.cpp diff --git a/BUILD b/BUILD index 7d781ee..4c2aef5 100644 --- a/BUILD +++ b/BUILD @@ -6,8 +6,9 @@ filegroup( name = "fruit_headers", srcs = glob([ "include/**/*.h", - "configuration/bazel/**/*.h", - ]), + ]) + [ + "//third_party/fruit/configuration/bazel:fruit_config", + ], ) cc_library( @@ -15,7 +16,7 @@ cc_library( srcs = glob([ "src/*.cpp", "include/fruit/impl/**/*.h", - "configuration/bazel/**/*.h"]), + ]) + ["//third_party/fruit/configuration/bazel:fruit_config"], hdrs = glob(["include/fruit/*.h"]), includes = ["include", "configuration/bazel"], deps = [ diff --git a/configuration/bazel/BUILD b/configuration/bazel/BUILD new file mode 100644 index 0000000..112b732 --- /dev/null +++ b/configuration/bazel/BUILD @@ -0,0 +1,8 @@ +load("//third_party/fruit/configuration/bazel:build_defs.bzl", "generate_fruit_config") + +package(default_visibility = ["//third_party/fruit:__subpackages__"]) + +generate_fruit_config( + name = "fruit_config", + check_sources = glob(["*.cpp"]) +) diff --git a/configuration/bazel/always_inline_attribute.cpp b/configuration/bazel/always_inline_attribute.cpp new file mode 100644 index 0000000..e6215af --- /dev/null +++ b/configuration/bazel/always_inline_attribute.cpp @@ -0,0 +1,7 @@ +__attribute__((always_inline)) +void f() { +} + +int main() { + return 0; +} diff --git a/configuration/bazel/attribute_deprecated.cpp b/configuration/bazel/attribute_deprecated.cpp new file mode 100644 index 0000000..245519d --- /dev/null +++ b/configuration/bazel/attribute_deprecated.cpp @@ -0,0 +1,5 @@ +[[deprecated]] void f(); + +int main() { + return 0; +} diff --git a/configuration/bazel/build_defs.bzl b/configuration/bazel/build_defs.bzl new file mode 100644 index 0000000..8d683c4 --- /dev/null +++ b/configuration/bazel/build_defs.bzl @@ -0,0 +1,85 @@ +load("@rules_cc//cc:action_names.bzl", "C_COMPILE_ACTION_NAME") +load("@rules_cc//cc:toolchain_utils.bzl", "find_cpp_toolchain") + +def _generate_fruit_config_impl(ctx): + cc_toolchain = find_cpp_toolchain(ctx) + + feature_configuration = cc_common.configure_features( + ctx = ctx, + cc_toolchain = cc_toolchain, + requested_features = ctx.features, + unsupported_features = ctx.disabled_features, + ) + c_compiler_path = cc_common.get_tool_for_action( + feature_configuration = feature_configuration, + action_name = C_COMPILE_ACTION_NAME, + ) + + check_output_files = [] + for check_source in ctx.files.check_sources: + output_file = ctx.actions.declare_file(check_source.path + ".o") + + c_compile_variables = cc_common.create_compile_variables( + feature_configuration = feature_configuration, + cc_toolchain = cc_toolchain, + user_compile_flags = ctx.fragments.cpp.copts + ctx.fragments.cpp.conlyopts, + source_file = check_source.path, + output_file = output_file.path, + ) + command_line = cc_common.get_memory_inefficient_command_line( + feature_configuration = feature_configuration, + action_name = C_COMPILE_ACTION_NAME, + variables = c_compile_variables, + ) + env = cc_common.get_environment_variables( + feature_configuration = feature_configuration, + action_name = C_COMPILE_ACTION_NAME, + variables = c_compile_variables, + ) + + check_name = check_source.path.split('/')[-1].split('\\')[-1] + check_define = 'FRUIT_HAS_%s' % check_name.upper() + check_output_file = ctx.actions.declare_file(check_source.path + ".h") + + ctx.actions.run_shell( + command = '"$@" &>/dev/null && echo "#define %s 1" >"%s" || echo "#define %s 0" >"%s"; touch "%s"' % ( + check_define, check_output_file.path, check_define, check_output_file.path, output_file.path + ), + arguments = [c_compiler_path] + command_line, + env = env, + inputs = depset( + [check_source], + transitive = [cc_toolchain.all_files], + ), + outputs = [output_file, check_output_file], + ) + check_output_files.append(check_output_file) + + merged_output_file = ctx.actions.declare_file(ctx.label.name + ".h") + ctx.actions.run_shell( + command = '\n'.join([ + '(', + 'echo "#ifndef FRUIT_CONFIG_BASE_H"', + 'echo "#define FRUIT_CONFIG_BASE_H"', + 'echo "#define FRUIT_USES_BOOST 1"', + 'cat %s' % ' '.join([check_output_file.path for check_output_file in check_output_files]), + 'echo "#endif"', + ')>%s' % merged_output_file.path + ]), + inputs = check_output_files, + outputs = [merged_output_file], + ) + + return [ + DefaultInfo(files = depset([merged_output_file])), + ] + +generate_fruit_config = rule( + implementation = _generate_fruit_config_impl, + attrs = { + "check_sources": attr.label_list(allow_files = True), + "_cc_toolchain": attr.label(default = Label("@bazel_tools//tools/cpp:current_cc_toolchain")), + }, + toolchains = ["@bazel_tools//tools/cpp:toolchain_type"], + fragments = ["cpp"], +) \ No newline at end of file diff --git a/configuration/bazel/builtin_unreachable.cpp b/configuration/bazel/builtin_unreachable.cpp new file mode 100644 index 0000000..11d20cf --- /dev/null +++ b/configuration/bazel/builtin_unreachable.cpp @@ -0,0 +1,13 @@ +int f() { + static int x = 1; + if (x == 1) { + return 0; + } else { + __builtin_unreachable(); + // Note: the lack of return here is intentional + } +} + +int main() { + return f(); +} diff --git a/configuration/bazel/clang_arbitrary_overload_resolution_bug.cpp b/configuration/bazel/clang_arbitrary_overload_resolution_bug.cpp new file mode 100644 index 0000000..67b4317 --- /dev/null +++ b/configuration/bazel/clang_arbitrary_overload_resolution_bug.cpp @@ -0,0 +1,11 @@ +template +struct Pair {}; + +struct Map : public Pair, Pair {}; + +template +Value f(Pair*) { return Value(); } + +int main() { + f((Map*)0); +} diff --git a/configuration/bazel/constexpr_typeid.cpp b/configuration/bazel/constexpr_typeid.cpp new file mode 100644 index 0000000..a793377 --- /dev/null +++ b/configuration/bazel/constexpr_typeid.cpp @@ -0,0 +1,6 @@ +#include +int main() { + constexpr static const std::type_info& x = typeid(int); + (void) x; + return 0; +} diff --git a/configuration/bazel/cxa_demangle.cpp b/configuration/bazel/cxa_demangle.cpp new file mode 100644 index 0000000..3e4f57f --- /dev/null +++ b/configuration/bazel/cxa_demangle.cpp @@ -0,0 +1,6 @@ +#include +int main() { + auto* p = abi::__cxa_demangle; + (void) p; + return 0; +} diff --git a/configuration/bazel/declspec_deprecated.cpp b/configuration/bazel/declspec_deprecated.cpp new file mode 100644 index 0000000..79a9f43 --- /dev/null +++ b/configuration/bazel/declspec_deprecated.cpp @@ -0,0 +1,5 @@ +__declspec(deprecated) void f(); + +int main() { + return 0; +} diff --git a/configuration/bazel/force_inline.cpp b/configuration/bazel/force_inline.cpp new file mode 100644 index 0000000..fab42d2 --- /dev/null +++ b/configuration/bazel/force_inline.cpp @@ -0,0 +1,7 @@ +__forceinline +void f() { +} + +int main() { + return 0; +} diff --git a/configuration/bazel/fruit/impl/fruit-config-base.h b/configuration/bazel/fruit/impl/fruit-config-base.h deleted file mode 100644 index 8e7af1d..0000000 --- a/configuration/bazel/fruit/impl/fruit-config-base.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright 2014 Google Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef FRUIT_CONFIG_BASE_H -#define FRUIT_CONFIG_BASE_H - -// Needed for all Clang versions (as of January 2016), not needed for GCC. -// This can also be defined for GCC, but it slightly slows down compile time of code using Fruit. -#define FRUIT_HAS_CLANG_ARBITRARY_OVERLOAD_RESOLUTION_BUG 1 - -// Whether the compiler defines std::max_align_t. -#define FRUIT_HAS_STD_MAX_ALIGN_T 1 - -// Whether the compiler defines ::max_align_t. -// Ignored if FRUIT_HAS_STD_MAX_ALIGN_T is set. -#define FRUIT_HAS_MAX_ALIGN_T 1 - -// Whether the compiler defines std::is_trivially_copyable. -#define FRUIT_HAS_STD_IS_TRIVIALLY_COPYABLE 1 - -// Whether the compiler defines __has_trivial_copy. -// Ignored if FRUIT_HAS_STD_IS_TRIVIALLY_COPYABLE is set. -#define FRUIT_HAS_HAS_TRIVIAL_COPY 1 - -// Whether the compiler defines __is_trivially_copyable. -// Ignored if FRUIT_HAS_STD_IS_TRIVIALLY_COPYABLE is set. -#define FRUIT_HAS_IS_TRIVIALLY_COPYABLE 1 - -// Whether the compiler defines std::is_trivially_copy_constructible. -#define FRUIT_HAS_STD_IS_TRIVIALLY_COPY_CONSTRUCTIBLE 1 - -// Whether typeid() is available. Typically, it is unless RTTI is disabled. -#define FRUIT_HAS_TYPEID 1 - -// Whether typeid() is constexpr. Typically, it is except in MSVC. -#define FRUIT_HAS_CONSTEXPR_TYPEID 1 - -// Whether abi::__cxa_demangle() is available after including cxxabi.h. -#define FRUIT_HAS_CXA_DEMANGLE 1 - -#define FRUIT_USES_BOOST 1 - -#define FRUIT_HAS_ALWAYS_INLINE_ATTRIBUTE 1 - -#define FRUIT_HAS_FORCEINLINE 0 - -#define FRUIT_HAS_ATTRIBUTE_DEPRECATED 0 - -#define FRUIT_HAS_GCC_ATTRIBUTE_DEPRECATED 1 - -#define FRUIT_HAS_DECLSPEC_DEPRECATED 0 - -#define FRUIT_HAS_MSVC_ASSUME 0 - -#define FRUIT_HAS_BUILTIN_UNREACHABLE 1 - -#endif // FRUIT_CONFIG_BASE_H diff --git a/configuration/bazel/gcc_attribute_deprecated.cpp b/configuration/bazel/gcc_attribute_deprecated.cpp new file mode 100644 index 0000000..6d0bf5f --- /dev/null +++ b/configuration/bazel/gcc_attribute_deprecated.cpp @@ -0,0 +1,5 @@ +void f() __attribute__((deprecated)); + +int main() { + return 0; +} diff --git a/configuration/bazel/has_trivial_copy.cpp b/configuration/bazel/has_trivial_copy.cpp new file mode 100644 index 0000000..b9da7d1 --- /dev/null +++ b/configuration/bazel/has_trivial_copy.cpp @@ -0,0 +1,5 @@ +int main() { + bool b = __has_trivial_copy(int); + (void) b; + return 0; +} diff --git a/configuration/bazel/is_trivially_copyable.cpp b/configuration/bazel/is_trivially_copyable.cpp new file mode 100644 index 0000000..b8b7379 --- /dev/null +++ b/configuration/bazel/is_trivially_copyable.cpp @@ -0,0 +1,5 @@ +int main() { + bool b = __is_trivially_copyable(int); + (void) b; + return 0; +} diff --git a/configuration/bazel/max_align_t.cpp b/configuration/bazel/max_align_t.cpp new file mode 100644 index 0000000..37342f1 --- /dev/null +++ b/configuration/bazel/max_align_t.cpp @@ -0,0 +1,5 @@ +#include +using X = max_align_t; +int main() { + return 0; +} diff --git a/configuration/bazel/msvc_assume.cpp b/configuration/bazel/msvc_assume.cpp new file mode 100644 index 0000000..cd9f6ed --- /dev/null +++ b/configuration/bazel/msvc_assume.cpp @@ -0,0 +1,13 @@ +int f() { + static int x = 1; + if (x == 1) { + return 0; + } else { + __assume(0); + // Note: the lack of return here is intentional + } +} + +int main() { + return f(); +} diff --git a/configuration/bazel/std_is_trivially_copy_constructible.cpp b/configuration/bazel/std_is_trivially_copy_constructible.cpp new file mode 100644 index 0000000..7cb8d5b --- /dev/null +++ b/configuration/bazel/std_is_trivially_copy_constructible.cpp @@ -0,0 +1,6 @@ +#include +int main() { + bool b = std::is_trivially_copy_constructible::value; + (void) b; + return 0; +} diff --git a/configuration/bazel/std_is_trivially_copyable.cpp b/configuration/bazel/std_is_trivially_copyable.cpp new file mode 100644 index 0000000..871b793 --- /dev/null +++ b/configuration/bazel/std_is_trivially_copyable.cpp @@ -0,0 +1,6 @@ +#include +int main() { + bool b = std::is_trivially_copyable::value; + (void) b; + return 0; +} diff --git a/configuration/bazel/std_max_align_t.cpp b/configuration/bazel/std_max_align_t.cpp new file mode 100644 index 0000000..acec695 --- /dev/null +++ b/configuration/bazel/std_max_align_t.cpp @@ -0,0 +1,5 @@ +#include +using X = std::max_align_t; +int main() { + return 0; +} diff --git a/configuration/bazel/typeid.cpp b/configuration/bazel/typeid.cpp new file mode 100644 index 0000000..9621d03 --- /dev/null +++ b/configuration/bazel/typeid.cpp @@ -0,0 +1,5 @@ +#include +int main() { + (void) typeid(int); + return 0; +} -- cgit v1.2.3 From 577949f73e6a6fd33407611afb3cd8b59ed13bac Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sun, 9 Aug 2020 12:18:19 -0700 Subject: Move the bazel WORKSPACE file to the root dir, and replace the one in extras/bazel_root/ with a symlink. --- WORKSPACE | 18 ++++++++++++++++++ extras/bazel_root/WORKSPACE | 19 +------------------ 2 files changed, 19 insertions(+), 18 deletions(-) create mode 100644 WORKSPACE mode change 100644 => 120000 extras/bazel_root/WORKSPACE diff --git a/WORKSPACE b/WORKSPACE new file mode 100644 index 0000000..d74dafe --- /dev/null +++ b/WORKSPACE @@ -0,0 +1,18 @@ +load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") + +git_repository( + name = "com_google_googletest", + remote = "https://github.com/google/googletest", + # GTest HEAD as of August 2018. + commit = "9c96f500a39df6915f8f1ab53b60be9889f1572b", +) + +git_repository( + name = "com_github_nelhage_rules_boost", + commit = "1e3a69bf2d5cd10c34b74f066054cd335d033d71", + remote = "https://github.com/nelhage/rules_boost", + shallow_since = "1591047380 -0700", +) + +load("@com_github_nelhage_rules_boost//:boost/boost.bzl", "boost_deps") +boost_deps() diff --git a/extras/bazel_root/WORKSPACE b/extras/bazel_root/WORKSPACE deleted file mode 100644 index d74dafe..0000000 --- a/extras/bazel_root/WORKSPACE +++ /dev/null @@ -1,18 +0,0 @@ -load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") - -git_repository( - name = "com_google_googletest", - remote = "https://github.com/google/googletest", - # GTest HEAD as of August 2018. - commit = "9c96f500a39df6915f8f1ab53b60be9889f1572b", -) - -git_repository( - name = "com_github_nelhage_rules_boost", - commit = "1e3a69bf2d5cd10c34b74f066054cd335d033d71", - remote = "https://github.com/nelhage/rules_boost", - shallow_since = "1591047380 -0700", -) - -load("@com_github_nelhage_rules_boost//:boost/boost.bzl", "boost_deps") -boost_deps() diff --git a/extras/bazel_root/WORKSPACE b/extras/bazel_root/WORKSPACE new file mode 120000 index 0000000..6991d20 --- /dev/null +++ b/extras/bazel_root/WORKSPACE @@ -0,0 +1 @@ +../../WORKSPACE \ No newline at end of file -- cgit v1.2.3 From f83a61fa1f58e4bba0fbf68fa5e70eb9d6c85314 Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sun, 9 Aug 2020 12:22:36 -0700 Subject: Revert "Move the bazel WORKSPACE file to the root dir, and replace the one in extras/bazel_root/ with a symlink." This reverts commit 577949f73e6a6fd33407611afb3cd8b59ed13bac. --- WORKSPACE | 18 ------------------ extras/bazel_root/WORKSPACE | 19 ++++++++++++++++++- 2 files changed, 18 insertions(+), 19 deletions(-) delete mode 100644 WORKSPACE mode change 120000 => 100644 extras/bazel_root/WORKSPACE diff --git a/WORKSPACE b/WORKSPACE deleted file mode 100644 index d74dafe..0000000 --- a/WORKSPACE +++ /dev/null @@ -1,18 +0,0 @@ -load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") - -git_repository( - name = "com_google_googletest", - remote = "https://github.com/google/googletest", - # GTest HEAD as of August 2018. - commit = "9c96f500a39df6915f8f1ab53b60be9889f1572b", -) - -git_repository( - name = "com_github_nelhage_rules_boost", - commit = "1e3a69bf2d5cd10c34b74f066054cd335d033d71", - remote = "https://github.com/nelhage/rules_boost", - shallow_since = "1591047380 -0700", -) - -load("@com_github_nelhage_rules_boost//:boost/boost.bzl", "boost_deps") -boost_deps() diff --git a/extras/bazel_root/WORKSPACE b/extras/bazel_root/WORKSPACE deleted file mode 120000 index 6991d20..0000000 --- a/extras/bazel_root/WORKSPACE +++ /dev/null @@ -1 +0,0 @@ -../../WORKSPACE \ No newline at end of file diff --git a/extras/bazel_root/WORKSPACE b/extras/bazel_root/WORKSPACE new file mode 100644 index 0000000..d74dafe --- /dev/null +++ b/extras/bazel_root/WORKSPACE @@ -0,0 +1,18 @@ +load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") + +git_repository( + name = "com_google_googletest", + remote = "https://github.com/google/googletest", + # GTest HEAD as of August 2018. + commit = "9c96f500a39df6915f8f1ab53b60be9889f1572b", +) + +git_repository( + name = "com_github_nelhage_rules_boost", + commit = "1e3a69bf2d5cd10c34b74f066054cd335d033d71", + remote = "https://github.com/nelhage/rules_boost", + shallow_since = "1591047380 -0700", +) + +load("@com_github_nelhage_rules_boost//:boost/boost.bzl", "boost_deps") +boost_deps() -- cgit v1.2.3 From 6f3760672a0d2c772306e737d894a2ae2d8c5f58 Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sun, 9 Aug 2020 12:30:58 -0700 Subject: Add some example code to show how to depend on Fruit from a bazel project. --- .gitignore | 1 + extras/bazel_usage_example/BUILD | 8 ++++++ extras/bazel_usage_example/WORKSPACE | 19 +++++++++++++ extras/bazel_usage_example/main.cpp | 55 ++++++++++++++++++++++++++++++++++++ 4 files changed, 83 insertions(+) create mode 100644 extras/bazel_usage_example/BUILD create mode 100644 extras/bazel_usage_example/WORKSPACE create mode 100644 extras/bazel_usage_example/main.cpp diff --git a/.gitignore b/.gitignore index 098e886..2a2e921 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,4 @@ bench_results /*.vcxproj.user /out/build/x64-Debug /out/build/x64-Debug cxx-17 +/extras/bazel_usage_example/bazel-* diff --git a/extras/bazel_usage_example/BUILD b/extras/bazel_usage_example/BUILD new file mode 100644 index 0000000..47934aa --- /dev/null +++ b/extras/bazel_usage_example/BUILD @@ -0,0 +1,8 @@ + +licenses(["notice"]) + +cc_binary( + name = "hello_world", + srcs = ["main.cpp"], + deps = ["@com_google_fruit//third_party/fruit"], +) diff --git a/extras/bazel_usage_example/WORKSPACE b/extras/bazel_usage_example/WORKSPACE new file mode 100644 index 0000000..e037168 --- /dev/null +++ b/extras/bazel_usage_example/WORKSPACE @@ -0,0 +1,19 @@ +load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") + +git_repository( + name = "com_github_nelhage_rules_boost", + branch = "master", + remote = "https://github.com/nelhage/rules_boost", +) + +load("@com_github_nelhage_rules_boost//:boost/boost.bzl", "boost_deps") +boost_deps() + +load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") + +git_repository( + name = "com_google_fruit", + remote = "https://github.com/google/fruit", + branch = "master", + strip_prefix = "extras/bazel_root", +) diff --git a/extras/bazel_usage_example/main.cpp b/extras/bazel_usage_example/main.cpp new file mode 100644 index 0000000..4364993 --- /dev/null +++ b/extras/bazel_usage_example/main.cpp @@ -0,0 +1,55 @@ + +#include +#include + +using fruit::Component; +using fruit::Injector; + +class Writer { +public: + virtual void write(std::string s) = 0; +}; + +class StdoutWriter : public Writer { +public: + // Like "StdoutWriter() = default;" but also marks this constructor as the + // one to use for injection. + INJECT(StdoutWriter()) = default; + + virtual void write(std::string s) override { + std::cout << s; + } +}; + +class Greeter { +public: + virtual void greet() = 0; +}; + +class GreeterImpl : public Greeter { +private: + Writer* writer; + +public: + // Like "GreeterImpl(Writer* writer) {...}" but also marks this constructor + // as the one to use for injection. + INJECT(GreeterImpl(Writer* writer)) : writer(writer) {} + + virtual void greet() override { + writer->write("Hello world!\n"); + } +}; + +Component getGreeterComponent() { + return fruit::createComponent().bind().bind(); +} + +int main() { + + Injector injector(getGreeterComponent); + Greeter* greeter = injector.get(); + + greeter->greet(); + + return 0; +} -- cgit v1.2.3 From c6d389dab4bcdb61ed1a3d9d0500f8d6feca1ecf Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sun, 9 Aug 2020 21:10:16 -0700 Subject: Fix bazel build errors introduced by 94cefefb42f3685c1d64664e6aa9cbaf834b25ee when the Fruit headers are not also installed on the system where bazel runs. --- BUILD | 5 +++-- configuration/bazel/BUILD | 2 +- configuration/bazel/build_defs.bzl | 28 +++++++++++++++++++++++----- tests/BUILD | 5 ++--- 4 files changed, 29 insertions(+), 11 deletions(-) diff --git a/BUILD b/BUILD index 4c2aef5..d93719c 100644 --- a/BUILD +++ b/BUILD @@ -7,7 +7,7 @@ filegroup( srcs = glob([ "include/**/*.h", ]) + [ - "//third_party/fruit/configuration/bazel:fruit_config", + "//third_party/fruit/configuration/bazel:fruit-config-base", ], ) @@ -16,11 +16,12 @@ cc_library( srcs = glob([ "src/*.cpp", "include/fruit/impl/**/*.h", - ]) + ["//third_party/fruit/configuration/bazel:fruit_config"], + ]), hdrs = glob(["include/fruit/*.h"]), includes = ["include", "configuration/bazel"], deps = [ "@boost//:unordered", + "//third_party/fruit/configuration/bazel:fruit-config-base", ], linkopts = ["-lm"], ) diff --git a/configuration/bazel/BUILD b/configuration/bazel/BUILD index 112b732..a207462 100644 --- a/configuration/bazel/BUILD +++ b/configuration/bazel/BUILD @@ -3,6 +3,6 @@ load("//third_party/fruit/configuration/bazel:build_defs.bzl", "generate_fruit_c package(default_visibility = ["//third_party/fruit:__subpackages__"]) generate_fruit_config( - name = "fruit_config", + name = "fruit-config-base", check_sources = glob(["*.cpp"]) ) diff --git a/configuration/bazel/build_defs.bzl b/configuration/bazel/build_defs.bzl index 8d683c4..28c3b17 100644 --- a/configuration/bazel/build_defs.bzl +++ b/configuration/bazel/build_defs.bzl @@ -17,7 +17,9 @@ def _generate_fruit_config_impl(ctx): check_output_files = [] for check_source in ctx.files.check_sources: - output_file = ctx.actions.declare_file(check_source.path + ".o") + check_name = check_source.path[:-len(".cpp")].split('/')[-1].split('\\')[-1] + + output_file = ctx.actions.declare_file(check_name + ".o") c_compile_variables = cc_common.create_compile_variables( feature_configuration = feature_configuration, @@ -37,9 +39,8 @@ def _generate_fruit_config_impl(ctx): variables = c_compile_variables, ) - check_name = check_source.path.split('/')[-1].split('\\')[-1] check_define = 'FRUIT_HAS_%s' % check_name.upper() - check_output_file = ctx.actions.declare_file(check_source.path + ".h") + check_output_file = ctx.actions.declare_file(check_name + ".h") ctx.actions.run_shell( command = '"$@" &>/dev/null && echo "#define %s 1" >"%s" || echo "#define %s 0" >"%s"; touch "%s"' % ( @@ -55,7 +56,7 @@ def _generate_fruit_config_impl(ctx): ) check_output_files.append(check_output_file) - merged_output_file = ctx.actions.declare_file(ctx.label.name + ".h") + merged_output_file = ctx.actions.declare_file("fruit/impl/fruit-config-base.h") ctx.actions.run_shell( command = '\n'.join([ '(', @@ -70,8 +71,25 @@ def _generate_fruit_config_impl(ctx): outputs = [merged_output_file], ) + compilation_context, compilation_outputs = cc_common.compile( + actions = ctx.actions, + feature_configuration = feature_configuration, + cc_toolchain = cc_toolchain, + public_hdrs = [merged_output_file], + name = "%s_link" % ctx.label.name, + ) + + linking_context, linking_outputs = cc_common.create_linking_context_from_compilation_outputs( + actions = ctx.actions, + feature_configuration = feature_configuration, + compilation_outputs = compilation_outputs, + cc_toolchain = cc_toolchain, + name = "%s_link" % ctx.label.name, + ) + return [ - DefaultInfo(files = depset([merged_output_file])), + DefaultInfo(files = depset([merged_output_file]), runfiles = ctx.runfiles(files = [merged_output_file])), + CcInfo(compilation_context=compilation_context, linking_context=linking_context), ] generate_fruit_config = rule( diff --git a/tests/BUILD b/tests/BUILD index b7ff089..e89f144 100644 --- a/tests/BUILD +++ b/tests/BUILD @@ -69,7 +69,6 @@ genrule( ], visibility = ["//third_party/fruit/tests:__subpackages__"], cmd = "" - + "FRUIT_HEADERS_LOCATION=`for f in $(locations //third_party/fruit:fruit_headers); do echo \"$$f\"; done | fgrep configuration/bazel/ | head -n 1 | sed 's|configuration/bazel/.*|./|'`;" + "TEST_HEADERS_LOCATION=`for f in $(locations :test_headers_filegroup); do echo \"$$f\"; done | fgrep test_macros.h | sed 's|test_macros.h|./|'`;" + "LIBFRUIT_LOCATION=`for f in $(locations //third_party/fruit); do echo \"$$f\"; done | fgrep libfruit.so | head -n 1 | sed 's|libfruit.so|./|'`;" + "LIBTEST_HEADERS_LOCATION=`for f in $(locations //third_party/fruit/tests:test_headers); do echo \"$$f\"; done | fgrep libtest_headers.so | head -n 1 | sed 's|libtest_headers.so|./|'`;" @@ -86,8 +85,8 @@ genrule( + "PATH_TO_COMPILED_FRUIT_LIB='third_party/fruit/tests'\n" + "PATH_TO_COMPILED_TEST_HEADERS='third_party/fruit/tests/test_headers'\n" + "PATH_TO_COMPILED_TEST_HEADERS_LIB='third_party/fruit/tests/test_headers'\n" - + "PATH_TO_FRUIT_STATIC_HEADERS='$${FRUIT_HEADERS_LOCATION}/include'\n" - + "PATH_TO_FRUIT_GENERATED_HEADERS='$${FRUIT_HEADERS_LOCATION}/configuration/bazel'\n" + + "PATH_TO_FRUIT_STATIC_HEADERS='third_party/fruit/include'\n" + + "PATH_TO_FRUIT_GENERATED_HEADERS='third_party/fruit/configuration/bazel'\n" + "PATH_TO_FRUIT_TEST_HEADERS='$${TEST_HEADERS_LOCATION}'\n" + "ADDITIONAL_LINKER_FLAGS='-lstdc++ -lm'\n" + "RUN_TESTS_UNDER_VALGRIND='0'\n" -- cgit v1.2.3 From 928458857f4b85a0016c2d724486343b4660cb46 Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sun, 20 Sep 2020 12:04:41 -0700 Subject: Support non-assignable (but movable) types in factory arguments when using registerFactory. --- include/fruit/impl/component_functors.defn.h | 8 +-- tests/test_register_factory.py | 73 ++++++++++++++++++++++++++++ 2 files changed, 77 insertions(+), 4 deletions(-) diff --git a/include/fruit/impl/component_functors.defn.h b/include/fruit/impl/component_functors.defn.h index 83ef385..e6778b1 100644 --- a/include/fruit/impl/component_functors.defn.h +++ b/include/fruit/impl/component_functors.defn.h @@ -402,7 +402,7 @@ template struct GetAssistedArg> { template inline Arg operator()(InjectedArgsTuple&, UserProvidedArgsTuple& user_provided_args) { - return std::get(user_provided_args); + return std::move(std::get(user_provided_args)); } }; @@ -437,9 +437,9 @@ struct RegisterFactoryHelper { using Result = Eval; void operator()(FixedSizeVector& entries) { auto function_provider = [](NakedInjectedArgs... args) { - auto injected_args = std::make_tuple(args...); - auto object_provider = [injected_args](NakedUserProvidedArgs... params) mutable { - auto user_provided_args = std::tie(params...); + std::tuple injected_args{args...}; + auto object_provider = [=](NakedUserProvidedArgs... params) mutable { + std::tuple user_provided_args{std::move(params)...}; // These are unused if they are 0-arg tuples. Silence the unused-variable warnings anyway. (void)injected_args; (void)user_provided_args; diff --git a/tests/test_register_factory.py b/tests/test_register_factory.py index 202d18b..8f62946 100755 --- a/tests/test_register_factory.py +++ b/tests/test_register_factory.py @@ -2005,6 +2005,79 @@ class TestRegisterFactory(parameterized.TestCase): source, locals()) + @multiple_parameters([ + ('X()', 'X'), + ('std::unique_ptr(new X())', 'std::unique_ptr'), + ], [ + 'WithNoAnnotation', + 'WithAnnotation1', + ]) + def test_register_factory_with_non_assignable_injected_param_success(self, ConstructX, XPtr, WithAnnot): + source = ''' + struct Y { + Y(const Y&) = delete; + Y& operator=(const Y&) = delete; + + Y() = default; + Y(Y&&) = default; + Y& operator=(Y&&) = default; + }; + struct X {}; + + fruit::Component> getYComponent() { + return fruit::createComponent() + .registerConstructor()>(); + } + + fruit::Component> getComponent() { + return fruit::createComponent() + .install(getYComponent) + .registerFactory)>([](Y&){ return ConstructX; }); + } + + int main() { + fruit::Injector> injector(getComponent); + XPtr x = injector.get>()(); + (void) x; + } + ''' + expect_success( + COMMON_DEFINITIONS, + source, + locals()) + + @multiple_parameters([ + ('X()', 'X'), + ('std::unique_ptr(new X())', 'std::unique_ptr'), + ]) + def test_register_factory_with_non_assignable_assisted_param_success(self, ConstructX, XPtr): + source = ''' + struct Y { + Y(const Y&) = delete; + Y& operator=(const Y&) = delete; + + Y() = default; + Y(Y&&) = default; + Y& operator=(Y&&) = default; + }; + struct X {}; + + fruit::Component> getComponent() { + return fruit::createComponent() + .registerFactory)>([](Y){ return ConstructX; }); + } + + int main() { + fruit::Injector> injector(getComponent); + XPtr x = injector.get>()(Y()); + (void) x; + } + ''' + expect_success( + COMMON_DEFINITIONS, + source, + locals()) + def test_register_factory_requiring_nonconst_then_requiring_const_ok(self): source = ''' struct X {}; -- cgit v1.2.3 From 125c4038df524c6e2fd802208b7119b27518bc26 Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sat, 24 Oct 2020 09:06:54 -0700 Subject: Add a pair of parentheses so that a use of a "max" function in Fruit don't get expanded by a macro on Windows. See https://github.com/google/fruit/issues/127. --- include/fruit/impl/data_structures/semistatic_map.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/fruit/impl/data_structures/semistatic_map.h b/include/fruit/impl/data_structures/semistatic_map.h index c5b4eb4..1ccb00a 100644 --- a/include/fruit/impl/data_structures/semistatic_map.h +++ b/include/fruit/impl/data_structures/semistatic_map.h @@ -46,8 +46,10 @@ private: static constexpr unsigned char beta = 4; + // The parentheses around std::numeric_limits::max are needed to workaround an issue in Windows where + // max is defined as a macro by a common system header. See https://github.com/google/fruit/issues/127. static_assert( - std::numeric_limits::max() >= sizeof(Unsigned) * CHAR_BIT, + (std::numeric_limits::max)() >= sizeof(Unsigned) * CHAR_BIT, "An unsigned char is not enough to contain the number of bits in your platform. Please report this issue."); struct HashFunction { -- cgit v1.2.3 From 3f46108f2a549ec9171c0fbac113d2d2e6c8d185 Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sat, 31 Oct 2020 14:17:12 -0700 Subject: Test against Ubuntu 20.10 and Clang 11 (too) in CI tests. --- .travis.yml | 103 ++++++++++++++++++++++----------- extras/scripts/postsubmit-helper.sh | 9 ++- extras/scripts/travis_yml_generator.py | 11 ++-- 3 files changed, 83 insertions(+), 40 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2b7f4b8..50045e3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,17 +10,38 @@ matrix: fast_finish: true include: - compiler: gcc - env: COMPILER=gcc-10 UBUNTU=20.04 TEST=ReleasePlain - install: export OS=linux; export COMPILER='gcc-10'; export UBUNTU='20.04'; extras/scripts/travis_ci_install_linux.sh + env: COMPILER=gcc-10 UBUNTU=20.10 TEST=ReleasePlain + install: export OS=linux; export COMPILER='gcc-10'; export UBUNTU='20.10'; extras/scripts/travis_ci_install_linux.sh os: linux - script: export OS=linux; export COMPILER='gcc-10'; export UBUNTU='20.04'; extras/scripts/postsubmit.sh + script: export OS=linux; export COMPILER='gcc-10'; export UBUNTU='20.10'; extras/scripts/postsubmit.sh ReleasePlain - compiler: gcc - env: COMPILER=gcc-10 UBUNTU=20.04 TEST=DebugPlain - install: export OS=linux; export COMPILER='gcc-10'; export UBUNTU='20.04'; extras/scripts/travis_ci_install_linux.sh + env: COMPILER=gcc-10 UBUNTU=20.10 TEST=DebugPlain + install: export OS=linux; export COMPILER='gcc-10'; export UBUNTU='20.10'; extras/scripts/travis_ci_install_linux.sh os: linux - script: export OS=linux; export COMPILER='gcc-10'; export UBUNTU='20.04'; extras/scripts/postsubmit.sh + script: export OS=linux; export COMPILER='gcc-10'; export UBUNTU='20.10'; extras/scripts/postsubmit.sh DebugPlain + - compiler: clang + env: COMPILER=clang-8.0 STL=libstdc++ UBUNTU=20.10 TEST=ReleasePlain + install: export OS=linux; export COMPILER='clang-8.0'; export STL='libstdc++'; + export UBUNTU='20.10'; extras/scripts/travis_ci_install_linux.sh + os: linux + script: export OS=linux; export COMPILER='clang-8.0'; export STL='libstdc++'; + export UBUNTU='20.10'; extras/scripts/postsubmit.sh ReleasePlain + - compiler: clang + env: COMPILER=clang-8.0 STL=libstdc++ UBUNTU=20.10 TEST=DebugAsanUbsan + install: export OS=linux; export COMPILER='clang-8.0'; export STL='libstdc++'; + export UBUNTU='20.10'; extras/scripts/travis_ci_install_linux.sh + os: linux + script: export OS=linux; export COMPILER='clang-8.0'; export STL='libstdc++'; + export UBUNTU='20.10'; extras/scripts/postsubmit.sh DebugAsanUbsan + - compiler: clang + env: COMPILER=clang-8.0 STL=libstdc++ UBUNTU=20.10 TEST=DebugPlain + install: export OS=linux; export COMPILER='clang-8.0'; export STL='libstdc++'; + export UBUNTU='20.10'; extras/scripts/travis_ci_install_linux.sh + os: linux + script: export OS=linux; export COMPILER='clang-8.0'; export STL='libstdc++'; + export UBUNTU='20.10'; extras/scripts/postsubmit.sh DebugPlain - compiler: clang env: COMPILER=clang-6.0 STL=libstdc++ UBUNTU=20.04 TEST=ReleasePlain install: export OS=linux; export COMPILER='clang-6.0'; export STL='libstdc++'; @@ -49,51 +70,63 @@ matrix: script: export OS=linux; export COMPILER='bazel'; export UBUNTU='18.04'; extras/scripts/postsubmit.sh DebugPlain - compiler: gcc - env: COMPILER=gcc-7 UBUNTU=20.04 TEST=ReleasePlain - install: export OS=linux; export COMPILER='gcc-7'; export UBUNTU='20.04'; extras/scripts/travis_ci_install_linux.sh + env: COMPILER=gcc-7 UBUNTU=20.10 TEST=ReleasePlain + install: export OS=linux; export COMPILER='gcc-7'; export UBUNTU='20.10'; extras/scripts/travis_ci_install_linux.sh os: linux - script: export OS=linux; export COMPILER='gcc-7'; export UBUNTU='20.04'; extras/scripts/postsubmit.sh + script: export OS=linux; export COMPILER='gcc-7'; export UBUNTU='20.10'; extras/scripts/postsubmit.sh ReleasePlain - compiler: gcc - env: COMPILER=gcc-7 UBUNTU=20.04 TEST=DebugAsanUbsan - install: export OS=linux; export COMPILER='gcc-7'; export UBUNTU='20.04'; extras/scripts/travis_ci_install_linux.sh + env: COMPILER=gcc-7 UBUNTU=20.10 TEST=DebugAsanUbsan + install: export OS=linux; export COMPILER='gcc-7'; export UBUNTU='20.10'; extras/scripts/travis_ci_install_linux.sh os: linux - script: export OS=linux; export COMPILER='gcc-7'; export UBUNTU='20.04'; extras/scripts/postsubmit.sh + script: export OS=linux; export COMPILER='gcc-7'; export UBUNTU='20.10'; extras/scripts/postsubmit.sh DebugAsanUbsan - compiler: gcc - env: COMPILER=gcc-10 UBUNTU=20.04 TEST=DebugAsanUbsan - install: export OS=linux; export COMPILER='gcc-10'; export UBUNTU='20.04'; extras/scripts/travis_ci_install_linux.sh + env: COMPILER=gcc-10 UBUNTU=20.10 TEST=DebugAsanUbsan + install: export OS=linux; export COMPILER='gcc-10'; export UBUNTU='20.10'; extras/scripts/travis_ci_install_linux.sh os: linux - script: export OS=linux; export COMPILER='gcc-10'; export UBUNTU='20.04'; extras/scripts/postsubmit.sh + script: export OS=linux; export COMPILER='gcc-10'; export UBUNTU='20.10'; extras/scripts/postsubmit.sh DebugAsanUbsan - compiler: clang - env: COMPILER=clang-10.0 STL=libstdc++ UBUNTU=20.04 TEST=ReleasePlain - install: export OS=linux; export COMPILER='clang-10.0'; export STL='libstdc++'; - export UBUNTU='20.04'; extras/scripts/travis_ci_install_linux.sh + env: COMPILER=clang-11.0 STL=libstdc++ UBUNTU=20.10 TEST=ReleasePlain + install: export OS=linux; export COMPILER='clang-11.0'; export STL='libstdc++'; + export UBUNTU='20.10'; extras/scripts/travis_ci_install_linux.sh os: linux - script: export OS=linux; export COMPILER='clang-10.0'; export STL='libstdc++'; - export UBUNTU='20.04'; extras/scripts/postsubmit.sh ReleasePlain + script: export OS=linux; export COMPILER='clang-11.0'; export STL='libstdc++'; + export UBUNTU='20.10'; extras/scripts/postsubmit.sh ReleasePlain - compiler: clang - env: COMPILER=clang-10.0 STL=libstdc++ UBUNTU=20.04 TEST=DebugAsanUbsan - install: export OS=linux; export COMPILER='clang-10.0'; export STL='libstdc++'; - export UBUNTU='20.04'; extras/scripts/travis_ci_install_linux.sh + env: COMPILER=clang-11.0 STL=libstdc++ UBUNTU=20.10 TEST=DebugAsanUbsan + install: export OS=linux; export COMPILER='clang-11.0'; export STL='libstdc++'; + export UBUNTU='20.10'; extras/scripts/travis_ci_install_linux.sh os: linux - script: export OS=linux; export COMPILER='clang-10.0'; export STL='libstdc++'; - export UBUNTU='20.04'; extras/scripts/postsubmit.sh DebugAsanUbsan + script: export OS=linux; export COMPILER='clang-11.0'; export STL='libstdc++'; + export UBUNTU='20.10'; extras/scripts/postsubmit.sh DebugAsanUbsan - compiler: clang - env: COMPILER=clang-10.0 STL=libc++ UBUNTU=20.04 TEST=ReleasePlain - install: export OS=linux; export COMPILER='clang-10.0'; export STL='libc++'; export - UBUNTU='20.04'; extras/scripts/travis_ci_install_linux.sh + env: COMPILER=clang-11.0 STL=libc++ UBUNTU=20.10 TEST=ReleasePlain + install: export OS=linux; export COMPILER='clang-11.0'; export STL='libc++'; export + UBUNTU='20.10'; extras/scripts/travis_ci_install_linux.sh os: linux - script: export OS=linux; export COMPILER='clang-10.0'; export STL='libc++'; export - UBUNTU='20.04'; extras/scripts/postsubmit.sh ReleasePlain + script: export OS=linux; export COMPILER='clang-11.0'; export STL='libc++'; export + UBUNTU='20.10'; extras/scripts/postsubmit.sh ReleasePlain - compiler: clang - env: COMPILER=clang-10.0 STL=libc++ UBUNTU=20.04 TEST=DebugAsanUbsan - install: export OS=linux; export COMPILER='clang-10.0'; export STL='libc++'; export - UBUNTU='20.04'; extras/scripts/travis_ci_install_linux.sh + env: COMPILER=clang-11.0 STL=libc++ UBUNTU=20.10 TEST=DebugAsanUbsan + install: export OS=linux; export COMPILER='clang-11.0'; export STL='libc++'; export + UBUNTU='20.10'; extras/scripts/travis_ci_install_linux.sh + os: linux + script: export OS=linux; export COMPILER='clang-11.0'; export STL='libc++'; export + UBUNTU='20.10'; extras/scripts/postsubmit.sh DebugAsanUbsan + - compiler: gcc + env: COMPILER=gcc-7 UBUNTU=20.04 TEST=ReleasePlain + install: export OS=linux; export COMPILER='gcc-7'; export UBUNTU='20.04'; extras/scripts/travis_ci_install_linux.sh + os: linux + script: export OS=linux; export COMPILER='gcc-7'; export UBUNTU='20.04'; extras/scripts/postsubmit.sh + ReleasePlain + - compiler: gcc + env: COMPILER=gcc-7 UBUNTU=20.04 TEST=DebugAsanUbsan + install: export OS=linux; export COMPILER='gcc-7'; export UBUNTU='20.04'; extras/scripts/travis_ci_install_linux.sh os: linux - script: export OS=linux; export COMPILER='clang-10.0'; export STL='libc++'; export - UBUNTU='20.04'; extras/scripts/postsubmit.sh DebugAsanUbsan + script: export OS=linux; export COMPILER='gcc-7'; export UBUNTU='20.04'; extras/scripts/postsubmit.sh + DebugAsanUbsan - compiler: gcc env: COMPILER=gcc-5 UBUNTU=18.04 TEST=ReleasePlain install: export OS=linux; export COMPILER='gcc-5'; export UBUNTU='18.04'; extras/scripts/travis_ci_install_linux.sh diff --git a/extras/scripts/postsubmit-helper.sh b/extras/scripts/postsubmit-helper.sh index 7be3b88..ca0aaba 100755 --- a/extras/scripts/postsubmit-helper.sh +++ b/extras/scripts/postsubmit-helper.sh @@ -102,6 +102,11 @@ clang-10.0) export CXX=clang++-10 ;; +clang-11.0) + export CC=clang-11 + export CXX=clang++-11 + ;; + clang-default) export CC=clang export CXX=clang++ @@ -123,7 +128,9 @@ if [[ "${COMPILER}" != "bazel" ]] then # This is only needed in OS X but it has no effect on Linux so we can add it unconditionally. BOOST_INCLUDE_FLAG="-I /usr/local/include/boost -I /usr/local/include" - COMMON_CXX_FLAGS="$STLARG $BOOST_INCLUDE_FLAG -Werror -pedantic -Winvalid-pch" + # -Wdtor-name (part of -pedantic) is *very* pedantic. Following that results in weird-looking code. + # See https://bugs.llvm.org/show_bug.cgi?id=46979. + COMMON_CXX_FLAGS="$STLARG $BOOST_INCLUDE_FLAG -Werror -pedantic -Wno-dtor-name -Winvalid-pch" echo CXX version: $($CXX --version) echo C++ Standard library location: $(echo '#include ' | $CXX -x c++ -E - | grep 'vector\"' | awk '{print $3}' | sed 's@/vector@@;s@\"@@g' | head -n 1) diff --git a/extras/scripts/travis_yml_generator.py b/extras/scripts/travis_yml_generator.py index 93a5a1b..46c5a92 100755 --- a/extras/scripts/travis_yml_generator.py +++ b/extras/scripts/travis_yml_generator.py @@ -144,14 +144,17 @@ def add_bazel_tests(ubuntu_version, smoke_tests=[]): else: build_matrix_rows.append(test_environment) +add_ubuntu_tests(ubuntu_version='20.10', compiler='gcc-7') +add_ubuntu_tests(ubuntu_version='20.10', compiler='gcc-10', + smoke_tests=['DebugPlain', 'ReleasePlain']) +add_ubuntu_tests(ubuntu_version='20.10', compiler='clang-8.0', stl='libstdc++', + smoke_tests=['DebugPlain', 'DebugAsanUbsan', 'ReleasePlain']) +add_ubuntu_tests(ubuntu_version='20.10', compiler='clang-11.0', stl='libstdc++') +add_ubuntu_tests(ubuntu_version='20.10', compiler='clang-11.0', stl='libc++') add_ubuntu_tests(ubuntu_version='20.04', compiler='gcc-7') -add_ubuntu_tests(ubuntu_version='20.04', compiler='gcc-10', - smoke_tests=['DebugPlain', 'ReleasePlain']) add_ubuntu_tests(ubuntu_version='20.04', compiler='clang-6.0', stl='libstdc++', smoke_tests=['DebugPlain', 'DebugAsanUbsan', 'ReleasePlain']) -add_ubuntu_tests(ubuntu_version='20.04', compiler='clang-10.0', stl='libstdc++') -add_ubuntu_tests(ubuntu_version='20.04', compiler='clang-10.0', stl='libc++') add_ubuntu_tests(ubuntu_version='18.04', compiler='gcc-5', asan=False, ubsan=False) add_ubuntu_tests(ubuntu_version='18.04', compiler='gcc-8', asan=False, ubsan=False) -- cgit v1.2.3 From 39d127dee2fe8d579d778667424cfbb89044875d Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sat, 31 Oct 2020 14:17:37 -0700 Subject: Add docker configuration for testing against Ubuntu 20.10. --- extras/dockerfiles/Dockerfile.ubuntu-20.10 | 40 +++++++++++++++++++++++++++++ extras/dockerfiles/rebuild_all.sh | 2 +- extras/dockerfiles/ubuntu-20.10_custom.list | 4 +++ 3 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 extras/dockerfiles/Dockerfile.ubuntu-20.10 create mode 100644 extras/dockerfiles/ubuntu-20.10_custom.list diff --git a/extras/dockerfiles/Dockerfile.ubuntu-20.10 b/extras/dockerfiles/Dockerfile.ubuntu-20.10 new file mode 100644 index 0000000..6b4e52c --- /dev/null +++ b/extras/dockerfiles/Dockerfile.ubuntu-20.10 @@ -0,0 +1,40 @@ +FROM ubuntu:20.10 +MAINTAINER Marco Poletti + +COPY common_install.sh common_cleanup.sh / + +RUN bash -x /common_install.sh + +COPY ubuntu-20.10_custom.list /etc/apt/sources.list.d/ + +RUN apt-get update + +RUN apt-get remove -y python3-pip +RUN python3 -m easy_install pip + +RUN apt-get install -y --allow-unauthenticated --no-install-recommends \ + g++-7 \ + g++-8 \ + g++-9 \ + g++-10 \ + clang-8 \ + clang-9 \ + clang-10 \ + clang-11 \ + python3.8 \ + python3.8-distutils \ + clang-tidy \ + clang-format + +RUN python3.8 -m easy_install pip + +RUN pip3 install absl-py +RUN pip3 install bidict +RUN pip3 install pytest +RUN pip3 install pytest-xdist +RUN pip3 install sh +RUN pip3 install setuptools +RUN pip3 install networkx +RUN pip3 install wheel + +RUN bash -x /common_cleanup.sh diff --git a/extras/dockerfiles/rebuild_all.sh b/extras/dockerfiles/rebuild_all.sh index 77153aa..f0e23d2 100755 --- a/extras/dockerfiles/rebuild_all.sh +++ b/extras/dockerfiles/rebuild_all.sh @@ -7,7 +7,7 @@ docker run --rm --privileged multiarch/qemu-user-static:register --reset COMMANDS=() -for V in 18.04 19.10 20.04 +for V in 18.04 19.10 20.04 20.10 do C="docker build --squash -t polettimarco/fruit-basesystem:ubuntu-$V -f Dockerfile.ubuntu-$V ." COMMANDS+=("$C || { echo; echo FAILED: '$C'; echo; exit 1; }") diff --git a/extras/dockerfiles/ubuntu-20.10_custom.list b/extras/dockerfiles/ubuntu-20.10_custom.list new file mode 100644 index 0000000..c26e2d9 --- /dev/null +++ b/extras/dockerfiles/ubuntu-20.10_custom.list @@ -0,0 +1,4 @@ +deb http://apt.llvm.org/focal/ llvm-toolchain-focal-9 main +deb-src http://apt.llvm.org/focal/ llvm-toolchain-focal-9 main +deb http://apt.llvm.org/focal/ llvm-toolchain-focal-10 main +deb-src http://apt.llvm.org/focal/ llvm-toolchain-focal-10 main -- cgit v1.2.3 From 70f7c06e305ad7c9e4e99b87672aaa1061d914d6 Mon Sep 17 00:00:00 2001 From: Marco Poletti Date: Sun, 1 Nov 2020 09:52:49 -0800 Subject: Also pass -Wno-unknown-warning-option in CI tests because only very recent versions of Clang have -Wno-dtor-name, otherwise the CI tests fail with older Clang versions. --- extras/scripts/postsubmit-helper.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/scripts/postsubmit-helper.sh b/extras/scripts/postsubmit-helper.sh index ca0aaba..eecd3c0 100755 --- a/extras/scripts/postsubmit-helper.sh +++ b/extras/scripts/postsubmit-helper.sh @@ -130,7 +130,7 @@ then BOOST_INCLUDE_FLAG="-I /usr/local/include/boost -I /usr/local/include" # -Wdtor-name (part of -pedantic) is *very* pedantic. Following that results in weird-looking code. # See https://bugs.llvm.org/show_bug.cgi?id=46979. - COMMON_CXX_FLAGS="$STLARG $BOOST_INCLUDE_FLAG -Werror -pedantic -Wno-dtor-name -Winvalid-pch" + COMMON_CXX_FLAGS="$STLARG $BOOST_INCLUDE_FLAG -Werror -pedantic -Wno-unknown-warning-option -Wno-dtor-name -Winvalid-pch" echo CXX version: $($CXX --version) echo C++ Standard library location: $(echo '#include ' | $CXX -x c++ -E - | grep 'vector\"' | awk '{print $3}' | sed 's@/vector@@;s@\"@@g' | head -n 1) -- cgit v1.2.3 From d2effc70f0e3df4ba9b4a228f14c7195acce9f73 Mon Sep 17 00:00:00 2001 From: Bob Badour Date: Fri, 12 Feb 2021 21:28:40 -0800 Subject: [LSC] Add LOCAL_LICENSE_KINDS to external/google-fruit Added SPDX-license-identifier-Apache-2.0 to: Android.bp Bug: 68860345 Bug: 151177513 Bug: 151953481 Test: m all Exempt-From-Owner-Approval: janitorial work Change-Id: I730a537e63d57bdd836755aa0bd78d4491f0c417 --- Android.bp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/Android.bp b/Android.bp index 9907842..aad4a60 100644 --- a/Android.bp +++ b/Android.bp @@ -14,6 +14,29 @@ // Simply '#include ' to get started. // See https://github.com/google/fruit/wiki for more details. +package { + default_applicable_licenses: ["external_google-fruit_license"], +} + +// Added automatically by a large-scale-change +// +// large-scale-change included anything that looked like it might be a license +// text as a license_text. e.g. LICENSE, NOTICE, COPYING etc. +// +// Please consider removing redundant or irrelevant files from 'license_text:'. +// See: http://go/android-license-faq +license { + name: "external_google-fruit_license", + visibility: [":__subpackages__"], + license_kinds: [ + "SPDX-license-identifier-Apache-2.0", + ], + license_text: [ + "COPYING", + "LICENSE", + ], +} + cc_library { name: "libfruit", host_supported: true, -- cgit v1.2.3 From 982e10c7fea57e34173b979029635cf450fe8433 Mon Sep 17 00:00:00 2001 From: "A. Cody Schuffelen" Date: Tue, 23 Mar 2021 21:39:43 -0700 Subject: Add vendor_available and apex_available to libfruit. This allows libfruit to be used by cuttlefish vm manager code. Test: m -j Change-Id: Ifee1815cff198e8910e6863618f4324d2845f28c --- Android.bp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Android.bp b/Android.bp index aad4a60..444c19c 100644 --- a/Android.bp +++ b/Android.bp @@ -40,8 +40,13 @@ license { cc_library { name: "libfruit", host_supported: true, + vendor_available: true, export_include_dirs: ["include", "configuration/android"], srcs: ["src/**/*.cpp", ], + apex_available: [ + "//apex_available:platform", + "//apex_available:anyapex", + ], } // TODO: tests written in python+pytest that calls back into compiler. unclear how to best proceed. -- cgit v1.2.3