Kokoro: Test that the _other.cc files also build

Change-Id: I908b9250de839435c3b355fb89b0bb72ab821a54
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/48043
Auto-Submit: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
This commit is contained in:
Ben Clayton 2021-04-16 14:43:34 +00:00 committed by Commit Bot service account
parent fe70c75bc5
commit 7687ec1fa3
3 changed files with 19 additions and 11 deletions

View File

@ -50,6 +50,7 @@ option(TINT_BUILD_SPV_WRITER "Build the SPIR-V output writer" ON)
option(TINT_BUILD_WGSL_WRITER "Build the WGSL output writer" ON)
option(TINT_BUILD_FUZZERS "Build fuzzers" OFF)
option(TINT_BUILD_TESTS "Build tests" ${TINT_BUILD_TESTS_DEFAULT})
option(TINT_BUILD_AS_OTHER_OS "Override OS detection to force building of *_other.cc files" OFF)
option(TINT_ENABLE_MSAN "Enable memory sanitizer" OFF)
option(TINT_ENABLE_ASAN "Enable address sanitizer" OFF)
@ -108,6 +109,17 @@ if (MSVC AND NOT COMPILER_IS_CLANG_CL)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
endif()
set(TINT_OS_CC_SUFFIX "other")
if (NOT TINT_BUILD_AS_OTHER_OS)
if(UNIX OR APPLE)
set(TINT_OS_CC_SUFFIX "posix")
set(TINT_OS_CC_SUFFIX "posix")
elseif(WIN32)
set(TINT_OS_CC_SUFFIX "windows")
set(TINT_OS_CC_SUFFIX "windows")
endif()
endif()
if(${TINT_BUILD_DOCS})
find_package(Doxygen)
if(DOXYGEN_FOUND)

View File

@ -95,6 +95,11 @@ if [ "$BUILD_SYSTEM" == "cmake" ]; then
${SRC_DIR}/test/test-all.sh "${BUILD_DIR}/tint"
hide_cmds
status "Checking _other.cc files also build"
show_cmds
cmake ${SRC_DIR} ${CMAKE_FLAGS} ${COMMON_CMAKE_FLAGS} -DTINT_BUILD_AS_OTHER_OS=1
make --jobs=$(nproc)
hide_cmds
else
status "Unsupported build system: $BUILD_SYSTEM"
exit 1

View File

@ -519,11 +519,13 @@ if(${TINT_BUILD_TESTS})
type/type_manager_test.cc
type/u32_type_test.cc
type/vector_type_test.cc
utils/command_${TINT_OS_CC_SUFFIX}.cc
utils/command_test.cc
utils/command.h
utils/get_or_create_test.cc
utils/hash_test.cc
utils/math_test.cc
utils/tmpfile_${TINT_OS_CC_SUFFIX}.cc
utils/tmpfile_test.cc
utils/tmpfile.h
utils/unique_vector_test.cc
@ -531,17 +533,6 @@ if(${TINT_BUILD_TESTS})
writer/float_to_string_test.cc
)
if(UNIX OR APPLE)
list(APPEND TINT_TEST_SRCS utils/tmpfile_posix.cc)
list(APPEND TINT_TEST_SRCS utils/command_posix.cc)
elseif(WIN32)
list(APPEND TINT_TEST_SRCS utils/command_windows.cc)
list(APPEND TINT_TEST_SRCS utils/tmpfile_windows.cc)
else()
list(APPEND TINT_TEST_SRCS utils/command_other.cc)
list(APPEND TINT_TEST_SRCS utils/tmpfile_other.cc)
endif()
if(${TINT_BUILD_SPV_READER})
list(APPEND TINT_TEST_SRCS
reader/spirv/enum_converter_test.cc