Consolidate unittests in one binary

This commit is contained in:
Corentin Wallez 2017-05-16 20:16:56 +02:00 committed by Corentin Wallez
parent 314f3852a3
commit 0a58812f34
14 changed files with 24 additions and 73 deletions

View File

@ -68,6 +68,8 @@ target_include_directories(mock_nxt PUBLIC ${GENERATED_DIR})
target_link_libraries(mock_nxt nxt gtest)
SetCXX14(mock_nxt)
set(SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src)
add_subdirectory(src/backend)
add_subdirectory(src/wire)
add_subdirectory(src/tests)

View File

@ -120,16 +120,3 @@ if (APPLE)
endif()
target_include_directories(nxt_backend PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
SetCXX14(nxt_backend)
add_executable(backend_unittests
${TESTS_DIR}/BitSetIteratorTests.cpp
${TESTS_DIR}/CommandAllocatorTests.cpp
${TESTS_DIR}/MathTests.cpp
${TESTS_DIR}/PerStageTests.cpp
${TESTS_DIR}/RefCountedTests.cpp
${TESTS_DIR}/ToBackendTests.cpp
${TESTS_DIR}/UnittestsMain.cpp
)
target_link_libraries(backend_unittests nxt_backend gtest)
target_include_directories(backend_unittests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
SetCXX14(backend_unittests)

View File

@ -1,20 +0,0 @@
// Copyright 2017 The NXT Authors
//
// 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.
#include <gtest/gtest.h>
int main(int argc, char** argv) {
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}

View File

@ -13,10 +13,18 @@
# limitations under the License.
set(TESTS_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(UNITTESTS_DIR ${TESTS_DIR}/unittests)
add_executable(nxt_unittests
${TESTS_DIR}/EnumClassBitmasksTests.cpp
${UNITTESTS_DIR}/BitSetIteratorTests.cpp
${UNITTESTS_DIR}/CommandAllocatorTests.cpp
${UNITTESTS_DIR}/EnumClassBitmasksTests.cpp
${UNITTESTS_DIR}/MathTests.cpp
${UNITTESTS_DIR}/PerStageTests.cpp
${UNITTESTS_DIR}/RefCountedTests.cpp
${UNITTESTS_DIR}/ToBackendTests.cpp
${UNITTESTS_DIR}/WireTests.cpp
${TESTS_DIR}/UnittestsMain.cpp
)
target_link_libraries(nxt_unittests gtest nxtcpp)
target_link_libraries(nxt_unittests gtest nxt_backend mock_nxt nxt_wire)
target_include_directories(nxt_unittests PRIVATE ${SRC_DIR})
SetCXX14(nxt_unittests)

View File

@ -14,7 +14,7 @@
#include <gtest/gtest.h>
#include "common/BitSetIterator.h"
#include "backend/common/BitSetIterator.h"
// This is ANGLE's BitSetIterator_unittests.cpp file.

View File

@ -14,7 +14,7 @@
#include <gtest/gtest.h>
#include "common/CommandAllocator.h"
#include "backend/common/CommandAllocator.h"
using namespace backend;

View File

@ -14,7 +14,7 @@
#include <gtest/gtest.h>
#include "common/Math.h"
#include "backend/common/Math.h"
using namespace backend;

View File

@ -14,7 +14,7 @@
#include <gtest/gtest.h>
#include "common/PerStage.h"
#include "backend/common/PerStage.h"
using namespace backend;

View File

@ -14,7 +14,7 @@
#include <gtest/gtest.h>
#include "common/RefCounted.h"
#include "backend/common/RefCounted.h"
using namespace backend;

View File

@ -14,8 +14,8 @@
#include <gtest/gtest.h>
#include "common/RefCounted.h"
#include "common/ToBackend.h"
#include "backend/common/RefCounted.h"
#include "backend/common/ToBackend.h"
#include <type_traits>

View File

@ -15,8 +15,8 @@
#include "gtest/gtest.h"
#include "mock/mock_nxt.h"
#include "TerribleCommandBuffer.h"
#include "Wire.h"
#include "wire/TerribleCommandBuffer.h"
#include "wire/Wire.h"
using namespace testing;
using namespace nxt::wire;

View File

@ -19,12 +19,14 @@ Generate(
LIB_NAME wire_autogen
LIB_TYPE STATIC
PRINT_NAME "Wire serialization/deserialization autogenerated files"
EXTRA_DEPS nxt
COMMAND_LINE_ARGS
${GENERATOR_COMMON_ARGS}
-T wire
)
target_include_directories(wire_autogen PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories(wire_autogen PUBLIC ${GENERATED_DIR})
target_link_libraries(wire_autogen nxt)
SetCXX14(wire_autogen)
SetPic(wire_autogen)
@ -35,11 +37,3 @@ add_library(nxt_wire SHARED
)
target_link_libraries(nxt_wire wire_autogen)
SetCXX14(nxt_wire)
add_executable(wire_unittests
${TESTS_DIR}/UnittestsMain.cpp
${TESTS_DIR}/WireTests.cpp
)
target_link_libraries(wire_unittests mock_nxt nxt_wire)
target_include_directories(wire_unittests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
SetCXX14(wire_unittests)

View File

@ -1,20 +0,0 @@
// Copyright 2017 The NXT Authors
//
// 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.
#include <gtest/gtest.h>
int main(int argc, char** argv) {
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}