Kokoro: build and run rr::Print unit tests

After the normal build and unit tests run, incrementally build
ReactorUnitTests with REACTOR_ENABLE_PRINT enabled, and run only the
unit tests that exercise the print code. This should add very little
extra time to our Kokoro builds, while ensuring we don't break the
rr::Print stuff.

Bug: b/149328074
Change-Id: I26c0db727c8edd269243f17192020a3435893c14
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/41148
Presubmit-Ready: Antonio Maiorano <amaiorano@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Tested-by: Antonio Maiorano <amaiorano@google.com>
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 045df81..aaf2be0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -543,6 +543,13 @@
     endif()
 endif()
 
+if((${REACTOR_BACKEND} STREQUAL "Subzero") AND (REACTOR_ENABLE_PRINT OR REACTOR_EMIT_PRINT_LOCATION OR REACTOR_EMIT_DEBUG_INFO))
+    message(WARNING "REACTOR_ENABLE_PRINT, REACTOR_EMIT_PRINT_LOCATION, and REACTOR_EMIT_DEBUG_INFO are not supported by Subzero, disabling.")
+    set(REACTOR_ENABLE_PRINT "Off")
+    set(REACTOR_EMIT_PRINT_LOCATION "Off")
+    set(REACTOR_EMIT_DEBUG_INFO "Off")
+endif()
+
 if(REACTOR_EMIT_PRINT_LOCATION)
     # This feature depends on REACTOR_EMIT_DEBUG_INFO and REACTOR_ENABLE_PRINT
     set(REACTOR_EMIT_DEBUG_INFO "On")
diff --git a/tests/kokoro/gcp_ubuntu/continuous.sh b/tests/kokoro/gcp_ubuntu/continuous.sh
index 4877ba0..6dc5655 100755
--- a/tests/kokoro/gcp_ubuntu/continuous.sh
+++ b/tests/kokoro/gcp_ubuntu/continuous.sh
@@ -24,7 +24,7 @@
 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)
+cmake --build . -- -j $(nproc)
 
 # Run unit tests
 
@@ -32,4 +32,11 @@
 
 build/ReactorUnitTests
 build/gles-unittests
-build/vk-unittests
\ No newline at end of file
+build/vk-unittests
+
+# Incrementally build and run rr::Print unit tests
+cd build
+cmake .. "-DREACTOR_ENABLE_PRINT=1"
+cmake --build . --target ReactorUnitTests -- -j $(nproc)
+cd ..
+build/ReactorUnitTests --gtest_filter=ReactorUnitTests.Print*
diff --git a/tests/kokoro/gcp_windows/continuous.bat b/tests/kokoro/gcp_windows/continuous.bat
index 5219ee2..ecc238f 100644
--- a/tests/kokoro/gcp_windows/continuous.bat
+++ b/tests/kokoro/gcp_windows/continuous.bat
@@ -14,16 +14,13 @@
 # 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" "-DLESS_DEBUG_INFO=%LESS_DEBUG_INFO%"
 if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!
 
-%MSBUILD% /p:Configuration=%CONFIG% SwiftShader.sln
+cmake --build .
 if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!
 
 REM Run the unit tests. Some must be run from project root
@@ -38,4 +35,21 @@
 if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!
 
 build\Debug\vk-unittests.exe
-if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!
\ No newline at end of file
+if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!
+
+Rem Incrementally build and run rr::Print unit tests
+cd %SRC%\build
+if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!
+
+cmake "-DREACTOR_ENABLE_PRINT=1" ..
+if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!
+
+cmake --build . --target ReactorUnitTests
+if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!
+
+cd %SRC%
+if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!
+SET SWIFTSHADER_DISABLE_DEBUGGER_WAIT_DIALOG=1
+
+build\Debug\ReactorUnitTests.exe --gtest_filter=ReactorUnitTests.Print*
+if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!
diff --git a/tests/kokoro/macos/continuous.sh b/tests/kokoro/macos/continuous.sh
index 07c68d2..c99beed 100755
--- a/tests/kokoro/macos/continuous.sh
+++ b/tests/kokoro/macos/continuous.sh
@@ -26,7 +26,7 @@
 fi
 
 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)
+cmake --build . -- -j$(sysctl -n hw.logicalcpu)
 
 # Run unit tests
 
@@ -35,3 +35,10 @@
 build/ReactorUnitTests
 build/gles-unittests
 build/vk-unittests
+
+# Incrementally build and run rr::Print unit tests
+cd build
+cmake .. "-DREACTOR_ENABLE_PRINT=1"
+cmake --build . --target ReactorUnitTests -- -j$(sysctl -n hw.logicalcpu)
+cd ..
+build/ReactorUnitTests --gtest_filter=ReactorUnitTests.Print*