aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/src/vcpkg-test/binarycaching.cpp
diff options
context:
space:
mode:
authorBilly O'Neal <bion@microsoft.com>2021-02-03 11:11:27 -0800
committerGitHub <noreply@github.com>2021-02-03 11:11:27 -0800
commitba03ad7c9d2f3b0467229055bebf5b7251f15045 (patch)
tree2296cc734c7f2667910d81455dce5fe4780a2778 /toolsrc/src/vcpkg-test/binarycaching.cpp
parentdc4d1b735aca2aa3ef0582ab2e420031fd24a402 (diff)
downloadvcpkg-ba03ad7c9d2f3b0467229055bebf5b7251f15045.tar.gz
vcpkg-ba03ad7c9d2f3b0467229055bebf5b7251f15045.zip
[vcpkg] Apply fixes needed to extract vcpkg-tool (#16012)
utilities.cmake: Disable warnings that are firing on Azure Pipelines CI machines due to different Clang version. expected.h: Fix a bug I introduced in https://github.com/microsoft/vcpkg/pull/15638/ because I was under the impression expected worked like optional (in that value_or_exit for it should be treated as a program bug) build.cpp: Add (void)s to silence warnings. binarycaching.cpp: Repair assumption that the current directory is C: which isn't true on the Hosted Azure Pipelines agents. others: Make unit tests respect %VCPKG_ROOT%, as necessary in the vcpkg_tool repo. Note that this required splitting vcpkgcmdarguments::ImbueFromEnvironment into the once-only process modifying part and the just imbue from environment part.
Diffstat (limited to 'toolsrc/src/vcpkg-test/binarycaching.cpp')
-rw-r--r--toolsrc/src/vcpkg-test/binarycaching.cpp28
1 files changed, 10 insertions, 18 deletions
diff --git a/toolsrc/src/vcpkg-test/binarycaching.cpp b/toolsrc/src/vcpkg-test/binarycaching.cpp
index 3cede064c..8a1a28d23 100644
--- a/toolsrc/src/vcpkg-test/binarycaching.cpp
+++ b/toolsrc/src/vcpkg-test/binarycaching.cpp
@@ -58,7 +58,11 @@ TEST_CASE ("generate_nuspec", "[generate_nuspec]")
{
auto& fsWrapper = Files::get_real_filesystem();
VcpkgCmdArguments args = VcpkgCmdArguments::create_from_arg_sequence(nullptr, nullptr);
+ args.imbue_from_environment();
args.packages_root_dir = std::make_unique<std::string>("/");
+ auto pkgPath = fsWrapper.absolute(VCPKG_LINE_INFO, fs::u8path("/zlib2_x64-windows")) / fs::u8path("**");
+ pkgPath.make_preferred();
+ const auto pkgPathStr = fs::u8string(pkgPath);
VcpkgPaths paths(fsWrapper, args);
auto pghs = Paragraphs::parse_paragraphs(R"(
@@ -101,11 +105,6 @@ Build-Depends: bzip
{
auto nuspec = generate_nuspec(paths, ipa, ref, {});
-#ifdef _WIN32
-#define PKGPATH "C:\\zlib2_x64-windows\\**"
-#else
-#define PKGPATH "/zlib2_x64-windows/**"
-#endif
std::string expected = R"(<package>
<metadata>
<id>zlib2_x64-windows</id>
@@ -125,7 +124,8 @@ Dependencies:
</description>
<packageTypes><packageType name="vcpkg"/></packageTypes>
</metadata>
- <files><file src=")" PKGPATH R"(" target=""/></files>
+ <files><file src=")" + pkgPathStr +
+ R"(" target=""/></files>
</package>
)";
REQUIRE_EQUAL_TEXT(nuspec, expected);
@@ -133,11 +133,6 @@ Dependencies:
{
auto nuspec = generate_nuspec(paths, ipa, ref, {"urlvalue"});
-#ifdef _WIN32
-#define PKGPATH "C:\\zlib2_x64-windows\\**"
-#else
-#define PKGPATH "/zlib2_x64-windows/**"
-#endif
std::string expected = R"(<package>
<metadata>
<id>zlib2_x64-windows</id>
@@ -158,18 +153,14 @@ Dependencies:
<packageTypes><packageType name="vcpkg"/></packageTypes>
<repository type="git" url="urlvalue"/>
</metadata>
- <files><file src=")" PKGPATH R"(" target=""/></files>
+ <files><file src=")" + pkgPathStr +
+ R"(" target=""/></files>
</package>
)";
REQUIRE_EQUAL_TEXT(nuspec, expected);
}
{
auto nuspec = generate_nuspec(paths, ipa, ref, {"urlvalue", "branchvalue", "commitvalue"});
-#ifdef _WIN32
-#define PKGPATH "C:\\zlib2_x64-windows\\**"
-#else
-#define PKGPATH "/zlib2_x64-windows/**"
-#endif
std::string expected = R"(<package>
<metadata>
<id>zlib2_x64-windows</id>
@@ -190,7 +181,8 @@ Dependencies:
<packageTypes><packageType name="vcpkg"/></packageTypes>
<repository type="git" url="urlvalue" branch="branchvalue" commit="commitvalue"/>
</metadata>
- <files><file src=")" PKGPATH R"(" target=""/></files>
+ <files><file src=")" + pkgPathStr +
+ R"(" target=""/></files>
</package>
)";
REQUIRE_EQUAL_TEXT(nuspec, expected);