mirror of
https://github.com/NixOS/nix
synced 2025-06-27 12:41:15 +02:00
Move unit tests to the location Meson expects them to be
Everything that is a separate subproject should live in the subprojects
directory.
Progress on #2503
This reverts commit 451f8a8c19
.
This commit is contained in:
parent
1cd48008f0
commit
e65510da56
270 changed files with 158 additions and 168 deletions
31
src/libutil-tests/data/git/check-data.sh
Normal file
31
src/libutil-tests/data/git/check-data.sh
Normal file
|
@ -0,0 +1,31 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -eu -o pipefail
|
||||
|
||||
export TEST_ROOT=$(realpath ${TMPDIR:-/tmp}/nix-test)/git-hashing/check-data
|
||||
mkdir -p $TEST_ROOT
|
||||
|
||||
repo="$TEST_ROOT/scratch"
|
||||
git init "$repo"
|
||||
|
||||
git -C "$repo" config user.email "you@example.com"
|
||||
git -C "$repo" config user.name "Your Name"
|
||||
|
||||
# `-w` to write for tree test
|
||||
freshlyAddedHash=$(git -C "$repo" hash-object -w -t blob --stdin < "./hello-world.bin")
|
||||
encodingHash=$(sha1sum -b < "./hello-world-blob.bin" | head -c 40)
|
||||
|
||||
# If the hashes match, then `hello-world-blob.bin` must be the encoding
|
||||
# of `hello-world.bin`.
|
||||
[[ "$encodingHash" == "$freshlyAddedHash" ]]
|
||||
|
||||
# Create empty directory object for tree test
|
||||
echo -n | git -C "$repo" hash-object -w -t tree --stdin
|
||||
|
||||
# Relies on both child hashes already existing in the git store
|
||||
freshlyAddedHash=$(git -C "$repo" mktree < "./tree.txt")
|
||||
encodingHash=$(sha1sum -b < "./tree.bin" | head -c 40)
|
||||
|
||||
# If the hashes match, then `tree.bin` must be the encoding of the
|
||||
# directory denoted by `tree.txt` interpreted as git directory listing.
|
||||
[[ "$encodingHash" == "$freshlyAddedHash" ]]
|
BIN
src/libutil-tests/data/git/hello-world-blob.bin
Normal file
BIN
src/libutil-tests/data/git/hello-world-blob.bin
Normal file
Binary file not shown.
BIN
src/libutil-tests/data/git/hello-world.bin
Normal file
BIN
src/libutil-tests/data/git/hello-world.bin
Normal file
Binary file not shown.
BIN
src/libutil-tests/data/git/tree.bin
Normal file
BIN
src/libutil-tests/data/git/tree.bin
Normal file
Binary file not shown.
4
src/libutil-tests/data/git/tree.txt
Normal file
4
src/libutil-tests/data/git/tree.txt
Normal file
|
@ -0,0 +1,4 @@
|
|||
100644 blob 63ddb340119baf8492d2da53af47e8c7cfcd5eb2 Foo
|
||||
100755 blob 63ddb340119baf8492d2da53af47e8c7cfcd5eb2 bAr
|
||||
040000 tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904 baZ
|
||||
120000 blob 63ddb340119baf8492d2da53af47e8c7cfcd5eb2 quuX
|
Loading…
Add table
Add a link
Reference in a new issue