From bc51175dc0c5f5e2106e73779663e9942dd451c4 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 1 Jun 2015 16:18:23 +0200 Subject: [PATCH] Add tarball tests --- src/libexpr/download.cc | 2 +- tests/local.mk | 2 +- tests/tarball.sh | 20 ++++++++++++++++++++ 3 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 tests/tarball.sh diff --git a/src/libexpr/download.cc b/src/libexpr/download.cc index 062622000..9bf3e13aa 100644 --- a/src/libexpr/download.cc +++ b/src/libexpr/download.cc @@ -229,7 +229,7 @@ bool isUri(const string & s) size_t pos = s.find("://"); if (pos == string::npos) return false; string scheme(s, 0, pos); - return scheme == "http" || scheme == "https"; + return scheme == "http" || scheme == "https" || scheme == "file"; } diff --git a/tests/local.mk b/tests/local.mk index 7a24fadcb..03f53b44c 100644 --- a/tests/local.mk +++ b/tests/local.mk @@ -11,7 +11,7 @@ nix_tests = \ binary-patching.sh timeout.sh secure-drv-outputs.sh nix-channel.sh \ multiple-outputs.sh import-derivation.sh fetchurl.sh optimise-store.sh \ binary-cache.sh nix-profile.sh repair.sh dump-db.sh case-hack.sh \ - check-reqs.sh pass-as-file.sh + check-reqs.sh pass-as-file.sh tarball.sh # parallel.sh install-tests += $(foreach x, $(nix_tests), tests/$(x)) diff --git a/tests/tarball.sh b/tests/tarball.sh new file mode 100644 index 000000000..6d02544cf --- /dev/null +++ b/tests/tarball.sh @@ -0,0 +1,20 @@ +source common.sh + +clearStore + +tarroot=$TEST_ROOT/tarball +rm -rf $tarroot +mkdir -p $tarroot +cp dependencies.nix $tarroot/default.nix +cp config.nix dependencies.builder*.sh $tarroot/ + +tarball=$TEST_ROOT/tarball.tar.xz +(cd $TEST_ROOT && tar c tarball) | xz > $tarball + +nix-env -f file://$tarball -qa --out-path | grep -q dependencies + +nix-build file://$tarball + +nix-build '' -I foo=file://$tarball + +nix-build -E "import (fetchTarball file://$tarball)"