tests: move to t, allow yath test from root

By moving the tests subdirectory to t, we gain the ability to run `yath
test` with no arguments from inside `nix develop` in the root of the
the repo.

(`nix develop` is necessary in order to set the proper env vars for
`yath` to find our test libraries.)
This commit is contained in:
Cole Helbling 2021-03-04 23:35:57 -08:00
parent a8ec1b1afa
commit 025be052b7
No known key found for this signature in database
GPG key ID: B37E0F2371016A4C
56 changed files with 20 additions and 14 deletions

12
.gitignore vendored
View file

@ -25,16 +25,16 @@ Makefile.in
/doc/manual/images /doc/manual/images
/doc/manual/manual.html /doc/manual/manual.html
/doc/manual/manual.pdf /doc/manual/manual.pdf
/tests/.bzr* /t/.bzr*
/tests/.git* /t/.git*
/tests/.hg* /t/.hg*
/tests/nix /t/nix
/tests/data /t/data
/t/jobs/config.nix
/inst /inst
hydra-config.h hydra-config.h
hydra-config.h.in hydra-config.h.in
result result
tests/jobs/config.nix
outputs outputs
config config
stamp-h1 stamp-h1

2
.yath.rc Normal file
View file

@ -0,0 +1,2 @@
[test]
-I=rel(t/lib)

View file

@ -1,4 +1,4 @@
SUBDIRS = src tests doc SUBDIRS = src t doc
BOOTCLEAN_SUBDIRS = $(SUBDIRS) BOOTCLEAN_SUBDIRS = $(SUBDIRS)
DIST_SUBDIRS = $(SUBDIRS) DIST_SUBDIRS = $(SUBDIRS)
EXTRA_DIST = hydra-module.nix EXTRA_DIST = hydra-module.nix

View file

@ -70,8 +70,8 @@ AC_CONFIG_FILES([
src/lib/Makefile src/lib/Makefile
src/root/Makefile src/root/Makefile
src/script/Makefile src/script/Makefile
tests/Makefile t/Makefile
tests/jobs/config.nix t/jobs/config.nix
]) ])
AC_CONFIG_COMMANDS([executable-scripts], []) AC_CONFIG_COMMANDS([executable-scripts], [])

View file

@ -320,12 +320,16 @@
] ++ lib.optionals stdenv.isLinux [ rpm dpkg cdrkit ] ); ] ++ lib.optionals stdenv.isLinux [ rpm dpkg cdrkit ] );
shellHook = '' shellHook = ''
pushd $(git rev-parse --show-toplevel) >/dev/null
PATH=$(pwd)/src/hydra-evaluator:$(pwd)/src/script:$(pwd)/src/hydra-eval-jobs:$(pwd)/src/hydra-queue-runner:$PATH PATH=$(pwd)/src/hydra-evaluator:$(pwd)/src/script:$(pwd)/src/hydra-eval-jobs:$(pwd)/src/hydra-queue-runner:$PATH
PERL5LIB=$(pwd)/src/lib:$PERL5LIB PERL5LIB=$(pwd)/src/lib:$PERL5LIB
export HYDRA_HOME="src/" export HYDRA_HOME="$(pwd)/src/"
mkdir -p .hydra-data mkdir -p .hydra-data
export HYDRA_DATA="$(pwd)/.hydra-data" export HYDRA_DATA="$(pwd)/.hydra-data"
export HYDRA_DBI='dbi:Pg:dbname=hydra;host=localhost;port=64444' export HYDRA_DBI='dbi:Pg:dbname=hydra;host=localhost;port=64444'
popd >/dev/null
''; '';
preConfigure = "autoreconf -vfi"; preConfigure = "autoreconf -vfi";
@ -416,7 +420,7 @@
su - hydra -c "hydra-create-user root --email-address 'alice@example.org' --password foobar --role admin" su - hydra -c "hydra-create-user root --email-address 'alice@example.org' --password foobar --role admin"
mkdir /run/jobset /tmp/nix mkdir /run/jobset /tmp/nix
chmod 755 /run/jobset /tmp/nix chmod 755 /run/jobset /tmp/nix
cp ${./tests/api-test.nix} /run/jobset/default.nix cp ${./t/api-test.nix} /run/jobset/default.nix
chmod 644 /run/jobset/default.nix chmod 644 /run/jobset/default.nix
chown -R hydra /run/jobset /tmp/nix chown -R hydra /run/jobset /tmp/nix
""" """
@ -428,7 +432,7 @@
# Run the API tests. # Run the API tests.
machine.succeed( machine.succeed(
"su - hydra -c 'perl -I ${pkgs.hydra.perlDeps}/lib/perl5/site_perl ${./tests/api-test.pl}' >&2" "su - hydra -c 'perl -I ${pkgs.hydra.perlDeps}/lib/perl5/site_perl ${./t/api-test.pl}' >&2"
) )
''; '';
}; };
@ -455,7 +459,7 @@
su - hydra -c "hydra-create-user root --email-address 'alice@example.org' --password foobar --role admin" su - hydra -c "hydra-create-user root --email-address 'alice@example.org' --password foobar --role admin"
mkdir /run/jobset mkdir /run/jobset
chmod 755 /run/jobset chmod 755 /run/jobset
cp ${./tests/api-test.nix} /run/jobset/default.nix cp ${./t/api-test.nix} /run/jobset/default.nix
chmod 644 /run/jobset/default.nix chmod 644 /run/jobset/default.nix
chown -R hydra /run/jobset chown -R hydra /run/jobset
""" """
@ -477,7 +481,7 @@
# Setup the project and jobset # Setup the project and jobset
machine.succeed( machine.succeed(
"su - hydra -c 'perl -I ${pkgs.hydra.perlDeps}/lib/perl5/site_perl ${./tests/setup-notifications-jobset.pl}' >&2" "su - hydra -c 'perl -I ${pkgs.hydra.perlDeps}/lib/perl5/site_perl ${./t/setup-notifications-jobset.pl}' >&2"
) )
# Wait until hydra has build the job and # Wait until hydra has build the job and