Skip to content

Commit 80c4413

Browse files
SkamDartSuperSandro2000
authored andcommitted
housekeeping: shellcheck for tests/functional/ca/build-cache.sh
Co-authored-by: Sandro <[email protected]>
1 parent c127625 commit 80c4413

File tree

3 files changed

+17
-14
lines changed

3 files changed

+17
-14
lines changed

.shellcheckrc

+2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
external-sources=true
22
source-path=SCRIPTDIR
3+
# Hack for scripts in e.g. tests/functional/ca
4+
source-path=SCRIPTDIR/..

tests/functional/binary-cache.sh

+11-11
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ clearStore
1414
clearCache
1515
outPath=$(nix-build dependencies.nix --no-out-link)
1616

17-
nix copy --to file://"$cacheDir" "$outPath"
17+
nix copy --to "file://$cacheDir" "$outPath"
1818

19-
readarray -t paths < <(nix path-info --all --json --store file://"$cacheDir" | jq 'keys|sort|.[]' -r)
19+
readarray -t paths < <(nix path-info --all --json --store "file://$cacheDir" | jq 'keys|sort|.[]' -r)
2020
[[ "${#paths[@]}" -eq 3 ]]
2121
for path in "${paths[@]}"; do
2222
[[ "$path" =~ -dependencies-input-0$ ]] \
@@ -25,15 +25,15 @@ for path in "${paths[@]}"; do
2525
done
2626

2727
# Test copying build logs to the binary cache.
28-
expect 1 nix log --store file://"$cacheDir" "$outPath" 2>&1 | grep 'is not available'
29-
nix store copy-log --to file://"$cacheDir" "$outPath"
30-
nix log --store file://"$cacheDir" "$outPath" | grep FOO
28+
expect 1 nix log --store "file://$cacheDir" "$outPath" 2>&1 | grep 'is not available'
29+
nix store copy-log --to "file://$cacheDir" "$outPath"
30+
nix log --store "file://$cacheDir" "$outPath" | grep FOO
3131
rm -rf "$TEST_ROOT/var/log/nix"
3232
expect 1 nix log "$outPath" 2>&1 | grep 'is not available'
33-
nix log --substituters file://"$cacheDir" "$outPath" | grep FOO
33+
nix log --substituters "file://$cacheDir" "$outPath" | grep FOO
3434

3535
# Test copying build logs from the binary cache.
36-
nix store copy-log --from file://"$cacheDir" "$(nix-store -qd "$outPath")"^'*'
36+
nix store copy-log --from "file://$cacheDir" "$(nix-store -qd "$outPath")"^'*'
3737
nix log "$outPath" | grep FOO
3838

3939
basicDownloadTests() {
@@ -166,7 +166,7 @@ badKey=$(nix key convert-secret-to-public < "$TEST_ROOT/sk2")
166166
nix key generate-secret --key-name foo.nixos.org-1 > "$TEST_ROOT/sk3"
167167
otherKey=$(nix key convert-secret-to-public < "$TEST_ROOT/sk3")
168168

169-
_NIX_FORCE_HTTP='' nix copy --to file://"$cacheDir"?secret-key="$TEST_ROOT"/sk1 "$outPath"
169+
_NIX_FORCE_HTTP='' nix copy --to "file://$cacheDir"?secret-key="$TEST_ROOT"/sk1 "$outPath"
170170

171171

172172
# Downloading should fail if we don't provide a key.
@@ -212,7 +212,7 @@ unset _NIX_FORCE_HTTP
212212

213213

214214
# Test 'nix verify --all' on a binary cache.
215-
nix store verify -vvvvv --all --store file://"$cacheDir" --no-trust
215+
nix store verify -vvvvv --all --store "file://$cacheDir" --no-trust
216216

217217

218218
# Test local NAR caching.
@@ -226,7 +226,7 @@ rm -rfv "$cacheDir/nar"
226226

227227
[[ $(nix store cat --store "file://$cacheDir?local-nar-cache=$narCache" "$outPath/foobar") = FOOBAR ]]
228228

229-
(! nix store cat --store file://"$cacheDir" "$outPath/foobar")
229+
(! nix store cat --store "file://$cacheDir" "$outPath/foobar")
230230

231231

232232
# Test NAR listing generation.
@@ -243,7 +243,7 @@ outPath=$(nix-build --no-out-link -E '
243243
}
244244
')
245245

246-
nix copy --to file://"$cacheDir"?write-nar-listing=1 "$outPath"
246+
nix copy --to "file://$cacheDir"?write-nar-listing=1 "$outPath"
247247

248248
diff -u \
249249
<(jq -S < "$cacheDir/$(basename "$outPath" | cut -c1-32).ls") \

tests/functional/ca/build-cache.sh

+4-3
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ copyAttr () {
2626
# Note: to copy CA derivations, we need to copy the realisations, which
2727
# currently requires naming the installables, not just the derivation output
2828
# path.
29-
nix copy --to file://$cacheDir "${args[@]}"
29+
30+
nix copy --to "file://$cacheDir" "${args[@]}"
3031
}
3132

3233
testRemoteCacheFor () {
@@ -35,7 +36,7 @@ testRemoteCacheFor () {
3536
copyAttr "$derivationPath" 1
3637
clearStore
3738
# Check nothing gets built.
38-
buildAttr "$derivationPath" 1 --option substituters file://$cacheDir --no-require-sigs |& grepQuietInverse " will be built:"
39+
buildAttr "$derivationPath" 1 --option substituters "file://$cacheDir" --no-require-sigs |& grepQuietInverse " will be built:"
3940
}
4041

4142
testRemoteCache () {
@@ -48,4 +49,4 @@ testRemoteCache () {
4849
}
4950

5051
clearStore
51-
testRemoteCache
52+
testRemoteCache

0 commit comments

Comments
 (0)