Merge "Upgrade google-fruit to 0cecdd8a5155f3e2ba4871f1792bd1ac641aa62a"
diff --git a/.travis.yml b/.travis.yml
index 9e1c79f..ca75228 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -48,20 +48,6 @@
     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++';
-      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++';
@@ -197,24 +183,30 @@
     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 ReleasePlain
-  - 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
+    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='clang-4.0'; export STL='libc++'; extras/scripts/postsubmit.sh
+    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
+    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-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
@@ -242,22 +234,6 @@
     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
     script: export OS=osx; export COMPILER='clang-default'; export STL='libc++'; extras/scripts/postsubmit.sh
       ReleasePlain
@@ -274,22 +250,6 @@
     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++';
-      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
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 20e5ba0..1219c6a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,5 +1,6 @@
-project(Fruit)
-cmake_minimum_required(VERSION 2.8)
+cmake_minimum_required(VERSION 3.2)
+
+project(Fruit VERSION 3.4.0 LANGUAGES CXX)
 
 if (POLICY CMP0054)
     cmake_policy(SET CMP0054 NEW)
@@ -17,10 +18,6 @@
 # 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,34 +91,29 @@
 # 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")
-
-set(FRUIT_VERSION "3.4.0")
+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)
+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)
 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")
 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/METADATA b/METADATA
index 2b61d1b..39e307b 100644
--- a/METADATA
+++ b/METADATA
@@ -9,11 +9,11 @@
     type: GIT
     value: "https://github.com/google/fruit.git"
   }
-  version: "bb1fc3b3abe3eda0f093fb1d45f9be96c6af6366"
+  version: "0cecdd8a5155f3e2ba4871f1792bd1ac641aa62a"
   license_type: NOTICE
   last_upgrade_date {
-    year: 2019
-    month: 9
-    day: 3
+    year: 2020
+    month: 3
+    day: 2
   }
 }
diff --git a/conanfile.py b/conanfile.py
index 46bd1ce..cff46a5 100644
--- a/conanfile.py
+++ b/conanfile.py
@@ -76,5 +76,4 @@
                   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)
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 @@
 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/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.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 @@
 
 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 <poletti.marco@gmail.com>
 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 <poletti.marco@gmail.com>
 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 378abe5..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
@@ -47,8 +47,8 @@
 %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/extras/scripts/postsubmit-helper.sh b/extras/scripts/postsubmit-helper.sh
index 36169bb..2d5d44b 100755
--- a/extras/scripts/postsubmit-helper.sh
+++ b/extras/scripts/postsubmit-helper.sh
@@ -87,6 +87,11 @@
     export CXX=clang++-8
     ;;
 
+clang-9.0)
+    export CC=clang-9
+    export CXX=clang++-9
+    ;;
+
 clang-default)
     export CC=clang
     export CXX=clang++
@@ -107,8 +112,8 @@
 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"
+    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)
     echo C++ Standard library location: $(echo '#include <vector>' | $CXX -x c++ -E - | grep 'vector\"' | awk '{print $3}' | sed 's@/vector@@;s@\"@@g' | head -n 1)
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 @@
   msbuild ALL_BUILD.vcxproj || exit /b 1
 )
 
+pip3 install absl-py
 pip3 install pytest
 pip3 install pytest-xdist
 
diff --git a/extras/scripts/travis_ci_install_osx.sh b/extras/scripts/travis_ci_install_osx.sh
index 0bef2b1..bb877be 100755
--- a/extras/scripts/travis_ci_install_osx.sh
+++ b/extras/scripts/travis_ci_install_osx.sh
@@ -4,6 +4,8 @@
 
 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 --force "$@" || true)
 }
 
 # For md5sum, timeout
@@ -24,12 +26,23 @@
 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.0
+  ;;
+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
+  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
 
diff --git a/extras/scripts/travis_yml_generator.py b/extras/scripts/travis_yml_generator.py
index e2f5581..288232e 100755
--- a/extras/scripts/travis_yml_generator.py
+++ b/extras/scripts/travis_yml_generator.py
@@ -176,17 +176,17 @@
 #    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='clang-4.0', xcode_version='11.4', stl='libc++')
+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-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)
 
-# 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='10.3', stl='libc++', smoke_tests=['DebugPlain'])
 add_osx_tests(compiler='clang-default', xcode_version='11.4', stl='libc++', smoke_tests=['DebugPlain'])
 
 # ** Disabled combinations **
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 @@
 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}")
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index b5cbfdb..d543dca 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -106,4 +106,5 @@
 [pytest]
 testpaths = \"${CMAKE_CURRENT_SOURCE_DIR}\"
 addopts = -r a
+timeout = 300
 ")
diff --git a/tests/fruit_test_common.py b/tests/fruit_test_common.py
index 28ecc59..d4a1308 100644
--- a/tests/fruit_test_common.py
+++ b/tests/fruit_test_common.py
@@ -35,7 +35,7 @@
 
 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))
 
@@ -166,7 +166,7 @@
             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(