Produce less debug info in Kokoro builds
On a 4-core Linux VM it has the following effect:
LESS_DEBUG_INFO=0
real 20m13.051s
user 63m45.648s
sys 6m51.636s
745.8 MB libvk_swiftshader.so
13 GB build dir
LESS_DEBUG_INFO=1
real 15m2.821s
user 51m8.659s
sys 5m17.466s
197.8 MB libvk_swiftshader.so
3.1 GB build dir
Also use /DEBUG:FASTLINK on Visual Studio. It disables producing a
single .pdb which can be relocated.
Specifying LESS_DEBUG_INFO=1 has no effect on Windows currently, but is
done for consistency and in case we start using Clang on Windows.
Also color errors in presubmit consistently.
Bug: b/147735529
Change-Id: Ieb5c84c192178653f74043daf3d8ee599d3ecf6b
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/40228
Presubmit-Ready: Nicolas Capens <nicolascapens@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
diff --git a/CMakeLists.txt b/CMakeLists.txt
index dd7fdc4..2a4b400 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.6.3)
+cmake_minimum_required(VERSION 3.6.3)
set(CMAKE_CXX_STANDARD 14)
@@ -344,6 +344,9 @@
add_definitions(-D_SBCS) # Single Byte Character Set (ASCII)
add_definitions(-D_ENABLE_EXTENDED_ALIGNED_STORAGE) # Disable MSVC warnings about std::aligned_storage being broken before VS 2017 15.8
+ set_cpp_flag("/DEBUG:FASTLINK" DEBUG)
+ set_cpp_flag("/DEBUG:FASTLINK" RELWITHDEBINFO)
+
if(SWIFTSHADER_WARNINGS_AS_ERRORS)
set_cpp_flag("/WX") # Treat all warnings as errors
endif()
@@ -374,7 +377,6 @@
"/we4838" # conversion from 'type_1' to 'type_2' requires a narrowing conversion
"/we5038" # data member 'member1' will be initialized after data member 'member2' data member 'member' will be initialized after base class 'base_class'
)
-
else()
set_cpp_flag("-fno-exceptions")
diff --git a/tests/kokoro/gcp_ubuntu/continuous.sh b/tests/kokoro/gcp_ubuntu/continuous.sh
index 0d879ec..4877ba0 100755
--- a/tests/kokoro/gcp_ubuntu/continuous.sh
+++ b/tests/kokoro/gcp_ubuntu/continuous.sh
@@ -20,7 +20,10 @@
REACTOR_BACKEND="LLVM"
fi
-cmake .. "-DCMAKE_BUILD_TYPE=${BUILD_TYPE}" "-DREACTOR_BACKEND=${REACTOR_BACKEND}" "-DREACTOR_VERIFY_LLVM_IR=1"
+# Lower the amount of debug info, to reduce Kokoro build times.
+LESS_DEBUG_INFO=1
+
+cmake .. "-DCMAKE_BUILD_TYPE=${BUILD_TYPE}" "-DREACTOR_BACKEND=${REACTOR_BACKEND}" "-DREACTOR_VERIFY_LLVM_IR=1" "-DLESS_DEBUG_INFO=${LESS_DEBUG_INFO}"
make --jobs=$(nproc)
# Run unit tests
diff --git a/tests/kokoro/gcp_windows/continuous.bat b/tests/kokoro/gcp_windows/continuous.bat
index 401cec1..5219ee2 100644
--- a/tests/kokoro/gcp_windows/continuous.bat
+++ b/tests/kokoro/gcp_windows/continuous.bat
@@ -11,13 +11,16 @@
git submodule update --init
if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!
+# Lower the amount of debug info, to reduce Kokoro build times.
+SET LESS_DEBUG_INFO=1
+
SET MSBUILD="C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild"
SET CONFIG=Debug
cd %SRC%\build
if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!
-cmake .. -G "Visual Studio 15 2017 Win64" -Thost=x64 "-DCMAKE_BUILD_TYPE=%BUILD_TYPE%" "-DREACTOR_BACKEND=%REACTOR_BACKEND%" "-DREACTOR_VERIFY_LLVM_IR=1"
+cmake .. -G "Visual Studio 15 2017 Win64" -Thost=x64 "-DCMAKE_BUILD_TYPE=%BUILD_TYPE%" "-DREACTOR_BACKEND=%REACTOR_BACKEND%" "-DREACTOR_VERIFY_LLVM_IR=1" "-DLESS_DEBUG_INFO=%LESS_DEBUG_INFO%"
if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!
%MSBUILD% /p:Configuration=%CONFIG% SwiftShader.sln
diff --git a/tests/kokoro/macos/continuous.sh b/tests/kokoro/macos/continuous.sh
index 3b6a664..07c68d2 100755
--- a/tests/kokoro/macos/continuous.sh
+++ b/tests/kokoro/macos/continuous.sh
@@ -15,14 +15,17 @@
REACTOR_BACKEND="LLVM"
fi
-# Disable ASAN checks for debug builds to work around Kokoro timeouts that
-# affect llvm-debug builds. See b/147355576 for more information.
+# Lower the amount of debug info, to reduce Kokoro build times.
+LESS_DEBUG_INFO=1
+
+# Disable ASAN checks for debug builds, to reduce Kokoro build times.
+# ASAN builds are recommended to be optimized.
ASAN="ON"
if [[ "${BUILD_TYPE}" == "Debug" ]]; then
ASAN="OFF"
fi
-cmake .. "-DSWIFTSHADER_ASAN=${ASAN}" "-DCMAKE_BUILD_TYPE=${BUILD_TYPE}" "-DREACTOR_BACKEND=${REACTOR_BACKEND}" "-DREACTOR_VERIFY_LLVM_IR=1"
+cmake .. "-DSWIFTSHADER_ASAN=${ASAN}" "-DCMAKE_BUILD_TYPE=${BUILD_TYPE}" "-DREACTOR_BACKEND=${REACTOR_BACKEND}" "-DREACTOR_VERIFY_LLVM_IR=1" "-DLESS_DEBUG_INFO=${LESS_DEBUG_INFO}"
make -j$(sysctl -n hw.logicalcpu)
# Run unit tests
diff --git a/tests/presubmit.sh b/tests/presubmit.sh
index 4ba0d16..d0b4f6a 100755
--- a/tests/presubmit.sh
+++ b/tests/presubmit.sh
@@ -44,10 +44,10 @@
if [ $? -ne 0 ]
then
- echo "Git commit message must have a Bug: line"
+ echo "${red}Git commit message must have a Bug: line"
echo "followed by a bug ID in the form b/# for Buganizer bugs or"
echo "project:# for Monorail bugs (e.g. 'Bug: chromium:123')."
- echo "Omit any digits when no ID is required (e.g. 'Bug: fix build')."
+ echo "Omit any digits when no ID is required (e.g. 'Bug: fix build').${normal}"
return 1
fi
}
@@ -61,9 +61,10 @@
done | grep -v "(standard input)" > ${tmpfile}
if test -s ${tmpfile}; then
# tempfile is NOT empty
- echo "Copyright issue in these files:"
+ echo "${red}Copyright issue in these files:"
cat ${tmpfile}
rm ${tmpfile}
+ echo "${normal}"
return 1
else
rm ${tmpfile}
@@ -95,4 +96,4 @@
check gofmt run_gofmt
echo
-echo "${green}All check completed successfully.$normal"
+echo "${green}All check completed successfully.${normal}"