run-tests: make nixosSearch
compatible with --copy-src
This commit is contained in:
parent
2069f62abc
commit
f13ffe0146
@ -15,4 +15,4 @@ trap "atExit" EXIT
|
||||
|
||||
rsync -a --delete --exclude='.git*' "$scriptDir/../" $tmp/src
|
||||
echo "Copied src"
|
||||
_nixBitcoinInCopySrc=1 $tmp/src/test/run-tests.sh "${args[@]}"
|
||||
_nixBitcoinInCopiedSrc=1 $tmp/src/test/run-tests.sh "${args[@]}"
|
||||
|
13
test/lib/create-git-repo.sh
Normal file
13
test/lib/create-git-repo.sh
Normal file
@ -0,0 +1,13 @@
|
||||
# Create and maintain a minimal git repo at the root of the copied src
|
||||
(
|
||||
cd "$scriptDir/.."
|
||||
amend=--amend
|
||||
if [[ ! -e .git ]]; then
|
||||
git init
|
||||
amend=
|
||||
fi
|
||||
git add .
|
||||
if ! git diff --quiet --cached; then
|
||||
git commit -a $amend -m -
|
||||
fi
|
||||
) >/dev/null
|
@ -95,7 +95,7 @@ while :; do
|
||||
;;
|
||||
--copy-src|-c)
|
||||
shift
|
||||
if [[ ! $_nixBitcoinInCopySrc ]]; then
|
||||
if [[ ! $_nixBitcoinInCopiedSrc ]]; then
|
||||
. "$scriptDir/lib/copy-src.sh"
|
||||
exit
|
||||
fi
|
||||
@ -271,12 +271,17 @@ flake() {
|
||||
nixosSearch() {
|
||||
if ! checkFlakeSupport "nixosSearch"; then return; fi
|
||||
|
||||
if [[ $_nixBitcoinInCopiedSrc ]]; then
|
||||
# flake-info requires that its target flake is under version control
|
||||
. "$scriptDir/lib/create-git-repo.sh"
|
||||
fi
|
||||
|
||||
if [[ $outLinkPrefix ]]; then
|
||||
# Add gcroots for flake-info
|
||||
nix build $scriptDir/nixos-search#flake-info -o "$outLinkPrefix-flake-info"
|
||||
fi
|
||||
echo "Running flake-info (nixos-search)"
|
||||
nix run $scriptDir/nixos-search#flake-info -- flake ../.
|
||||
nix run $scriptDir/nixos-search#flake-info -- flake "$scriptDir/.."
|
||||
}
|
||||
|
||||
# A basic subset of tests to keep the total runtime within
|
||||
|
Loading…
Reference in New Issue
Block a user