forked from microsoft/vcpkg
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[vcpkg] Add support for VCPKG_BINARY_SOURCES and --x-binarysource=<> (m…
…icrosoft#10476) * [vcpkg] Add support for VCPKG_BINARY_SOURCES and --binarysource=<> * [vcpkg] Rename --binarysource to --x-binarysource to denote internal/experimental * [vcpkg] Address review comments & add tests for BinaryConfigParser * [vcpkg] Replace do {} while(1); with for(;;) Avoids conditional expresion is constant warnings * [vcpkg] Invert if/else * [vcpkg] Fix warning in export.prefab.cpp * [vcpkg] Resolve merge regressions
- Loading branch information
1 parent
09e0a74
commit 6b0c1f4
Showing
17 changed files
with
570 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,183 @@ | ||
#include <catch2/catch.hpp> | ||
#include <vcpkg/binarycaching.h> | ||
|
||
using namespace vcpkg; | ||
|
||
#if defined(_WIN32) | ||
#define ABSOLUTE_PATH "C:\\foo" | ||
#else | ||
#define ABSOLUTE_PATH "/foo" | ||
#endif | ||
|
||
TEST_CASE ("BinaryConfigParser empty", "[binaryconfigparser]") | ||
{ | ||
auto parsed = create_binary_provider_from_configs_pure("", {}); | ||
REQUIRE(parsed.has_value()); | ||
} | ||
|
||
TEST_CASE ("BinaryConfigParser unacceptable provider", "[binaryconfigparser]") | ||
{ | ||
auto parsed = create_binary_provider_from_configs_pure("unacceptable", {}); | ||
REQUIRE(!parsed.has_value()); | ||
} | ||
|
||
TEST_CASE ("BinaryConfigParser files provider", "[binaryconfigparser]") | ||
{ | ||
{ | ||
auto parsed = create_binary_provider_from_configs_pure("files", {}); | ||
REQUIRE(!parsed.has_value()); | ||
} | ||
{ | ||
auto parsed = create_binary_provider_from_configs_pure("files,relative-path", {}); | ||
REQUIRE(!parsed.has_value()); | ||
} | ||
{ | ||
auto parsed = create_binary_provider_from_configs_pure("files,C:foo", {}); | ||
REQUIRE(!parsed.has_value()); | ||
} | ||
{ | ||
auto parsed = create_binary_provider_from_configs_pure("files," ABSOLUTE_PATH, {}); | ||
REQUIRE(parsed.has_value()); | ||
} | ||
{ | ||
auto parsed = create_binary_provider_from_configs_pure("files," ABSOLUTE_PATH ",nonsense", {}); | ||
REQUIRE(!parsed.has_value()); | ||
} | ||
{ | ||
auto parsed = create_binary_provider_from_configs_pure("files," ABSOLUTE_PATH ",upload", {}); | ||
REQUIRE(parsed.has_value()); | ||
} | ||
{ | ||
auto parsed = create_binary_provider_from_configs_pure("files," ABSOLUTE_PATH ",upload,extra", {}); | ||
REQUIRE(!parsed.has_value()); | ||
} | ||
{ | ||
auto parsed = create_binary_provider_from_configs_pure("files,,upload", {}); | ||
REQUIRE(!parsed.has_value()); | ||
} | ||
} | ||
|
||
TEST_CASE ("BinaryConfigParser default provider", "[binaryconfigparser]") | ||
{ | ||
{ | ||
auto parsed = create_binary_provider_from_configs_pure("default", {}); | ||
REQUIRE(parsed.has_value()); | ||
} | ||
{ | ||
auto parsed = create_binary_provider_from_configs_pure("default,nonsense", {}); | ||
REQUIRE(!parsed.has_value()); | ||
} | ||
{ | ||
auto parsed = create_binary_provider_from_configs_pure("default,upload", {}); | ||
REQUIRE(parsed.has_value()); | ||
} | ||
{ | ||
auto parsed = create_binary_provider_from_configs_pure("default,upload,extra", {}); | ||
REQUIRE(!parsed.has_value()); | ||
} | ||
} | ||
|
||
TEST_CASE ("BinaryConfigParser clear provider", "[binaryconfigparser]") | ||
{ | ||
{ | ||
auto parsed = create_binary_provider_from_configs_pure("clear", {}); | ||
REQUIRE(parsed.has_value()); | ||
} | ||
{ | ||
auto parsed = create_binary_provider_from_configs_pure("clear,upload", {}); | ||
REQUIRE(!parsed.has_value()); | ||
} | ||
} | ||
|
||
TEST_CASE ("BinaryConfigParser multiple providers", "[binaryconfigparser]") | ||
{ | ||
{ | ||
auto parsed = create_binary_provider_from_configs_pure("clear;default", {}); | ||
REQUIRE(parsed.has_value()); | ||
} | ||
{ | ||
auto parsed = create_binary_provider_from_configs_pure("clear;default,upload", {}); | ||
REQUIRE(parsed.has_value()); | ||
} | ||
{ | ||
auto parsed = create_binary_provider_from_configs_pure("clear;default,upload;clear;clear", {}); | ||
REQUIRE(parsed.has_value()); | ||
} | ||
{ | ||
auto parsed = create_binary_provider_from_configs_pure("clear;files,relative;default", {}); | ||
REQUIRE(!parsed.has_value()); | ||
} | ||
{ | ||
auto parsed = create_binary_provider_from_configs_pure(";;;clear;;;;", {}); | ||
REQUIRE(parsed.has_value()); | ||
} | ||
{ | ||
auto parsed = create_binary_provider_from_configs_pure(";;;,;;;;", {}); | ||
REQUIRE(!parsed.has_value()); | ||
} | ||
} | ||
|
||
TEST_CASE ("BinaryConfigParser escaping", "[binaryconfigparser]") | ||
{ | ||
{ | ||
auto parsed = create_binary_provider_from_configs_pure(";;;;;;;`", {}); | ||
REQUIRE(!parsed.has_value()); | ||
} | ||
{ | ||
auto parsed = create_binary_provider_from_configs_pure(";;;;;;;`defaul`t", {}); | ||
REQUIRE(parsed.has_value()); | ||
} | ||
{ | ||
auto parsed = create_binary_provider_from_configs_pure("files," ABSOLUTE_PATH "`", {}); | ||
REQUIRE(!parsed.has_value()); | ||
} | ||
{ | ||
auto parsed = create_binary_provider_from_configs_pure("files," ABSOLUTE_PATH "`,", {}); | ||
REQUIRE(parsed.has_value()); | ||
} | ||
{ | ||
auto parsed = create_binary_provider_from_configs_pure("files," ABSOLUTE_PATH "``", {}); | ||
REQUIRE(parsed.has_value()); | ||
} | ||
{ | ||
auto parsed = create_binary_provider_from_configs_pure("files," ABSOLUTE_PATH "```", {}); | ||
REQUIRE(!parsed.has_value()); | ||
} | ||
{ | ||
auto parsed = create_binary_provider_from_configs_pure("files," ABSOLUTE_PATH "````", {}); | ||
REQUIRE(parsed.has_value()); | ||
} | ||
{ | ||
auto parsed = create_binary_provider_from_configs_pure("files," ABSOLUTE_PATH ",", {}); | ||
REQUIRE(!parsed.has_value()); | ||
} | ||
} | ||
|
||
TEST_CASE ("BinaryConfigParser args", "[binaryconfigparser]") | ||
{ | ||
{ | ||
auto parsed = | ||
create_binary_provider_from_configs_pure("files," ABSOLUTE_PATH, std::vector<std::string>{"clear"}); | ||
REQUIRE(parsed.has_value()); | ||
} | ||
{ | ||
auto parsed = | ||
create_binary_provider_from_configs_pure("files," ABSOLUTE_PATH, std::vector<std::string>{"clear;default"}); | ||
REQUIRE(parsed.has_value()); | ||
} | ||
{ | ||
auto parsed = create_binary_provider_from_configs_pure("files," ABSOLUTE_PATH, | ||
std::vector<std::string>{"clear;default,"}); | ||
REQUIRE(!parsed.has_value()); | ||
} | ||
{ | ||
auto parsed = create_binary_provider_from_configs_pure("files," ABSOLUTE_PATH, | ||
std::vector<std::string>{"clear", "clear;default,"}); | ||
REQUIRE(!parsed.has_value()); | ||
} | ||
{ | ||
auto parsed = create_binary_provider_from_configs_pure("files," ABSOLUTE_PATH, | ||
std::vector<std::string>{"clear", "clear"}); | ||
REQUIRE(parsed.has_value()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.