Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should I upload perl 'xt' tests to CPAN?

Tags:

perl

Some time ago the new thing appeared in the Perl world. The thing is to create xt directory in the module source code and to place there tests that should be run only by author. The idea of xt tests is that they are not run when the module is installed from CPAN.

I was thinking that if the tests are not needed for the installation process there is no need to upload that tests to CPAN. My idea was to have these tests in my VSC, but not to put them in the tar.gz file this is uploaded to CPAN.

But now there are a lot of CPAN modules that have xt directory in it. I have a local CPAN copy and I searched for such modules:

$ find -iname "*.tar*" -exec tar tf {} \; | grep "/xt/" &> modules_with_xt_dir
$ cat modules_with_xt_dir |sort --random-sort|uniq|head
CatalystX-Dispatcher-AsGraph-0.01/xt/03_pod.t
Religion-Bible-Reference-0.014/xt/release/perl-critic.t
DBIx-Custom-0.1674/xt/dbix-connector.t
Geo-Distance-XS-0.09/xt/
FBP-Perl-0.21/xt/pod.t
Getopt-Compact-WithCmd-0.14/xt/01_podspell.t
Dist-Zilla-Plugin-CheckExtraTests-0.004/xt/release/pod-coverage.t
MooseX-GlobRef-0.07/xt/pod_spellrc
Web-Request-0.09/xt/release/pod-syntax.t
Amon2-2.52/eg/Hello/xt/perlcriticrc

My question is about best pactices. What is best? To upload xt tests to CPAN, or not to upload? What are the advantages of the decision?

like image 988
bessarabov Avatar asked Feb 17 '23 16:02

bessarabov


1 Answers

I'd say that the best practice is to upload.

The benefit is that it lets people hack and patch your code and still be able to run the full test suite. Helps with people writing patches - and hurts nobody.

like image 107
adrianh Avatar answered Feb 24 '23 01:02

adrianh