mirror of
https://github.com/NixOS/nix
synced 2025-07-10 04:43:53 +02:00
Move tests to separate directories, and document
Today, with the tests inside a `tests` intermingled with the corresponding library's source code, we have a few problems: - We have to be careful that wildcards don't end up with tests being built as part of Nix proper, or test headers being installed as part of Nix proper. - Tests in libraries but not executables is not right: - It means each executable runs the previous unit tests again, because it needs the libraries. - It doesn't work right on Windows, which doesn't want you to load a DLL just for the side global variable . It could be made to work with the dlopen equivalent, but that's gross! This reorg solves these problems. There is a remaining problem which is that sibbling headers (like `hash.hh` the test header vs `hash.hh` the main `libnixutil` header) end up shadowing each other. This PR doesn't solve that. That is left as future work for a future PR. Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io>
This commit is contained in:
parent
77adb55ae4
commit
91b6833686
134 changed files with 464 additions and 352 deletions
BIN
tests/unit/libstore/data/common-protocol/content-address.bin
Normal file
BIN
tests/unit/libstore/data/common-protocol/content-address.bin
Normal file
Binary file not shown.
BIN
tests/unit/libstore/data/common-protocol/drv-output.bin
Normal file
BIN
tests/unit/libstore/data/common-protocol/drv-output.bin
Normal file
Binary file not shown.
Binary file not shown.
BIN
tests/unit/libstore/data/common-protocol/optional-store-path.bin
Normal file
BIN
tests/unit/libstore/data/common-protocol/optional-store-path.bin
Normal file
Binary file not shown.
BIN
tests/unit/libstore/data/common-protocol/realisation.bin
Normal file
BIN
tests/unit/libstore/data/common-protocol/realisation.bin
Normal file
Binary file not shown.
BIN
tests/unit/libstore/data/common-protocol/set.bin
Normal file
BIN
tests/unit/libstore/data/common-protocol/set.bin
Normal file
Binary file not shown.
BIN
tests/unit/libstore/data/common-protocol/store-path.bin
Normal file
BIN
tests/unit/libstore/data/common-protocol/store-path.bin
Normal file
Binary file not shown.
BIN
tests/unit/libstore/data/common-protocol/string.bin
Normal file
BIN
tests/unit/libstore/data/common-protocol/string.bin
Normal file
Binary file not shown.
BIN
tests/unit/libstore/data/common-protocol/vector.bin
Normal file
BIN
tests/unit/libstore/data/common-protocol/vector.bin
Normal file
Binary file not shown.
|
@ -0,0 +1 @@
|
|||
Derive([],[("/nix/store/c015dhfh5l0lp6wxyvdn7bmwhbbr6hr9-dep2.drv",(["cat","dog"],[("cat",["kitten"]),("goose",["gosling"])]))],["/nix/store/c015dhfh5l0lp6wxyvdn7bmwhbbr6hr9-dep1"],"wasm-sel4","foo",["bar","baz"],[("BIG_BAD","WOLF")])
|
1
tests/unit/libstore/data/derivation/bad-version.drv
Normal file
1
tests/unit/libstore/data/derivation/bad-version.drv
Normal file
|
@ -0,0 +1 @@
|
|||
DrvWithVersion("invalid-version",[],[("/nix/store/c015dhfh5l0lp6wxyvdn7bmwhbbr6hr9-dep2.drv",["cat","dog"])],["/nix/store/c015dhfh5l0lp6wxyvdn7bmwhbbr6hr9-dep1"],"wasm-sel4","foo",["bar","baz"],[("BIG_BAD","WOLF")])
|
|
@ -0,0 +1 @@
|
|||
DrvWithVersion("xp-dyn-drv",[],[("/nix/store/c015dhfh5l0lp6wxyvdn7bmwhbbr6hr9-dep2.drv",(["cat","dog"],[("cat",["kitten"]),("goose",["gosling"])]))],["/nix/store/c015dhfh5l0lp6wxyvdn7bmwhbbr6hr9-dep1"],"wasm-sel4","foo",["bar","baz"],[("BIG_BAD","WOLF")])
|
38
tests/unit/libstore/data/derivation/dynDerivationDeps.json
Normal file
38
tests/unit/libstore/data/derivation/dynDerivationDeps.json
Normal file
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
"args": [
|
||||
"bar",
|
||||
"baz"
|
||||
],
|
||||
"builder": "foo",
|
||||
"env": {
|
||||
"BIG_BAD": "WOLF"
|
||||
},
|
||||
"inputDrvs": {
|
||||
"/nix/store/c015dhfh5l0lp6wxyvdn7bmwhbbr6hr9-dep2.drv": {
|
||||
"dynamicOutputs": {
|
||||
"cat": {
|
||||
"dynamicOutputs": {},
|
||||
"outputs": [
|
||||
"kitten"
|
||||
]
|
||||
},
|
||||
"goose": {
|
||||
"dynamicOutputs": {},
|
||||
"outputs": [
|
||||
"gosling"
|
||||
]
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
"cat",
|
||||
"dog"
|
||||
]
|
||||
}
|
||||
},
|
||||
"inputSrcs": [
|
||||
"/nix/store/c015dhfh5l0lp6wxyvdn7bmwhbbr6hr9-dep1"
|
||||
],
|
||||
"name": "dyn-dep-derivation",
|
||||
"outputs": {},
|
||||
"system": "wasm-sel4"
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"hash": "894517c9163c896ec31a2adbd33c0681fd5f45b2c0ef08a64c92a03fb97f390f",
|
||||
"hashAlgo": "sha256",
|
||||
"path": "/nix/store/rhcg9h16sqvlbpsa6dqm57sbr2al6nzg-drv-name-output-name"
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"hash": "894517c9163c896ec31a2adbd33c0681fd5f45b2c0ef08a64c92a03fb97f390f",
|
||||
"hashAlgo": "r:sha256",
|
||||
"path": "/nix/store/c015dhfh5l0lp6wxyvdn7bmwhbbr6hr9-drv-name-output-name"
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"hash": "894517c9163c896ec31a2adbd33c0681fd5f45b2c0ef08a64c92a03fb97f390f",
|
||||
"hashAlgo": "text:sha256",
|
||||
"path": "/nix/store/6s1zwabh956jvhv4w9xcdb5jiyanyxg1-drv-name-output-name"
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"hashAlgo": "r:sha256"
|
||||
}
|
1
tests/unit/libstore/data/derivation/output-deferred.json
Normal file
1
tests/unit/libstore/data/derivation/output-deferred.json
Normal file
|
@ -0,0 +1 @@
|
|||
{}
|
4
tests/unit/libstore/data/derivation/output-impure.json
Normal file
4
tests/unit/libstore/data/derivation/output-impure.json
Normal file
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"hashAlgo": "r:sha256",
|
||||
"impure": true
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"path": "/nix/store/c015dhfh5l0lp6wxyvdn7bmwhbbr6hr9-drv-name-output-name"
|
||||
}
|
1
tests/unit/libstore/data/derivation/simple.drv
Normal file
1
tests/unit/libstore/data/derivation/simple.drv
Normal file
|
@ -0,0 +1 @@
|
|||
Derive([],[("/nix/store/c015dhfh5l0lp6wxyvdn7bmwhbbr6hr9-dep2.drv",["cat","dog"])],["/nix/store/c015dhfh5l0lp6wxyvdn7bmwhbbr6hr9-dep1"],"wasm-sel4","foo",["bar","baz"],[("BIG_BAD","WOLF")])
|
25
tests/unit/libstore/data/derivation/simple.json
Normal file
25
tests/unit/libstore/data/derivation/simple.json
Normal file
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
"args": [
|
||||
"bar",
|
||||
"baz"
|
||||
],
|
||||
"builder": "foo",
|
||||
"env": {
|
||||
"BIG_BAD": "WOLF"
|
||||
},
|
||||
"inputDrvs": {
|
||||
"/nix/store/c015dhfh5l0lp6wxyvdn7bmwhbbr6hr9-dep2.drv": {
|
||||
"dynamicOutputs": {},
|
||||
"outputs": [
|
||||
"cat",
|
||||
"dog"
|
||||
]
|
||||
}
|
||||
},
|
||||
"inputSrcs": [
|
||||
"/nix/store/c015dhfh5l0lp6wxyvdn7bmwhbbr6hr9-dep1"
|
||||
],
|
||||
"name": "simple-derivation",
|
||||
"outputs": {},
|
||||
"system": "wasm-sel4"
|
||||
}
|
20
tests/unit/libstore/data/nar-info/impure.json
Normal file
20
tests/unit/libstore/data/nar-info/impure.json
Normal file
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"ca": "fixed:r:sha256:1lr187v6dck1rjh2j6svpikcfz53wyl3qrlcbb405zlh13x0khhh",
|
||||
"compression": "xz",
|
||||
"deriver": "/nix/store/g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-bar.drv",
|
||||
"downloadHash": "sha256-FePFYIlMuycIXPZbWi7LGEiMmZSX9FMbaQenWBzm1Sc=",
|
||||
"downloadSize": 4029176,
|
||||
"narHash": "sha256-FePFYIlMuycIXPZbWi7LGEiMmZSX9FMbaQenWBzm1Sc=",
|
||||
"narSize": 34878,
|
||||
"references": [
|
||||
"/nix/store/g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-bar",
|
||||
"/nix/store/n5wkd9frr45pa74if5gpz9j7mifg27fh-foo"
|
||||
],
|
||||
"registrationTime": 23423,
|
||||
"signatures": [
|
||||
"asdf",
|
||||
"qwer"
|
||||
],
|
||||
"ultimate": true,
|
||||
"url": "nar/1w1fff338fvdw53sqgamddn1b2xgds473pv6y13gizdbqjv4i5p3.nar.xz"
|
||||
}
|
9
tests/unit/libstore/data/nar-info/pure.json
Normal file
9
tests/unit/libstore/data/nar-info/pure.json
Normal file
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"ca": "fixed:r:sha256:1lr187v6dck1rjh2j6svpikcfz53wyl3qrlcbb405zlh13x0khhh",
|
||||
"narHash": "sha256-FePFYIlMuycIXPZbWi7LGEiMmZSX9FMbaQenWBzm1Sc=",
|
||||
"narSize": 34878,
|
||||
"references": [
|
||||
"/nix/store/g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-bar",
|
||||
"/nix/store/n5wkd9frr45pa74if5gpz9j7mifg27fh-foo"
|
||||
]
|
||||
}
|
16
tests/unit/libstore/data/path-info/impure.json
Normal file
16
tests/unit/libstore/data/path-info/impure.json
Normal file
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
"ca": "fixed:r:sha256:1lr187v6dck1rjh2j6svpikcfz53wyl3qrlcbb405zlh13x0khhh",
|
||||
"deriver": "/nix/store/g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-bar.drv",
|
||||
"narHash": "sha256-FePFYIlMuycIXPZbWi7LGEiMmZSX9FMbaQenWBzm1Sc=",
|
||||
"narSize": 34878,
|
||||
"references": [
|
||||
"/nix/store/g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-bar",
|
||||
"/nix/store/n5wkd9frr45pa74if5gpz9j7mifg27fh-foo"
|
||||
],
|
||||
"registrationTime": 23423,
|
||||
"signatures": [
|
||||
"asdf",
|
||||
"qwer"
|
||||
],
|
||||
"ultimate": true
|
||||
}
|
9
tests/unit/libstore/data/path-info/pure.json
Normal file
9
tests/unit/libstore/data/path-info/pure.json
Normal file
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"ca": "fixed:r:sha256:1lr187v6dck1rjh2j6svpikcfz53wyl3qrlcbb405zlh13x0khhh",
|
||||
"narHash": "sha256-FePFYIlMuycIXPZbWi7LGEiMmZSX9FMbaQenWBzm1Sc=",
|
||||
"narSize": 34878,
|
||||
"references": [
|
||||
"/nix/store/g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-bar",
|
||||
"/nix/store/n5wkd9frr45pa74if5gpz9j7mifg27fh-foo"
|
||||
]
|
||||
}
|
BIN
tests/unit/libstore/data/serve-protocol/build-result-2.2.bin
Normal file
BIN
tests/unit/libstore/data/serve-protocol/build-result-2.2.bin
Normal file
Binary file not shown.
BIN
tests/unit/libstore/data/serve-protocol/build-result-2.3.bin
Normal file
BIN
tests/unit/libstore/data/serve-protocol/build-result-2.3.bin
Normal file
Binary file not shown.
BIN
tests/unit/libstore/data/serve-protocol/build-result-2.6.bin
Normal file
BIN
tests/unit/libstore/data/serve-protocol/build-result-2.6.bin
Normal file
Binary file not shown.
BIN
tests/unit/libstore/data/serve-protocol/content-address.bin
Normal file
BIN
tests/unit/libstore/data/serve-protocol/content-address.bin
Normal file
Binary file not shown.
BIN
tests/unit/libstore/data/serve-protocol/drv-output.bin
Normal file
BIN
tests/unit/libstore/data/serve-protocol/drv-output.bin
Normal file
Binary file not shown.
Binary file not shown.
BIN
tests/unit/libstore/data/serve-protocol/optional-store-path.bin
Normal file
BIN
tests/unit/libstore/data/serve-protocol/optional-store-path.bin
Normal file
Binary file not shown.
BIN
tests/unit/libstore/data/serve-protocol/realisation.bin
Normal file
BIN
tests/unit/libstore/data/serve-protocol/realisation.bin
Normal file
Binary file not shown.
BIN
tests/unit/libstore/data/serve-protocol/set.bin
Normal file
BIN
tests/unit/libstore/data/serve-protocol/set.bin
Normal file
Binary file not shown.
BIN
tests/unit/libstore/data/serve-protocol/store-path.bin
Normal file
BIN
tests/unit/libstore/data/serve-protocol/store-path.bin
Normal file
Binary file not shown.
BIN
tests/unit/libstore/data/serve-protocol/string.bin
Normal file
BIN
tests/unit/libstore/data/serve-protocol/string.bin
Normal file
Binary file not shown.
BIN
tests/unit/libstore/data/serve-protocol/vector.bin
Normal file
BIN
tests/unit/libstore/data/serve-protocol/vector.bin
Normal file
Binary file not shown.
BIN
tests/unit/libstore/data/worker-protocol/build-result-1.27.bin
Normal file
BIN
tests/unit/libstore/data/worker-protocol/build-result-1.27.bin
Normal file
Binary file not shown.
BIN
tests/unit/libstore/data/worker-protocol/build-result-1.28.bin
Normal file
BIN
tests/unit/libstore/data/worker-protocol/build-result-1.28.bin
Normal file
Binary file not shown.
BIN
tests/unit/libstore/data/worker-protocol/build-result-1.29.bin
Normal file
BIN
tests/unit/libstore/data/worker-protocol/build-result-1.29.bin
Normal file
Binary file not shown.
BIN
tests/unit/libstore/data/worker-protocol/content-address.bin
Normal file
BIN
tests/unit/libstore/data/worker-protocol/content-address.bin
Normal file
Binary file not shown.
BIN
tests/unit/libstore/data/worker-protocol/derived-path-1.29.bin
Normal file
BIN
tests/unit/libstore/data/worker-protocol/derived-path-1.29.bin
Normal file
Binary file not shown.
BIN
tests/unit/libstore/data/worker-protocol/derived-path-1.30.bin
Normal file
BIN
tests/unit/libstore/data/worker-protocol/derived-path-1.30.bin
Normal file
Binary file not shown.
BIN
tests/unit/libstore/data/worker-protocol/drv-output.bin
Normal file
BIN
tests/unit/libstore/data/worker-protocol/drv-output.bin
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
tests/unit/libstore/data/worker-protocol/optional-store-path.bin
Normal file
BIN
tests/unit/libstore/data/worker-protocol/optional-store-path.bin
Normal file
Binary file not shown.
Binary file not shown.
BIN
tests/unit/libstore/data/worker-protocol/realisation.bin
Normal file
BIN
tests/unit/libstore/data/worker-protocol/realisation.bin
Normal file
Binary file not shown.
BIN
tests/unit/libstore/data/worker-protocol/set.bin
Normal file
BIN
tests/unit/libstore/data/worker-protocol/set.bin
Normal file
Binary file not shown.
BIN
tests/unit/libstore/data/worker-protocol/store-path.bin
Normal file
BIN
tests/unit/libstore/data/worker-protocol/store-path.bin
Normal file
Binary file not shown.
BIN
tests/unit/libstore/data/worker-protocol/string.bin
Normal file
BIN
tests/unit/libstore/data/worker-protocol/string.bin
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
tests/unit/libstore/data/worker-protocol/vector.bin
Normal file
BIN
tests/unit/libstore/data/worker-protocol/vector.bin
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue