Move around unit test dirs to match new names

This commit is contained in:
John Ericson 2024-06-29 10:31:08 -04:00
parent 3ad39d2afb
commit 496b4a9cd2
213 changed files with 112 additions and 112 deletions

10
.gitignore vendored
View File

@ -49,22 +49,22 @@ perl/Makefile.config
/src/libexpr/parser-tab.output /src/libexpr/parser-tab.output
/src/libexpr/nix.tbl /src/libexpr/nix.tbl
/src/libexpr/tests /src/libexpr/tests
/src/libexpr-test/libnixexpr-tests /src/nix-expr-tests/libnixexpr-tests
# /src/libfetchers # /src/libfetchers
/src/libfetchers-test/libnixfetchers-tests /src/nix-fetchers-tests/libnixfetchers-tests
# /src/libflake # /src/libflake
/src/libflake-test/libnixflake-tests /src/nix-flake-tests/libnixflake-tests
# /src/libstore/ # /src/libstore/
*.gen.* *.gen.*
/src/libstore/tests /src/libstore/tests
/src/libstore-test/libnixstore-tests /src/nix-store-tests/libnixstore-tests
# /src/libutil/ # /src/libutil/
/src/libutil/tests /src/libutil/tests
/src/libutil-test/libnixutil-tests /src/nix-util-tests/libnixutil-tests
/src/nix/nix /src/nix/nix

View File

@ -60,10 +60,10 @@ The unit tests are defined using the [googletest] and [rapidcheck] frameworks.
> ``` > ```
The tests for each Nix library (`libnixexpr`, `libnixstore`, etc..) live inside a directory `src/${library_name_without-nix}-test`. The tests for each Nix library (`libnixexpr`, `libnixstore`, etc..) live inside a directory `src/${library_name_without-nix}-test`.
Given an interface (header) and implementation pair in the original library, say, `src/libexpr/value/context.{hh,cc}`, we write tests for it in `src/libexpr-test/value/context.cc`, and (possibly) declare/define additional interfaces for testing purposes in `src/libexpr-test-support/tests/value/context.{hh,cc}`. Given an interface (header) and implementation pair in the original library, say, `src/libexpr/value/context.{hh,cc}`, we write tests for it in `src/nix-expr-tests/value/context.cc`, and (possibly) declare/define additional interfaces for testing purposes in `src/nix-expr-test-support/tests/value/context.{hh,cc}`.
Data for unit tests is stored in a `data` subdir of the directory for each unit test executable. Data for unit tests is stored in a `data` subdir of the directory for each unit test executable.
For example, `libnixstore` code is in `src/libstore`, and its test data is in `src/libstore-test/data`. For example, `libnixstore` code is in `src/libstore`, and its test data is in `src/nix-store-tests/data`.
The path to the `src/${library_name_without-nix}-test/data` directory is passed to the unit test executable with the environment variable `_NIX_TEST_UNIT_DATA`. The path to the `src/${library_name_without-nix}-test/data` directory is passed to the unit test executable with the environment variable `_NIX_TEST_UNIT_DATA`.
Note that each executable only gets the data for its tests. Note that each executable only gets the data for its tests.

View File

@ -429,65 +429,65 @@
''^tests/nixos/ca-fd-leak/sender\.c'' ''^tests/nixos/ca-fd-leak/sender\.c''
''^tests/nixos/ca-fd-leak/smuggler\.c'' ''^tests/nixos/ca-fd-leak/smuggler\.c''
''^tests/nixos/user-sandboxing/attacker\.c'' ''^tests/nixos/user-sandboxing/attacker\.c''
''^src/libexpr-test-support/tests/libexpr\.hh'' ''^src/nix-expr-test-support/tests/libexpr\.hh''
''^src/libexpr-test-support/tests/value/context\.cc'' ''^src/nix-expr-test-support/tests/value/context\.cc''
''^src/libexpr-test-support/tests/value/context\.hh'' ''^src/nix-expr-test-support/tests/value/context\.hh''
''^src/libexpr-test/derived-path\.cc'' ''^src/nix-expr-tests/derived-path\.cc''
''^src/libexpr-test/error_traces\.cc'' ''^src/nix-expr-tests/error_traces\.cc''
''^src/libexpr-test/eval\.cc'' ''^src/nix-expr-tests/eval\.cc''
''^src/libexpr-test/json\.cc'' ''^src/nix-expr-tests/json\.cc''
''^src/libexpr-test/main\.cc'' ''^src/nix-expr-tests/main\.cc''
''^src/libexpr-test/primops\.cc'' ''^src/nix-expr-tests/primops\.cc''
''^src/libexpr-test/search-path\.cc'' ''^src/nix-expr-tests/search-path\.cc''
''^src/libexpr-test/trivial\.cc'' ''^src/nix-expr-tests/trivial\.cc''
''^src/libexpr-test/value/context\.cc'' ''^src/nix-expr-tests/value/context\.cc''
''^src/libexpr-test/value/print\.cc'' ''^src/nix-expr-tests/value/print\.cc''
''^src/libfetchers-test/public-key\.cc'' ''^src/nix-fetchers-tests/public-key\.cc''
''^src/libflake-test/flakeref\.cc'' ''^src/nix-flake-tests/flakeref\.cc''
''^src/libflake-test/url-name\.cc'' ''^src/nix-flake-tests/url-name\.cc''
''^src/libstore-test-support/tests/derived-path\.cc'' ''^src/nix-store-test-support/tests/derived-path\.cc''
''^src/libstore-test-support/tests/derived-path\.hh'' ''^src/nix-store-test-support/tests/derived-path\.hh''
''^src/libstore-test-support/tests/nix_api_store\.hh'' ''^src/nix-store-test-support/tests/nix_api_store\.hh''
''^src/libstore-test-support/tests/outputs-spec\.cc'' ''^src/nix-store-test-support/tests/outputs-spec\.cc''
''^src/libstore-test-support/tests/outputs-spec\.hh'' ''^src/nix-store-test-support/tests/outputs-spec\.hh''
''^src/libstore-test-support/tests/path\.cc'' ''^src/nix-store-test-support/tests/path\.cc''
''^src/libstore-test-support/tests/path\.hh'' ''^src/nix-store-test-support/tests/path\.hh''
''^src/libstore-test-support/tests/protocol\.hh'' ''^src/nix-store-test-support/tests/protocol\.hh''
''^src/libstore-test/common-protocol\.cc'' ''^src/nix-store-tests/common-protocol\.cc''
''^src/libstore-test/content-address\.cc'' ''^src/nix-store-tests/content-address\.cc''
''^src/libstore-test/derivation\.cc'' ''^src/nix-store-tests/derivation\.cc''
''^src/libstore-test/derived-path\.cc'' ''^src/nix-store-tests/derived-path\.cc''
''^src/libstore-test/downstream-placeholder\.cc'' ''^src/nix-store-tests/downstream-placeholder\.cc''
''^src/libstore-test/machines\.cc'' ''^src/nix-store-tests/machines\.cc''
''^src/libstore-test/nar-info-disk-cache\.cc'' ''^src/nix-store-tests/nar-info-disk-cache\.cc''
''^src/libstore-test/nar-info\.cc'' ''^src/nix-store-tests/nar-info\.cc''
''^src/libstore-test/outputs-spec\.cc'' ''^src/nix-store-tests/outputs-spec\.cc''
''^src/libstore-test/path-info\.cc'' ''^src/nix-store-tests/path-info\.cc''
''^src/libstore-test/path\.cc'' ''^src/nix-store-tests/path\.cc''
''^src/libstore-test/serve-protocol\.cc'' ''^src/nix-store-tests/serve-protocol\.cc''
''^src/libstore-test/worker-protocol\.cc'' ''^src/nix-store-tests/worker-protocol\.cc''
''^src/libutil-test-support/tests/characterization\.hh'' ''^src/nix-util-test-support/tests/characterization\.hh''
''^src/libutil-test-support/tests/hash\.cc'' ''^src/nix-util-test-support/tests/hash\.cc''
''^src/libutil-test-support/tests/hash\.hh'' ''^src/nix-util-test-support/tests/hash\.hh''
''^src/libutil-test/args\.cc'' ''^src/nix-util-tests/args\.cc''
''^src/libutil-test/canon-path\.cc'' ''^src/nix-util-tests/canon-path\.cc''
''^src/libutil-test/chunked-vector\.cc'' ''^src/nix-util-tests/chunked-vector\.cc''
''^src/libutil-test/closure\.cc'' ''^src/nix-util-tests/closure\.cc''
''^src/libutil-test/compression\.cc'' ''^src/nix-util-tests/compression\.cc''
''^src/libutil-test/config\.cc'' ''^src/nix-util-tests/config\.cc''
''^src/libutil-test/file-content-address\.cc'' ''^src/nix-util-tests/file-content-address\.cc''
''^src/libutil-test/git\.cc'' ''^src/nix-util-tests/git\.cc''
''^src/libutil-test/hash\.cc'' ''^src/nix-util-tests/hash\.cc''
''^src/libutil-test/hilite\.cc'' ''^src/nix-util-tests/hilite\.cc''
''^src/libutil-test/json-utils\.cc'' ''^src/nix-util-tests/json-utils\.cc''
''^src/libutil-test/logging\.cc'' ''^src/nix-util-tests/logging\.cc''
''^src/libutil-test/lru-cache\.cc'' ''^src/nix-util-tests/lru-cache\.cc''
''^src/libutil-test/pool\.cc'' ''^src/nix-util-tests/pool\.cc''
''^src/libutil-test/references\.cc'' ''^src/nix-util-tests/references\.cc''
''^src/libutil-test/suggestions\.cc'' ''^src/nix-util-tests/suggestions\.cc''
''^src/libutil-test/tests\.cc'' ''^src/nix-util-tests/tests\.cc''
''^src/libutil-test/url\.cc'' ''^src/nix-util-tests/url\.cc''
''^src/libutil-test/xml-writer\.cc'' ''^src/nix-util-tests/xml-writer\.cc''
]; ];
}; };
shellcheck = { shellcheck = {
@ -666,7 +666,7 @@
''^tests/functional/user-envs\.sh$'' ''^tests/functional/user-envs\.sh$''
''^tests/functional/why-depends\.sh$'' ''^tests/functional/why-depends\.sh$''
''^tests/functional/zstd\.sh$'' ''^tests/functional/zstd\.sh$''
''^src/libutil-test/data/git/check-data\.sh$'' ''^src/nix-util-tests/data/git/check-data\.sh$''
]; ];
}; };
# TODO: nixfmt, https://github.com/NixOS/nixfmt/issues/153 # TODO: nixfmt, https://github.com/NixOS/nixfmt/issues/153

View File

@ -25,11 +25,11 @@ subproject('libexpr-c')
subproject('perl') subproject('perl')
# Testing # Testing
subproject('libutil-test-support') subproject('nix-util-test-support')
subproject('libutil-test') subproject('nix-util-tests')
subproject('libstore-test-support') subproject('nix-store-test-support')
subproject('libstore-test') subproject('nix-store-tests')
subproject('libfetchers-test') subproject('nix-fetchers-tests')
subproject('libexpr-test-support') subproject('nix-expr-test-support')
subproject('libexpr-test') subproject('nix-expr-tests')
subproject('libflake-test') subproject('nix-flake-tests')

View File

@ -9,24 +9,24 @@ in
nix-util = callPackage ../src/libutil/package.nix { }; nix-util = callPackage ../src/libutil/package.nix { };
nix-util-c = callPackage ../src/libutil-c/package.nix { }; nix-util-c = callPackage ../src/libutil-c/package.nix { };
nix-util-test-support = callPackage ../src/libutil-test-support/package.nix { }; nix-util-test-support = callPackage ../src/nix-util-test-support/package.nix { };
nix-util-test = callPackage ../src/libutil-test/package.nix { }; nix-util-tests = callPackage ../src/nix-util-tests/package.nix { };
nix-store = callPackage ../src/libstore/package.nix { }; nix-store = callPackage ../src/libstore/package.nix { };
nix-store-c = callPackage ../src/libstore-c/package.nix { }; nix-store-c = callPackage ../src/libstore-c/package.nix { };
nix-store-test-support = callPackage ../src/libstore-test-support/package.nix { }; nix-store-test-support = callPackage ../src/nix-store-test-support/package.nix { };
nix-store-test = callPackage ../src/libstore-test/package.nix { }; nix-store-tests = callPackage ../src/nix-store-tests/package.nix { };
nix-fetchers = callPackage ../src/libfetchers/package.nix { }; nix-fetchers = callPackage ../src/libfetchers/package.nix { };
nix-fetchers-test = callPackage ../src/libfetchers-test/package.nix { }; nix-fetchers-tests = callPackage ../src/nix-fetchers-tests/package.nix { };
nix-expr = callPackage ../src/libexpr/package.nix { }; nix-expr = callPackage ../src/libexpr/package.nix { };
nix-expr-c = callPackage ../src/libexpr-c/package.nix { }; nix-expr-c = callPackage ../src/libexpr-c/package.nix { };
nix-expr-test-support = callPackage ../src/libexpr-test-support/package.nix { }; nix-expr-test-support = callPackage ../src/nix-expr-test-support/package.nix { };
nix-expr-test = callPackage ../src/libexpr-test/package.nix { }; nix-expr-tests = callPackage ../src/nix-expr-tests/package.nix { };
nix-flake = callPackage ../src/libflake/package.nix { }; nix-flake = callPackage ../src/libflake/package.nix { };
nix-flake-test = callPackage ../src/libflake-test/package.nix { }; nix-flake-tests = callPackage ../src/nix-flake-tests/package.nix { };
nix-internal-api-docs = callPackage ../src/internal-api-docs/package.nix { }; nix-internal-api-docs = callPackage ../src/internal-api-docs/package.nix { };
nix-external-api-docs = callPackage ../src/external-api-docs/package.nix { }; nix-external-api-docs = callPackage ../src/external-api-docs/package.nix { };

View File

@ -38,19 +38,19 @@ let
"nix-util" "nix-util"
"nix-util-c" "nix-util-c"
"nix-util-test-support" "nix-util-test-support"
"nix-util-test" "nix-util-tests"
"nix-store" "nix-store"
"nix-store-c" "nix-store-c"
"nix-store-test-support" "nix-store-test-support"
"nix-store-test" "nix-store-tests"
"nix-fetchers" "nix-fetchers"
"nix-fetchers-test" "nix-fetchers-tests"
"nix-expr" "nix-expr"
"nix-expr-c" "nix-expr-c"
"nix-expr-test-support" "nix-expr-test-support"
"nix-expr-test" "nix-expr-tests"
"nix-flake" "nix-flake"
"nix-flake-test" "nix-flake-tests"
]; ];
in in
{ {

View File

@ -41,21 +41,21 @@ INPUT = \
@src@/libcmd \ @src@/libcmd \
@src@/libexpr \ @src@/libexpr \
@src@/libexpr/flake \ @src@/libexpr/flake \
@src@/libexpr-test \ @src@/nix-expr-tests \
@src@/libexpr-test/value \ @src@/nix-expr-tests/value \
@src@/libexpr-test-support/test \ @src@/nix-expr-test-support/test \
@src@/libexpr-test-support/test/value \ @src@/nix-expr-test-support/test/value \
@src@/libexpr/value \ @src@/libexpr/value \
@src@/libfetchers \ @src@/libfetchers \
@src@/libmain \ @src@/libmain \
@src@/libstore \ @src@/libstore \
@src@/libstore/build \ @src@/libstore/build \
@src@/libstore/builtins \ @src@/libstore/builtins \
@src@/libstore-test \ @src@/nix-store-tests \
@src@/libstore-test-support/test \ @src@/nix-store-test-support/test \
@src@/libutil \ @src@/libutil \
@src@/libutil-test \ @src@/nix-util-tests \
@src@/libutil-test-support/test \ @src@/nix-util-test-support/test \
@src@/nix \ @src@/nix \
@src@/nix-env \ @src@/nix-env \
@src@/nix-store @src@/nix-store

View File

@ -1,4 +1,4 @@
project('nix-expr-test', 'cpp', project('nix-expr-tests', 'cpp',
version : files('.version'), version : files('.version'),
default_options : [ default_options : [
'cpp_std=c++2a', 'cpp_std=c++2a',

View File

@ -39,7 +39,7 @@ let
in in
mkDerivation (finalAttrs: { mkDerivation (finalAttrs: {
pname = "nix-expr-test"; pname = "nix-expr-tests";
inherit version; inherit version;
src = fileset.toSource { src = fileset.toSource {
@ -98,7 +98,7 @@ mkDerivation (finalAttrs: {
} '' } ''
PATH="${lib.makeBinPath [ finalAttrs.finalPackage ]}:$PATH" PATH="${lib.makeBinPath [ finalAttrs.finalPackage ]}:$PATH"
export _NIX_TEST_UNIT_DATA=${./data} export _NIX_TEST_UNIT_DATA=${./data}
nix-expr-test nix-expr-tests
touch $out touch $out
''; '';
}; };

View File

@ -1,4 +1,4 @@
project('nix-fetchers-test', 'cpp', project('nix-fetchers-tests', 'cpp',
version : files('.version'), version : files('.version'),
default_options : [ default_options : [
'cpp_std=c++2a', 'cpp_std=c++2a',

View File

@ -38,7 +38,7 @@ let
in in
mkDerivation (finalAttrs: { mkDerivation (finalAttrs: {
pname = "nix-fetchers-test"; pname = "nix-fetchers-tests";
inherit version; inherit version;
src = fileset.toSource { src = fileset.toSource {
@ -96,7 +96,7 @@ mkDerivation (finalAttrs: {
} '' } ''
PATH="${lib.makeBinPath [ finalAttrs.finalPackage ]}:$PATH" PATH="${lib.makeBinPath [ finalAttrs.finalPackage ]}:$PATH"
export _NIX_TEST_UNIT_DATA=${./data} export _NIX_TEST_UNIT_DATA=${./data}
nix-fetchers-test nix-fetchers-tests
touch $out touch $out
''; '';
}; };

View File

@ -1,4 +1,4 @@
project('nix-flake-test', 'cpp', project('nix-flake-tests', 'cpp',
version : files('.version'), version : files('.version'),
default_options : [ default_options : [
'cpp_std=c++2a', 'cpp_std=c++2a',

View File

@ -38,7 +38,7 @@ let
in in
mkDerivation (finalAttrs: { mkDerivation (finalAttrs: {
pname = "nix-flake-test"; pname = "nix-flake-tests";
inherit version; inherit version;
src = fileset.toSource { src = fileset.toSource {
@ -96,7 +96,7 @@ mkDerivation (finalAttrs: {
} '' } ''
PATH="${lib.makeBinPath [ finalAttrs.finalPackage ]}:$PATH" PATH="${lib.makeBinPath [ finalAttrs.finalPackage ]}:$PATH"
export _NIX_TEST_UNIT_DATA=${./data} export _NIX_TEST_UNIT_DATA=${./data}
nix-flake-test nix-flake-tests
touch $out touch $out
''; '';
}; };

Some files were not shown because too many files have changed in this diff Show More