Skip to content

Commit

Permalink
Move functional tests to subproject dir
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 #2503
  • Loading branch information
Ericson2314 committed Oct 16, 2024
1 parent 8b2fb38 commit eedc0b2
Show file tree
Hide file tree
Showing 843 changed files with 236 additions and 238 deletions.
2 changes: 1 addition & 1 deletion .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,5 @@
# Unit tests
- any-glob-to-any-file: "src/*/tests/**/*"
# Functional and integration tests
- any-glob-to-any-file: "tests/functional/**/*"
- any-glob-to-any-file: "src/nix-functional-tests/**/*"

38 changes: 19 additions & 19 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -95,25 +95,25 @@ perl/Makefile.config

/src/build-remote/build-remote

# /tests/functional/
/tests/functional/test-tmp
/tests/functional/common/subst-vars.sh
/tests/functional/result*
/tests/functional/restricted-innocent
/tests/functional/shell
/tests/functional/shell.drv
/tests/functional/config.nix
/tests/functional/ca/config.nix
/tests/functional/dyn-drv/config.nix
/tests/functional/repl-result-out
/tests/functional/debugger-test-out
/tests/functional/test-libstoreconsumer/test-libstoreconsumer

# /tests/functional/lang/
/tests/functional/lang/*.out
/tests/functional/lang/*.out.xml
/tests/functional/lang/*.err
/tests/functional/lang/*.ast
# /src/nix-functional-tests/
/src/nix-functional-tests/test-tmp
/src/nix-functional-tests/common/subst-vars.sh
/src/nix-functional-tests/result*
/src/nix-functional-tests/restricted-innocent
/src/nix-functional-tests/shell
/src/nix-functional-tests/shell.drv
/src/nix-functional-tests/config.nix
/src/nix-functional-tests/ca/config.nix
/src/nix-functional-tests/dyn-drv/config.nix
/src/nix-functional-tests/repl-result-out
/src/nix-functional-tests/debugger-test-out
/src/nix-functional-tests/test-libstoreconsumer/test-libstoreconsumer

# /src/nix-functional-tests/lang/
/src/nix-functional-tests/lang/*.out
/src/nix-functional-tests/lang/*.out.xml
/src/nix-functional-tests/lang/*.err
/src/nix-functional-tests/lang/*.ast

/perl/lib/Nix/Config.pm
/perl/lib/Nix/Store.cc
Expand Down
2 changes: 1 addition & 1 deletion .shellcheckrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
external-sources=true
source-path=SCRIPTDIR
# Hack for scripts in e.g. tests/functional/ca
# Hack for scripts in e.g. src/nix-functional-tests/ca
source-path=SCRIPTDIR/..
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ Check out the [security policy](https://github.com/NixOS/nix/security/policy).
- [ ] Fixes an [idea approved](https://github.com/NixOS/nix/labels/idea%20approved) issue
- [ ] Tests, as appropriate:
- Functional tests – [`tests/functional/**.sh`](./tests/functional)
- Functional tests – [`src/nix-functional-tests/**.sh`](./src/nix-functional-tests)
- Unit tests – [`src/*/tests`](./src/)
- Integration tests – [`tests/nixos/*`](./tests/nixos)
- [ ] User documentation in the [manual](./doc/manual/source)
Expand Down
16 changes: 8 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@ endif
ifeq ($(ENABLE_FUNCTIONAL_TESTS), yes)
ifdef HOST_UNIX
makefiles += \
tests/functional/local.mk \
tests/functional/flakes/local.mk \
tests/functional/ca/local.mk \
tests/functional/git-hashing/local.mk \
tests/functional/dyn-drv/local.mk \
tests/functional/local-overlay-store/local.mk \
tests/functional/test-libstoreconsumer/local.mk \
tests/functional/plugins/local.mk
src/nix-functional-tests/local.mk \
src/nix-functional-tests/flakes/local.mk \
src/nix-functional-tests/ca/local.mk \
src/nix-functional-tests/git-hashing/local.mk \
src/nix-functional-tests/dyn-drv/local.mk \
src/nix-functional-tests/local-overlay-store/local.mk \
src/nix-functional-tests/test-libstoreconsumer/local.mk \
src/nix-functional-tests/plugins/local.mk
endif
endif

Expand Down
8 changes: 4 additions & 4 deletions doc/manual/source/development/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ On other platforms they wouldn't be run at all.

## Functional tests

The functional tests reside under the `tests/functional` directory and are listed in `tests/functional/local.mk`.
The functional tests reside under the `src/nix-functional-tests` directory and are listed in `src/nix-functional-tests/local.mk`.
Each test is a bash script.

Functional tests are run during `installCheck` in the `nix` package build, as well as separately from the build, in VM tests.
Expand All @@ -145,7 +145,7 @@ $ mesonCheckPhase

Sometimes it is useful to group related tests so they can be easily run together without running the entire test suite.
Each test group is in a subdirectory of `tests`.
For example, `tests/functional/ca/meson.build` defines a `ca` test group for content-addressed derivation outputs.
For example, `src/nix-functional-tests/ca/meson.build` defines a `ca` test group for content-addressed derivation outputs.

That test group can be run like this:

Expand Down Expand Up @@ -184,7 +184,7 @@ regardless of whether the test succeeds or fails.
Tests can be also run directly without `meson`:

```shell-session
$ TEST_NAME=${testName} NIX_REMOTE='' PS4='+(${BASH_SOURCE[0]-$0}:$LINENO) tests/functional/${testName}.sh
$ TEST_NAME=${testName} NIX_REMOTE='' PS4='+(${BASH_SOURCE[0]-$0}:$LINENO) src/nix-functional-tests/${testName}.sh
+(${testName}.sh:1) foo
output from foo
+(${testName}.sh:2) bar
Expand Down Expand Up @@ -217,7 +217,7 @@ edit it like so:
Then, running the test with `./mk/debug-test.sh` will drop you into GDB once the script reaches that point:

```shell-session
$ ./mk/debug-test.sh tests/functional/${testName}.sh
$ ./mk/debug-test.sh src/nix-functional-tests/${testName}.sh
...
+ gdb blash blub
GNU gdb (GDB) 12.1
Expand Down
Loading

0 comments on commit eedc0b2

Please sign in to comment.