vcpkg-tool: add basic test for wrapper

This commit is contained in:
h7x4 2024-07-12 15:35:37 +02:00
parent f24b1fb11c
commit 2a2a64abc8
No known key found for this signature in database
GPG Key ID: 9F2F7D8250F35146

View File

@ -16,6 +16,8 @@
, unzip
, zip
, zstd
, runCommand
, writeText
, extraRuntimeDeps ? []
, doWrap ? true
}:
@ -161,6 +163,20 @@ stdenv.mkDerivation (finalAttrs: {
install -Dm555 "$vcpkgWrapperPath" "$out/bin/vcpkg"
'';
passthru.tests = {
testWrapper = runCommand "vcpkg-tool-test-wrapper" { buildInputs = [ finalAttrs.finalPackage ]; } ''
export NIX_VCPKG_DEBUG_PRINT_ENVVARS=true
vcpkg --x-packages-root="test" --x-install-root="test2" contact > "$out"
cat "$out" | head -n 4 | diff - ${writeText "vcpkg-tool-test-wrapper-expected" ''
NIX_VCPKG_DOWNLOADS_ROOT = /homeless-shelter/.vcpkg/root/downloads
NIX_VCPKG_BUILDTREES_ROOT = /homeless-shelter/.vcpkg/root/buildtrees
NIX_VCPKG_PACKAGES_ROOT = test
NIX_VCPKG_INSTALL_ROOT = test2
''}
'';
};
meta = {
description = "Components of microsoft/vcpkg's binary";
mainProgram = "vcpkg";