perl: Allow running yath test in the build directory

For most purposes, the stock `ninja test` should be fine, but this
allows for doing other things with the `yath` during development.
This commit is contained in:
John Ericson 2024-04-25 16:07:00 -04:00
parent fc1d9023a2
commit 1ac635d600
4 changed files with 15 additions and 7 deletions

View file

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

2
perl/.yath.rc.in Normal file
View file

@ -0,0 +1,2 @@
[test]
-I=rel(@lib_dir@)

View file

@ -26,7 +26,7 @@ perl.pkgs.toPerlModule (stdenv.mkDerivation (finalAttrs: {
./meson.build
./meson_options.txt
] ++ lib.optionals finalAttrs.doCheck [
./.yath.rc
./.yath.rc.in
./t
]);
};

View file

@ -138,15 +138,23 @@ nix_perl_store_dep_list = [
# # build
# #-------------------------------------------------
subdir('lib/Nix')
lib_dir = join_paths('lib', 'Nix')
subdir(lib_dir)
if get_option('tests').enabled()
yath_rc_conf = configuration_data()
yath_rc_conf.set('lib_dir', lib_dir)
yath_rc = configure_file(
output : '.yath.rc',
input : '.yath.rc.in',
configuration : yath_rc_conf,
)
subdir('t')
test(
'nix-perl-test',
yath,
args : [
'-I=@0@'.format( join_paths( meson.current_build_dir(), 'lib', 'Nix') ),
],
args : ['test'],
workdir : meson.current_build_dir(),
depends : [nix_perl_store_lib],
)
endif