From 784083176a6c2bbda84095de97cb59126fe7c7a5 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 25 Nov 2011 17:04:26 +0000 Subject: * Fix race. --- tests/remote-builds.nix | 1 + 1 file changed, 1 insertion(+) (limited to 'tests') diff --git a/tests/remote-builds.nix b/tests/remote-builds.nix index 201ca9dba19b..de127b8aee16 100644 --- a/tests/remote-builds.nix +++ b/tests/remote-builds.nix @@ -72,6 +72,7 @@ in $client->succeed("chmod 600 /root/.ssh/id_dsa"); # Install the SSH key on the slaves. + $client->waitForJob("network-interfaces"); foreach my $slave ($slave1, $slave2) { $slave->succeed("mkdir -m 700 /root/.ssh"); $slave->copyFileFromHost("key.pub", "/root/.ssh/authorized_keys"); -- cgit 1.4.1 From b12b21825c949ef9b9327c6a0c9e2d5601aaf0b2 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 1 Dec 2011 16:41:43 +0000 Subject: * Allow '' syntax to be used in nix-instantiate, nix-build and nix-env, e.g., $ nix-env -f '' -i patchelf or $ nix-build '' -A login.test --- src/libexpr/common-opts.cc | 11 +++++++++++ src/libexpr/common-opts.hh | 2 ++ src/nix-env/nix-env.cc | 2 +- src/nix-instantiate/nix-instantiate.cc | 3 +-- tests/user-envs.sh | 2 +- 5 files changed, 16 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/src/libexpr/common-opts.cc b/src/libexpr/common-opts.cc index d029d2ec35b9..e0865d9fcc25 100644 --- a/src/libexpr/common-opts.cc +++ b/src/libexpr/common-opts.cc @@ -44,4 +44,15 @@ bool parseSearchPathArg(const string & arg, Strings::iterator & i, } +Path lookupFileArg(EvalState & state, string s) +{ + if (s.size() > 2 && s.at(0) == '<' && s.at(s.size() - 1) == '>') { + Path p = state.findFile(s.substr(1, s.size() - 2)); + if (p == "") throw Error(format("file `%1%' was not found in the Nix search path (add it using $NIX_PATH or -I)") % p); + return p; + } else + return absPath(s); +} + + } diff --git a/src/libexpr/common-opts.hh b/src/libexpr/common-opts.hh index 6b7247fc3d89..c28641e9015d 100644 --- a/src/libexpr/common-opts.hh +++ b/src/libexpr/common-opts.hh @@ -14,6 +14,8 @@ bool parseOptionArg(const string & arg, Strings::iterator & i, bool parseSearchPathArg(const string & arg, Strings::iterator & i, const Strings::iterator & argsEnd, EvalState & state); +Path lookupFileArg(EvalState & state, string s); + } diff --git a/src/nix-env/nix-env.cc b/src/nix-env/nix-env.cc index 3dfecb2d7313..a8d9076cfb8d 100644 --- a/src/nix-env/nix-env.cc +++ b/src/nix-env/nix-env.cc @@ -1270,7 +1270,7 @@ void run(Strings args) else if (arg == "--profile" || arg == "-p") globals.profile = absPath(needArg(i, args, arg)); else if (arg == "--file" || arg == "-f") - globals.instSource.nixExprPath = absPath(needArg(i, args, arg)); + globals.instSource.nixExprPath = lookupFileArg(globals.state, needArg(i, args, arg)); else if (arg == "--switch-profile" || arg == "-S") op = opSwitchProfile; else if (arg == "--switch-generation" || arg == "-G") diff --git a/src/nix-instantiate/nix-instantiate.cc b/src/nix-instantiate/nix-instantiate.cc index 98eadbd69580..93aa50943450 100644 --- a/src/nix-instantiate/nix-instantiate.cc +++ b/src/nix-instantiate/nix-instantiate.cc @@ -138,8 +138,7 @@ void run(Strings args) } foreach (Strings::iterator, i, files) { - Path path = absPath(*i); - Expr * e = state.parseExprFromFile(path); + Expr * e = state.parseExprFromFile(lookupFileArg(state, *i)); processExpr(state, attrPaths, parseOnly, strict, autoArgs, evalOnly, xmlOutput, xmlOutputSourceLocation, e); } diff --git a/tests/user-envs.sh b/tests/user-envs.sh index 025a5ff81716..5037e28b916b 100644 --- a/tests/user-envs.sh +++ b/tests/user-envs.sh @@ -36,7 +36,7 @@ nix-env -p $profiles/test -q '*' | grep -q foo-2.0pre1 test "$($profiles/test/bin/foo)" = "foo-2.0pre1" # Upgrade "foo": should install foo-2.0. -nix-env -p $profiles/test -f ./user-envs.nix -u foo +NIX_PATH=nixpkgs=./user-envs.nix nix-env -p $profiles/test -f '' -u foo # Query installed: should contain foo-2.0 now. test "$(nix-env -p $profiles/test -q '*' | wc -l)" -eq 1 -- cgit 1.4.1 From 23bf700196b4fa05a2da55798644f8adc2e1d7b1 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 14 Dec 2011 22:31:31 +0000 Subject: * Oops, the daemon test wasn't actually using the daemon. --- tests/Makefile.am | 2 +- tests/common.sh.in | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/Makefile.am b/tests/Makefile.am index 676a9c387b18..38bfa139d767 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,4 +1,4 @@ -TESTS_ENVIRONMENT = $(bash) -e +TESTS_ENVIRONMENT = NIX_REMOTE= $(bash) -e extra1 = $(shell pwd)/test-tmp/shared diff --git a/tests/common.sh.in b/tests/common.sh.in index 62ac669df665..4ab490a62645 100644 --- a/tests/common.sh.in +++ b/tests/common.sh.in @@ -23,8 +23,6 @@ export SHARED=$TEST_ROOT/shared export PATH=$NIX_BIN_DIR:$TOP/scripts:$PATH -export NIX_REMOTE= - export REAL_BIN_DIR=@bindir@ export REAL_LIBEXEC_DIR=@libexecdir@ export REAL_LOCALSTATE_DIR=@localstatedir@ -- cgit 1.4.1