1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-08 11:03:54 +02:00

Expand shellcheck coverage in functional tests

Ref NixOS/nix#10795
This commit is contained in:
Tim Van Baak 2024-10-29 21:33:28 -07:00
parent a8e600e386
commit a75b082a28
12 changed files with 159 additions and 163 deletions

View file

@ -1,10 +1,13 @@
#!/usr/bin/env bash
source ../common.sh
# shellcheck disable=SC2034 # this variable is used by tests that source this file
registry=$TEST_ROOT/registry.json
writeSimpleFlake() {
local flakeDir="$1"
cat > $flakeDir/flake.nix <<EOF
cat > "$flakeDir/flake.nix" <<EOF
{
description = "Bla bla";
@ -31,19 +34,19 @@ writeSimpleFlake() {
}
EOF
cp ../simple.nix ../shell.nix ../simple.builder.sh ../config.nix $flakeDir/
cp ../simple.nix ../shell.nix ../simple.builder.sh ../config.nix "$flakeDir/"
}
createSimpleGitFlake() {
local flakeDir="$1"
writeSimpleFlake $flakeDir
git -C $flakeDir add flake.nix simple.nix shell.nix simple.builder.sh config.nix
git -C $flakeDir commit -m 'Initial'
writeSimpleFlake "$flakeDir"
git -C "$flakeDir" add flake.nix simple.nix shell.nix simple.builder.sh config.nix
git -C "$flakeDir" commit -m 'Initial'
}
writeDependentFlake() {
local flakeDir="$1"
cat > $flakeDir/flake.nix <<EOF
cat > "$flakeDir/flake.nix" <<EOF
{
outputs = { self, flake1 }: {
packages.$system.default = flake1.packages.$system.default;
@ -55,7 +58,7 @@ EOF
writeTrivialFlake() {
local flakeDir="$1"
cat > $flakeDir/flake.nix <<EOF
cat > "$flakeDir/flake.nix" <<EOF
{
outputs = { self }: {
expr = 123;
@ -71,6 +74,7 @@ createGitRepo() {
rm -rf "$repo" "$repo".tmp
mkdir -p "$repo"
# shellcheck disable=SC2086 # word splitting of extraArgs is intended
git -C "$repo" init $extraArgs
git -C "$repo" config user.email "foobar@example.com"
git -C "$repo" config user.name "Foobar"