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/manual.html
/doc/manual/manual.pdf
/tests/.bzr*
/tests/.git*
/tests/.hg*
/tests/nix
/tests/data
/t/.bzr*
/t/.git*
/t/.hg*
/t/nix
/t/data
/t/jobs/config.nix
/inst
hydra-config.h
hydra-config.h.in
result
tests/jobs/config.nix
outputs
config
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)
DIST_SUBDIRS = $(SUBDIRS)
EXTRA_DIST = hydra-module.nix

View file

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

View file

@ -320,12 +320,16 @@
] ++ lib.optionals stdenv.isLinux [ rpm dpkg cdrkit ] );
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
PERL5LIB=$(pwd)/src/lib:$PERL5LIB
export HYDRA_HOME="src/"
export HYDRA_HOME="$(pwd)/src/"
mkdir -p .hydra-data
export HYDRA_DATA="$(pwd)/.hydra-data"
export HYDRA_DBI='dbi:Pg:dbname=hydra;host=localhost;port=64444'
popd >/dev/null
'';
preConfigure = "autoreconf -vfi";
@ -416,7 +420,7 @@
su - hydra -c "hydra-create-user root --email-address 'alice@example.org' --password foobar --role admin"
mkdir /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
chown -R hydra /run/jobset /tmp/nix
"""
@ -428,7 +432,7 @@
# Run the API tests.
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"
mkdir /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
chown -R hydra /run/jobset
"""
@ -477,7 +481,7 @@
# Setup the project and jobset
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