Skip to content

Commit

Permalink
Rewrite the tests! now they're cross-platform! (#7315)
Browse files Browse the repository at this point in the history
* begin exploratory rewriting of tests

* continue working on tests

* more test work! holy butts vcpkg-tests/plan.cpp was a bunch of work

* finish writing new tests

  - [x] write catch2 tests
  - [ ] rewrite/at least delete the VS project files
  - [ ] document running tests

* Fix tests to work on WSL, rewrite test vcxproj

still need to test on macOS
also, delete tests.pch.h

* Condense add_test calls
  • Loading branch information
strega-nil authored and grdowns committed Jul 19, 2019
1 parent 9b5ee99 commit 8250553
Show file tree
Hide file tree
Showing 29 changed files with 19,288 additions and 2,496 deletions.
1 change: 1 addition & 0 deletions toolsrc/.clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Cpp11BracedListStyle: true
IndentCaseLabels: true
KeepEmptyLinesAtTheStartOfBlocks: false
NamespaceIndentation: All
ForEachMacros: [TEST_CASE, SECTION]
PenaltyReturnTypeOnItsOwnLine: 1000
SpaceAfterTemplateKeyword: false
SpaceBeforeCpp11BracedList: false
14 changes: 14 additions & 0 deletions toolsrc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ cmake_minimum_required(VERSION 3.3)

project(vcpkg C CXX)

enable_testing()

OPTION(DEFINE_DISABLE_METRICS "Option for disabling metrics" OFF)
OPTION(VCPKG_ALLOW_APPLE_CLANG "Option for allowing apple clang" OFF)

Expand Down Expand Up @@ -33,6 +35,7 @@ if(GCC OR CLANG)
endif()

file(GLOB_RECURSE VCPKGLIB_SOURCES src/vcpkg/*.cpp)
file(GLOB_RECURSE VCPKGTEST_SOURCES src/vcpkg-tests/*.cpp)

if (DEFINE_DISABLE_METRICS)
set(DISABLE_METRICS_VALUE "1")
Expand All @@ -44,6 +47,15 @@ add_executable(vcpkg src/vcpkg.cpp ${VCPKGLIB_SOURCES})
target_compile_definitions(vcpkg PRIVATE -DDISABLE_METRICS=${DISABLE_METRICS_VALUE})
target_include_directories(vcpkg PRIVATE include)


add_executable(vcpkg-test EXCLUDE_FROM_ALL ${VCPKGTEST_SOURCES} ${VCPKGLIB_SOURCES})
target_compile_definitions(vcpkg-test PRIVATE -DDISABLE_METRICS=${DISABLE_METRICS_VALUE})
target_include_directories(vcpkg-test PRIVATE include)

foreach(TEST_NAME arguments chrono dependencies paragraph plan specifier supports)
add_test(${TEST_NAME} vcpkg-test [${TEST_NAME}])
endforeach()

if(CLANG)
include(CheckCXXSourceCompiles)
check_cxx_source_compiles("#include <iostream>
Expand All @@ -57,8 +69,10 @@ endif()

if(GCC OR (CLANG AND USES_LIBSTDCXX))
target_link_libraries(vcpkg PRIVATE stdc++fs)
target_link_libraries(vcpkg-test PRIVATE stdc++fs)
elseif(CLANG)
target_link_libraries(vcpkg PRIVATE c++fs)
target_link_libraries(vcpkg-test PRIVATE c++fs)
endif()

if(MSVC)
Expand Down
19 changes: 0 additions & 19 deletions toolsrc/include/tests.pch.h

This file was deleted.

76 changes: 0 additions & 76 deletions toolsrc/include/tests.utils.h

This file was deleted.

Loading

0 comments on commit 8250553

Please sign in to comment.