Skip to content

Commit

Permalink
Move unit tests to the location Meson expects them to be
Browse files Browse the repository at this point in the history
Everything that is a separate subproject should live in the subprojects
directory.

Progress on NixOS#2503

This reverts commit 451f8a8.
  • Loading branch information
Ericson2314 committed Oct 16, 2024
1 parent f51974d commit 8b2fb38
Show file tree
Hide file tree
Showing 267 changed files with 140 additions and 150 deletions.
2 changes: 1 addition & 1 deletion .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"c api":
- changed-files:
- any-glob-to-any-file: "src/lib*-c/**/*"
- any-glob-to-any-file: "test/unit/**/nix_api_*"
- any-glob-to-any-file: "src/*test*/**/nix_api_*"
- any-glob-to-any-file: "doc/external-api/**/*"

"contributor-experience":
Expand Down
10 changes: 5 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,22 +49,22 @@ perl/Makefile.config
/src/libexpr/parser-tab.output
/src/libexpr/nix.tbl
/src/libexpr/tests
/tests/unit/libexpr/libnixexpr-tests
/src/nix-expr-tests/libnixexpr-tests

# /src/libfetchers
/tests/unit/libfetchers/libnixfetchers-tests
/src/nix-fetchers-tests/libnixfetchers-tests

# /src/libflake
/tests/unit/libflake/libnixflake-tests
/src/nix-flake-tests/libnixflake-tests

# /src/libstore/
*.gen.*
/src/libstore/tests
/tests/unit/libstore/libnixstore-tests
/src/nix-store-tests/libnixstore-tests

# /src/libutil/
/src/libutil/tests
/tests/unit/libutil/libnixutil-tests
/src/nix-util-tests/libnixutil-tests

/src/nix/nix

Expand Down
16 changes: 8 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ endif

ifeq ($(ENABLE_UNIT_TESTS), yes)
makefiles += \
tests/unit/libutil/local.mk \
tests/unit/libutil-support/local.mk \
tests/unit/libstore/local.mk \
tests/unit/libstore-support/local.mk \
tests/unit/libfetchers/local.mk \
tests/unit/libexpr/local.mk \
tests/unit/libexpr-support/local.mk \
tests/unit/libflake/local.mk
src/nix-util-tests/local.mk \
src/nix-util-test-support/local.mk \
src/nix-store-tests/local.mk \
src/nix-store-test-support/local.mk \
src/nix-fetchers-tests/local.mk \
src/nix-expr-tests/local.mk \
src/nix-expr-test-support/local.mk \
src/nix-flake-tests/local.mk
endif

ifeq ($(ENABLE_FUNCTIONAL_TESTS), yes)
Expand Down
120 changes: 60 additions & 60 deletions maintainers/flake-module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
excludes = [
# We don't want to format test data
# ''tests/(?!nixos/).*\.nix''
''^tests/unit/[^/]*/data/.*$''
''^src/[^/]*-tests/data/.*$''

# Don't format vendored code
''^doc/manual/redirects\.js$''
Expand Down Expand Up @@ -427,64 +427,64 @@
''^tests/nixos/ca-fd-leak/sender\.c''
''^tests/nixos/ca-fd-leak/smuggler\.c''
''^tests/nixos/user-sandboxing/attacker\.c''
''^tests/unit/libexpr-support/tests/libexpr\.hh''
''^tests/unit/libexpr-support/tests/value/context\.cc''
''^tests/unit/libexpr-support/tests/value/context\.hh''
''^tests/unit/libexpr/derived-path\.cc''
''^tests/unit/libexpr/error_traces\.cc''
''^tests/unit/libexpr/eval\.cc''
''^tests/unit/libexpr/json\.cc''
''^tests/unit/libexpr/main\.cc''
''^tests/unit/libexpr/primops\.cc''
''^tests/unit/libexpr/search-path\.cc''
''^tests/unit/libexpr/trivial\.cc''
''^tests/unit/libexpr/value/context\.cc''
''^tests/unit/libexpr/value/print\.cc''
''^tests/unit/libfetchers/public-key\.cc''
''^tests/unit/libflake/flakeref\.cc''
''^tests/unit/libflake/url-name\.cc''
''^tests/unit/libstore-support/tests/derived-path\.cc''
''^tests/unit/libstore-support/tests/derived-path\.hh''
''^tests/unit/libstore-support/tests/nix_api_store\.hh''
''^tests/unit/libstore-support/tests/outputs-spec\.cc''
''^tests/unit/libstore-support/tests/outputs-spec\.hh''
''^tests/unit/libstore-support/tests/path\.cc''
''^tests/unit/libstore-support/tests/path\.hh''
''^tests/unit/libstore-support/tests/protocol\.hh''
''^tests/unit/libstore/common-protocol\.cc''
''^tests/unit/libstore/content-address\.cc''
''^tests/unit/libstore/derivation\.cc''
''^tests/unit/libstore/derived-path\.cc''
''^tests/unit/libstore/downstream-placeholder\.cc''
''^tests/unit/libstore/machines\.cc''
''^tests/unit/libstore/nar-info-disk-cache\.cc''
''^tests/unit/libstore/nar-info\.cc''
''^tests/unit/libstore/outputs-spec\.cc''
''^tests/unit/libstore/path-info\.cc''
''^tests/unit/libstore/path\.cc''
''^tests/unit/libstore/serve-protocol\.cc''
''^tests/unit/libstore/worker-protocol\.cc''
''^tests/unit/libutil-support/tests/characterization\.hh''
''^tests/unit/libutil-support/tests/hash\.cc''
''^tests/unit/libutil-support/tests/hash\.hh''
''^tests/unit/libutil/args\.cc''
''^tests/unit/libutil/canon-path\.cc''
''^tests/unit/libutil/chunked-vector\.cc''
''^tests/unit/libutil/closure\.cc''
''^tests/unit/libutil/compression\.cc''
''^tests/unit/libutil/config\.cc''
''^tests/unit/libutil/file-content-address\.cc''
''^tests/unit/libutil/git\.cc''
''^tests/unit/libutil/hash\.cc''
''^tests/unit/libutil/hilite\.cc''
''^tests/unit/libutil/json-utils\.cc''
''^tests/unit/libutil/logging\.cc''
''^tests/unit/libutil/lru-cache\.cc''
''^tests/unit/libutil/pool\.cc''
''^tests/unit/libutil/references\.cc''
''^tests/unit/libutil/suggestions\.cc''
''^tests/unit/libutil/url\.cc''
''^tests/unit/libutil/xml-writer\.cc''
''^src/nix-expr-test-support/tests/libexpr\.hh''
''^src/nix-expr-test-support/tests/value/context\.cc''
''^src/nix-expr-test-support/tests/value/context\.hh''
''^src/nix-expr-tests/derived-path\.cc''
''^src/nix-expr-tests/error_traces\.cc''
''^src/nix-expr-tests/eval\.cc''
''^src/nix-expr-tests/json\.cc''
''^src/nix-expr-tests/main\.cc''
''^src/nix-expr-tests/primops\.cc''
''^src/nix-expr-tests/search-path\.cc''
''^src/nix-expr-tests/trivial\.cc''
''^src/nix-expr-tests/value/context\.cc''
''^src/nix-expr-tests/value/print\.cc''
''^src/nix-fetchers-tests/public-key\.cc''
''^src/nix-flake-tests/flakeref\.cc''
''^src/nix-flake-tests/url-name\.cc''
''^src/nix-store-test-support/tests/derived-path\.cc''
''^src/nix-store-test-support/tests/derived-path\.hh''
''^src/nix-store-test-support/tests/nix_api_store\.hh''
''^src/nix-store-test-support/tests/outputs-spec\.cc''
''^src/nix-store-test-support/tests/outputs-spec\.hh''
''^src/nix-store-test-support/tests/path\.cc''
''^src/nix-store-test-support/tests/path\.hh''
''^src/nix-store-test-support/tests/protocol\.hh''
''^src/nix-store-tests/common-protocol\.cc''
''^src/nix-store-tests/content-address\.cc''
''^src/nix-store-tests/derivation\.cc''
''^src/nix-store-tests/derived-path\.cc''
''^src/nix-store-tests/downstream-placeholder\.cc''
''^src/nix-store-tests/machines\.cc''
''^src/nix-store-tests/nar-info-disk-cache\.cc''
''^src/nix-store-tests/nar-info\.cc''
''^src/nix-store-tests/outputs-spec\.cc''
''^src/nix-store-tests/path-info\.cc''
''^src/nix-store-tests/path\.cc''
''^src/nix-store-tests/serve-protocol\.cc''
''^src/nix-store-tests/worker-protocol\.cc''
''^src/nix-util-test-support/tests/characterization\.hh''
''^src/nix-util-test-support/tests/hash\.cc''
''^src/nix-util-test-support/tests/hash\.hh''
''^src/nix-util-tests/args\.cc''
''^src/nix-util-tests/canon-path\.cc''
''^src/nix-util-tests/chunked-vector\.cc''
''^src/nix-util-tests/closure\.cc''
''^src/nix-util-tests/compression\.cc''
''^src/nix-util-tests/config\.cc''
''^src/nix-util-tests/file-content-address\.cc''
''^src/nix-util-tests/git\.cc''
''^src/nix-util-tests/hash\.cc''
''^src/nix-util-tests/hilite\.cc''
''^src/nix-util-tests/json-utils\.cc''
''^src/nix-util-tests/logging\.cc''
''^src/nix-util-tests/lru-cache\.cc''
''^src/nix-util-tests/pool\.cc''
''^src/nix-util-tests/references\.cc''
''^src/nix-util-tests/suggestions\.cc''
''^src/nix-util-tests/url\.cc''
''^src/nix-util-tests/xml-writer\.cc''
];
};
shellcheck = {
Expand Down Expand Up @@ -650,7 +650,7 @@
''^tests/functional/user-envs\.sh$''
''^tests/functional/why-depends\.sh$''
''^tests/functional/zstd\.sh$''
''^tests/unit/libutil/data/git/check-data\.sh$''
''^src/nix-util-tests/data/git/check-data\.sh$''
];
};
# TODO: nixfmt, https://github.com/NixOS/nixfmt/issues/153
Expand Down
2 changes: 0 additions & 2 deletions package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,6 @@ in {
./scripts/local.mk
] ++ lib.optionals enableManual [
./doc/manual
] ++ lib.optionals buildUnitTests [
./tests/unit
] ++ lib.optionals doInstallCheck [
./tests/functional
]));
Expand Down
16 changes: 8 additions & 8 deletions packaging/components.nix
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,24 @@ in

nix-util = callPackage ../src/libutil/package.nix { };
nix-util-c = callPackage ../src/libutil-c/package.nix { };
nix-util-test-support = callPackage ../tests/unit/libutil-support/package.nix { };
nix-util-tests = callPackage ../tests/unit/libutil/package.nix { };
nix-util-test-support = callPackage ../src/nix-util-test-support/package.nix { };
nix-util-tests = callPackage ../src/nix-util-tests/package.nix { };

nix-store = callPackage ../src/libstore/package.nix { };
nix-store-c = callPackage ../src/libstore-c/package.nix { };
nix-store-test-support = callPackage ../tests/unit/libstore-support/package.nix { };
nix-store-tests = callPackage ../tests/unit/libstore/package.nix { };
nix-store-test-support = callPackage ../src/nix-store-test-support/package.nix { };
nix-store-tests = callPackage ../src/nix-store-tests/package.nix { };

nix-fetchers = callPackage ../src/libfetchers/package.nix { };
nix-fetchers-tests = callPackage ../tests/unit/libfetchers/package.nix { };
nix-fetchers-tests = callPackage ../src/nix-fetchers-tests/package.nix { };

nix-expr = callPackage ../src/libexpr/package.nix { };
nix-expr-c = callPackage ../src/libexpr-c/package.nix { };
nix-expr-test-support = callPackage ../tests/unit/libexpr-support/package.nix { };
nix-expr-tests = callPackage ../tests/unit/libexpr/package.nix { };
nix-expr-test-support = callPackage ../src/nix-expr-test-support/package.nix { };
nix-expr-tests = callPackage ../src/nix-expr-tests/package.nix { };

nix-flake = callPackage ../src/libflake/package.nix { };
nix-flake-tests = callPackage ../tests/unit/libflake/package.nix { };
nix-flake-tests = callPackage ../src/nix-flake-tests/package.nix { };

nix-main = callPackage ../src/libmain/package.nix { };
nix-main-c = callPackage ../src/libmain-c/package.nix { };
Expand Down
1 change: 0 additions & 1 deletion src/nix-expr-test-support

This file was deleted.

1 change: 1 addition & 0 deletions src/nix-expr-test-support/.version
1 change: 1 addition & 0 deletions src/nix-expr-test-support/build-utils-meson
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ mkMesonLibrary (finalAttrs: {

workDir = ./.;
fileset = fileset.unions [
../../../build-utils-meson
../../build-utils-meson
./build-utils-meson
../../../.version
../../.version
./.version
./meson.build
# ./meson.options
Expand All @@ -43,7 +43,7 @@ mkMesonLibrary (finalAttrs: {
# Do the meson utils, without modification.
''
chmod u+w ./.version
echo ${version} > ../../../.version
echo ${version} > ../../.version
'';

mesonFlags = [
Expand Down
File renamed without changes.
1 change: 0 additions & 1 deletion src/nix-expr-tests

This file was deleted.

1 change: 1 addition & 0 deletions src/nix-expr-tests/.version
1 change: 1 addition & 0 deletions src/nix-expr-tests/build-utils-meson
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions tests/unit/libexpr/local.mk → src/nix-expr-tests/local.mk
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ libexpr-tests_SOURCES := \
$(wildcard $(d)/flake/*.cc)

libexpr-tests_EXTRA_INCLUDES = \
-I tests/unit/libexpr-support \
-I tests/unit/libstore-support \
-I tests/unit/libutil-support \
-I src/nix-expr-test-support \
-I src/nix-store-test-support \
-I src/nix-util-test-support \
$(INCLUDE_libexpr) \
$(INCLUDE_libexprc) \
$(INCLUDE_libfetchers) \
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ mkMesonExecutable (finalAttrs: {

workDir = ./.;
fileset = fileset.unions [
../../../build-utils-meson
../../build-utils-meson
./build-utils-meson
../../../.version
../../.version
./.version
./meson.build
# ./meson.options
Expand All @@ -50,7 +50,7 @@ mkMesonExecutable (finalAttrs: {
# Do the meson utils, without modification.
''
chmod u+w ./.version
echo ${version} > ../../../.version
echo ${version} > ../../.version
'';

mesonFlags = [
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion src/nix-fetchers-tests

This file was deleted.

1 change: 1 addition & 0 deletions src/nix-fetchers-tests/.version
1 change: 1 addition & 0 deletions src/nix-fetchers-tests/build-utils-meson
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ endif
libfetchers-tests_SOURCES := $(wildcard $(d)/*.cc)

libfetchers-tests_EXTRA_INCLUDES = \
-I tests/unit/libstore-support \
-I tests/unit/libutil-support \
-I src/nix-store-test-support \
-I src/nix-util-test-support \
$(INCLUDE_libfetchers) \
$(INCLUDE_libstore) \
$(INCLUDE_libutil)
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ mkMesonExecutable (finalAttrs: {

workDir = ./.;
fileset = fileset.unions [
../../../build-utils-meson
../../build-utils-meson
./build-utils-meson
../../../.version
../../.version
./.version
./meson.build
# ./meson.options
Expand All @@ -48,7 +48,7 @@ mkMesonExecutable (finalAttrs: {
# Do the meson utils, without modification.
''
chmod u+w ./.version
echo ${version} > ../../../.version
echo ${version} > ../../.version
'';

mesonFlags = [
Expand Down
File renamed without changes.
1 change: 0 additions & 1 deletion src/nix-flake-tests

This file was deleted.

1 change: 1 addition & 0 deletions src/nix-flake-tests/.version
1 change: 1 addition & 0 deletions src/nix-flake-tests/build-utils-meson
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions tests/unit/libflake/local.mk → src/nix-flake-tests/local.mk
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ libflake-tests_SOURCES := \
$(wildcard $(d)/flake/*.cc)

libflake-tests_EXTRA_INCLUDES = \
-I tests/unit/libflake-support \
-I tests/unit/libstore-support \
-I tests/unit/libutil-support \
-I src/nix-flake-test-support \
-I src/nix-store-test-support \
-I src/nix-util-test-support \
$(INCLUDE_libflake) \
$(INCLUDE_libexpr) \
$(INCLUDE_libfetchers) \
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ mkMesonExecutable (finalAttrs: {

workDir = ./.;
fileset = fileset.unions [
../../../build-utils-meson
../../build-utils-meson
./build-utils-meson
../../../.version
../../.version
./.version
./meson.build
# ./meson.options
Expand All @@ -48,7 +48,7 @@ mkMesonExecutable (finalAttrs: {
# Do the meson utils, without modification.
''
chmod u+w ./.version
echo ${version} > ../../../.version
echo ${version} > ../../.version
'';

mesonFlags = [
Expand Down
File renamed without changes.
Loading

0 comments on commit 8b2fb38

Please sign in to comment.