diff options
Diffstat (limited to 'tests')
38 files changed, 34 insertions, 41 deletions
diff --git a/tests/functional/ca/build-cache.sh b/tests/functional/ca/build-cache.sh index 6a4080fec..9b3b61e87 100644..100755 --- a/tests/functional/ca/build-cache.sh +++ b/tests/functional/ca/build-cache.sh @@ -48,4 +48,4 @@ testRemoteCache () { } clearStore -testRemoteCache
\ No newline at end of file +testRemoteCache diff --git a/tests/functional/ca/build-dry.sh b/tests/functional/ca/build-dry.sh index 9a72075ec..7d4406e2f 100644 --- a/tests/functional/ca/build-dry.sh +++ b/tests/functional/ca/build-dry.sh @@ -3,4 +3,3 @@ source common.sh export NIX_TESTS_CA_BY_DEFAULT=1 cd .. && source build-dry.sh - diff --git a/tests/functional/ca/build.sh b/tests/functional/ca/build.sh index e1a8a7625..e1a8a7625 100644..100755 --- a/tests/functional/ca/build.sh +++ b/tests/functional/ca/build.sh diff --git a/tests/functional/ca/eval-store.sh b/tests/functional/ca/eval-store.sh index 9cc499606..9cc499606 100644..100755 --- a/tests/functional/ca/eval-store.sh +++ b/tests/functional/ca/eval-store.sh diff --git a/tests/functional/ca/import-derivation.sh b/tests/functional/ca/import-derivation.sh index e98e0fbd0..bc72011f9 100644 --- a/tests/functional/ca/import-derivation.sh +++ b/tests/functional/ca/import-derivation.sh @@ -3,4 +3,3 @@ source common.sh export NIX_TESTS_CA_BY_DEFAULT=1 cd .. && source import-derivation.sh - diff --git a/tests/functional/ca/nix-shell.sh b/tests/functional/ca/nix-shell.sh index 1c5a6639f..d1fbe54d1 100755 --- a/tests/functional/ca/nix-shell.sh +++ b/tests/functional/ca/nix-shell.sh @@ -5,4 +5,3 @@ source common.sh CONTENT_ADDRESSED=true cd .. source ./nix-shell.sh - diff --git a/tests/functional/ca/nondeterministic.nix b/tests/functional/ca/nondeterministic.nix index d6d099a3e..642ec32ae 100644 --- a/tests/functional/ca/nondeterministic.nix +++ b/tests/functional/ca/nondeterministic.nix @@ -32,4 +32,3 @@ rec { ''; }; } - diff --git a/tests/functional/ca/post-hook.sh b/tests/functional/ca/post-hook.sh index 705bde9d4..3a90d2795 100755 --- a/tests/functional/ca/post-hook.sh +++ b/tests/functional/ca/post-hook.sh @@ -7,5 +7,3 @@ requireDaemonNewerThan "2.4pre20210626" export NIX_TESTS_CA_BY_DEFAULT=1 cd .. source ./post-hook.sh - - diff --git a/tests/functional/ca/substitute.sh b/tests/functional/ca/substitute.sh index ea981adc4..ea981adc4 100644..100755 --- a/tests/functional/ca/substitute.sh +++ b/tests/functional/ca/substitute.sh diff --git a/tests/functional/dyn-drv/build-built-drv.sh b/tests/functional/dyn-drv/build-built-drv.sh index 647be9457..647be9457 100644..100755 --- a/tests/functional/dyn-drv/build-built-drv.sh +++ b/tests/functional/dyn-drv/build-built-drv.sh diff --git a/tests/functional/dyn-drv/dep-built-drv.sh b/tests/functional/dyn-drv/dep-built-drv.sh index 4f6e9b080..4f6e9b080 100644..100755 --- a/tests/functional/dyn-drv/dep-built-drv.sh +++ b/tests/functional/dyn-drv/dep-built-drv.sh diff --git a/tests/functional/dyn-drv/eval-outputOf.sh b/tests/functional/dyn-drv/eval-outputOf.sh index 3681bd098..3681bd098 100644..100755 --- a/tests/functional/dyn-drv/eval-outputOf.sh +++ b/tests/functional/dyn-drv/eval-outputOf.sh diff --git a/tests/functional/dyn-drv/text-hashed-output.sh b/tests/functional/dyn-drv/text-hashed-output.sh index f3e5aa93b..f3e5aa93b 100644..100755 --- a/tests/functional/dyn-drv/text-hashed-output.sh +++ b/tests/functional/dyn-drv/text-hashed-output.sh diff --git a/tests/functional/fetchClosure.sh b/tests/functional/fetchClosure.sh index a02d1ce7a..618527fa7 100644 --- a/tests/functional/fetchClosure.sh +++ b/tests/functional/fetchClosure.sh @@ -147,4 +147,3 @@ expectStderr 1 nix eval -v --raw --expr " inputAddressed = true; } " | grepQuiet 'error.*The store object referred to by.*fromPath.* at .* is not input-addressed, but .*inputAddressed.* is set to .*true.*' - diff --git a/tests/functional/flakes/circular.sh b/tests/functional/flakes/circular.sh index d3bb8e8a3..14752c3e9 100644 --- a/tests/functional/flakes/circular.sh +++ b/tests/functional/flakes/circular.sh @@ -47,4 +47,3 @@ nix flake update b --flake $flakeA # Test list-inputs with circular dependencies nix flake metadata $flakeA - diff --git a/tests/functional/flakes/follow-paths.sh b/tests/functional/flakes/follow-paths.sh index efc5f95d8..183893bde 100644 --- a/tests/functional/flakes/follow-paths.sh +++ b/tests/functional/flakes/follow-paths.sh @@ -167,7 +167,7 @@ nix flake lock "$flakeFollowsA" 2>&1 | grep "warning: input 'B' has an override # # The message was # error: input 'B/D' follows a non-existent input 'B/C/D' -# +# # Note that for `B` to resolve its follow for `D`, it needs `C/D`, for which it needs to resolve the follow on `C` first. flakeFollowsOverloadA="$TEST_ROOT/follows/overload/flakeA" flakeFollowsOverloadB="$TEST_ROOT/follows/overload/flakeA/flakeB" diff --git a/tests/functional/flakes/run.sh b/tests/functional/flakes/run.sh index 9fa51d1c7..10595ea12 100644 --- a/tests/functional/flakes/run.sh +++ b/tests/functional/flakes/run.sh @@ -26,4 +26,3 @@ nix run --no-write-lock-file .#pkgAsPkg ! nix run --no-write-lock-file .#appAsPkg || fail "elements of 'apps' should be of type 'app'" clearStore - diff --git a/tests/functional/fmt.simple.sh b/tests/functional/fmt.simple.sh index 4c8c67ebb..03109a655 100755 --- a/tests/functional/fmt.simple.sh +++ b/tests/functional/fmt.simple.sh @@ -1 +1,3 @@ +#!/usr/bin/env bash + echo Formatting: "${@}" diff --git a/tests/functional/function-trace.sh b/tests/functional/function-trace.sh index bd804bf18..71f18b67f 100755 --- a/tests/functional/function-trace.sh +++ b/tests/functional/function-trace.sh @@ -1,3 +1,5 @@ +#!/usr/bin/env bash + source common.sh set +x diff --git a/tests/functional/hash-check.nix b/tests/functional/hash-check.nix index 4a8e9b8a8..f029f0cc9 100644 --- a/tests/functional/hash-check.nix +++ b/tests/functional/hash-check.nix @@ -26,4 +26,4 @@ let { inherit input2; }; -}
\ No newline at end of file +} diff --git a/tests/functional/init.sh b/tests/functional/init.sh index d697b1a30..f5a04f62e 100755 --- a/tests/functional/init.sh +++ b/tests/functional/init.sh @@ -1,3 +1,5 @@ +#!/usr/bin/env bash + # Don't start the daemon source common/vars-and-functions.sh diff --git a/tests/functional/lang.sh b/tests/functional/lang.sh index 12df32c87..94c00bad0 100755 --- a/tests/functional/lang.sh +++ b/tests/functional/lang.sh @@ -1,3 +1,5 @@ +#!/usr/bin/env bash + source common.sh set -o pipefail diff --git a/tests/functional/linux-sandbox-cert-test.nix b/tests/functional/linux-sandbox-cert-test.nix index 2fc083ea9..fe36baf6b 100644 --- a/tests/functional/linux-sandbox-cert-test.nix +++ b/tests/functional/linux-sandbox-cert-test.nix @@ -27,4 +27,3 @@ mkDerivation ( normal = { }; }.${mode} ) - diff --git a/tests/functional/nar-access.nix b/tests/functional/nar-access.nix index 0e2a7f721..9948abe59 100644 --- a/tests/functional/nar-access.nix +++ b/tests/functional/nar-access.nix @@ -20,4 +20,4 @@ asdom 12398 EOF ''; }; -}
\ No newline at end of file +} diff --git a/tests/functional/nix-channel.sh b/tests/functional/nix-channel.sh index b5d935004..c60c7c412 100644 --- a/tests/functional/nix-channel.sh +++ b/tests/functional/nix-channel.sh @@ -63,4 +63,3 @@ grepQuiet 'item.*attrPath="foo".*name="dependencies-top"' $TEST_ROOT/meta.xml # Do an install. nix-env -i dependencies-top [ -e $TEST_HOME/.nix-profile/foobar ] - diff --git a/tests/functional/read-only-store.sh b/tests/functional/read-only-store.sh index d63920c19..f3791ad59 100644 --- a/tests/functional/read-only-store.sh +++ b/tests/functional/read-only-store.sh @@ -9,7 +9,7 @@ clearStore happy () { # We can do a read-only query just fine with a read-only store nix --store local?read-only=true path-info $dummyPath - + # We can "write" an already-present store-path a read-only store, because no IO is actually required nix-store --store local?read-only=true --add dummy } diff --git a/tests/functional/repl_characterization/data/basic.ast b/tests/functional/repl_characterization/data/basic.ast index af70e149b..bdb445c9a 100644 --- a/tests/functional/repl_characterization/data/basic.ast +++ b/tests/functional/repl_characterization/data/basic.ast @@ -14,4 +14,3 @@ Commentary "the blank below should be chomped" Command "command three" Commentary "" Output "meow output" -Output "" diff --git a/tests/functional/repl_characterization/data/basic.test b/tests/functional/repl_characterization/data/basic.test index d62bacbbc..ae5812a2d 100644 --- a/tests/functional/repl_characterization/data/basic.test +++ b/tests/functional/repl_characterization/data/basic.test @@ -14,4 +14,3 @@ the blank below should be chomped nix-repl> command three meow output - diff --git a/tests/functional/shell.shebang.nix b/tests/functional/shell.shebang.nix index 08e43d53c..00124255b 100755 --- a/tests/functional/shell.shebang.nix +++ b/tests/functional/shell.shebang.nix @@ -1,6 +1,6 @@ #! @ENV_PROG@ nix-shell #! nix-shell -I nixpkgs=shell.nix --no-substitute -#! nix-shell --argstr s1 'foo "bar" \baz'"'"'qux' --argstr s2 "foo 'bar' \"\baz" --argstr s3 \foo\ bar\'baz --argstr s4 '' +#! nix-shell --argstr s1 'foo "bar" \baz'"'"'qux' --argstr s2 "foo 'bar' \"\baz" --argstr s3 \foo\ bar\'baz --argstr s4 '' #! nix-shell shell.shebang.nix --command true { s1, s2, s3, s4 }: assert s1 == ''foo "bar" \baz'qux''; diff --git a/tests/functional/shell.shebang.rb b/tests/functional/shell.shebang.rb index ea67eb09c..ea67eb09c 100644..100755 --- a/tests/functional/shell.shebang.rb +++ b/tests/functional/shell.shebang.rb diff --git a/tests/functional/simple.builder.sh b/tests/functional/simple.builder.sh index 569e8ca88..4dbc77702 100644 --- a/tests/functional/simple.builder.sh +++ b/tests/functional/simple.builder.sh @@ -8,4 +8,4 @@ export PATH=$goodPath mkdir $out -echo "Hello World!" > $out/hello
\ No newline at end of file +echo "Hello World!" > $out/hello diff --git a/tests/nixos/default.nix b/tests/nixos/default.nix index fcc83b842..547290188 100644 --- a/tests/nixos/default.nix +++ b/tests/nixos/default.nix @@ -109,7 +109,7 @@ in nix.package = lib.mkForce pkgs.nixVersions.nix_2_13; }; }; - + # TODO: (nixpkgs update) remoteBuildsSshNg_remote_2_18 = ... # Test our Nix as a builder for clients that are older diff --git a/tests/nixos/fetch-git/testsupport/gitea-repo.nix b/tests/nixos/fetch-git/testsupport/gitea-repo.nix index 916552bb2..77876d369 100644 --- a/tests/nixos/fetch-git/testsupport/gitea-repo.nix +++ b/tests/nixos/fetch-git/testsupport/gitea-repo.nix @@ -48,4 +48,4 @@ in """) ''; }; -}
\ No newline at end of file +} diff --git a/tests/unit/libutil-support/tests/cli-literate-parser.cc b/tests/unit/libutil-support/tests/cli-literate-parser.cc index 08ebddebc..4edf434be 100644 --- a/tests/unit/libutil-support/tests/cli-literate-parser.cc +++ b/tests/unit/libutil-support/tests/cli-literate-parser.cc @@ -1,4 +1,5 @@ #include "cli-literate-parser.hh" +#include "escape-string.hh" #include "libexpr/print.hh" #include "escape-char.hh" #include "types.hh" @@ -41,7 +42,7 @@ auto CLILiterateParser::Node::print() const -> std::string s << "Output "; break; } - printLiteralString(s, this->text); + escapeString(s, this->text); return s.str(); } diff --git a/tests/unit/libutil/chunked-vector.cc b/tests/unit/libutil/chunked-vector.cc index 868d11f6f..4feed568b 100644 --- a/tests/unit/libutil/chunked-vector.cc +++ b/tests/unit/libutil/chunked-vector.cc @@ -51,4 +51,3 @@ namespace nix { } } - diff --git a/tests/unit/libutil/git.cc b/tests/unit/libutil/git.cc index 5b5715fc2..e9048278a 100644 --- a/tests/unit/libutil/git.cc +++ b/tests/unit/libutil/git.cc @@ -30,4 +30,3 @@ namespace nix { ASSERT_EQ(res->reference, "refs/head/main"); } } - diff --git a/tests/unit/libutil/pool.cc b/tests/unit/libutil/pool.cc index 127e42dda..3ad4ed3aa 100644 --- a/tests/unit/libutil/pool.cc +++ b/tests/unit/libutil/pool.cc @@ -65,21 +65,6 @@ namespace nix { ASSERT_EQ(pool.capacity(), 0); } - TEST(Pool, flushBadDropsOutOfScopeResources) { - auto isGood = [](const ref<TestResource> & r) { return false; }; - auto createResource = []() { return make_ref<TestResource>(); }; - - Pool<TestResource> pool = Pool<TestResource>((size_t)1, createResource, isGood); - - { - auto _r = pool.get(); - ASSERT_EQ(pool.count(), 1); - } - - pool.flushBad(); - ASSERT_EQ(pool.count(), 0); - } - // Test that the resources we allocate are being reused when they are still good. TEST(Pool, reuseResource) { auto isGood = [](const ref<TestResource> & r) { return true; }; @@ -124,4 +109,19 @@ namespace nix { ASSERT_NE(h->num, counter); } } + + TEST(Pool, throwingOperationDropsResource) + { + auto createResource = []() { return make_ref<TestResource>(); }; + + Pool<TestResource> pool = Pool<TestResource>((size_t)1, createResource); + + ASSERT_THROW({ + auto _r = pool.get(); + ASSERT_EQ(pool.count(), 1); + throw 1; + }, int); + + ASSERT_EQ(pool.count(), 0); + } } diff --git a/tests/unit/libutil/references.cc b/tests/unit/libutil/references.cc index a517d9aa1..be2b59051 100644 --- a/tests/unit/libutil/references.cc +++ b/tests/unit/libutil/references.cc @@ -43,4 +43,3 @@ INSTANTIATE_TEST_CASE_P( ); } - |