Skip to content

Commit

Permalink
perl: Allow running yath test in the build directory
Browse files Browse the repository at this point in the history
For most purposes, the stock `ninja test` should be fine, but this
allows for doing other things with the `yath` during development.
  • Loading branch information
Ericson2314 committed Apr 25, 2024
1 parent fc1d902 commit 1ac635d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
2 changes: 0 additions & 2 deletions perl/.yath.rc

This file was deleted.

2 changes: 2 additions & 0 deletions perl/.yath.rc.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[test]
-I=rel(@lib_dir@)
2 changes: 1 addition & 1 deletion perl/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
]);
};
Expand Down
16 changes: 12 additions & 4 deletions perl/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 1ac635d

Please sign in to comment.