Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce PROVE_OPTS environment variable #117

Open
hurricup opened this issue Mar 12, 2023 · 8 comments
Open

Introduce PROVE_OPTS environment variable #117

hurricup opened this issue Mar 12, 2023 · 8 comments

Comments

@hurricup
Copy link

Tests may be run via prove directly or via make with make test.
In latter case, it is not possible to pass additional arguments to the script.

But this may be necessary for the IDE integration. IDE may need to pass it's own formatter, plugin or modify execution mode, like jobs, shufflle, etc.

Makefile.PL should not depend on development environment, because different users may have different preferences, so would be nice to be able to pass additional arguments via environment variables.

One thing that bothers me is that these variable are expected to have higher precedence than command line argument, so IDE could tune execution, but this feels wrong... May be two variables could be introduced, e.g PROVE_OPTS and FORCE_PROVE_OPTS where first has lesser precedence and latter - higher.

@demerphq
Copy link
Member

How does this relate to HARNESS_OPTIONS?

@hurricup
Copy link
Author

@demerphq according to https://perldoc.perl.org/Test::Harness#HARNESS_OPTIONS options are really limited. For example, when IDEA runs tests, it does it with:

prove -PPassEnv --formatter TAP::Formatter::Camelcade --merge --recurse --jobs 1 ...

And Devel::NYTProf for example, has hardcoded

time nice prove -b -j 9 --shuffle

in the Makefile.PL

And I need a way to amend the command line without changing the Makefile.PL

@demerphq
Copy link
Member

So, the --shuffle option and the -P option and the --recurse option aren't covered? I thought recurse is default with 'make test'.

FWIW, I use HARNESS_OPTIONS=j16 all the time.

As far as I can tell Devel::NYTProf has ptest because historically Test::Harness didnt support parallel jobs. Considering you have to do make ptest instead of make test, and you can do HARNESS_OPTIONS=j9 make test to get the same result as ptest (minus the explicit shuffle, but that sort of happens anyway with parallel tests).

@hurricup
Copy link
Author

For the IDE the most important things are formatter and plugin allowing to pass environment to the tests.

@hurricup
Copy link
Author

I'll try with HARNESS_OPTIONS and get back to this if won't be able to solve something. Thanks for your assistance

@hurricup
Copy link
Author

hurricup commented Apr 2, 2023

Ok, thank you very much for the hint about existing variables, I totally missed them when implemented testing support. The only thing I still need is possibility to pass --merge via HARNESS_OPTIONS. So some m option would be nice to have. Otherwise users will have messed output in IDE when using anything but prove, e.g. make test

hurricup added a commit to Camelcade/Perl5-IDEA that referenced this issue Apr 2, 2023
- use `HARNESS_OPTIONS` to pass formatter and jobs number (still can't pass `--merge`, see Perl-Toolchain-Gang/Test-Harness#117)
- use `HARNESS_PERL_SWITCHES` instead of `PassEnv` plugin

We need such approach to be able to use any frontend, besides `prove`, e.g. `make test`

Fixes #2651
hurricup added a commit to Camelcade/Perl5-IDEA that referenced this issue Apr 2, 2023
- use `HARNESS_OPTIONS` to pass formatter and jobs number (still can't pass `--merge`, see Perl-Toolchain-Gang/Test-Harness#117)
- use `HARNESS_PERL_SWITCHES` instead of `PassEnv` plugin

We need such approach to be able to use any frontend, besides `prove`, e.g. `make test`

Fixes #2651
@Leont
Copy link
Member

Leont commented Apr 2, 2023

Ok, thank you very much for the hint about existing variables, I totally missed them when implemented testing support. The only thing I still need is possibility to pass --merge via HARNESS_OPTIONS. So some m option would be nice to have. Otherwise users will have messed output in IDE when using anything but prove, e.g. make test

Can you explain to me why you think you need it? IME --merge is generally a dangerous idea because it can easily lead to invalid TAP.

@hurricup
Copy link
Author

hurricup commented Apr 3, 2023

I'll re-investigate, added it 4 years ago, can't quite remember. IRR was some mess with tests output.

hurricup added a commit to Camelcade/Perl5-IDEA that referenced this issue Apr 3, 2023
- use `HARNESS_OPTIONS` to pass formatter and jobs number (still can't pass `--merge`, see Perl-Toolchain-Gang/Test-Harness#117)
- use `HARNESS_PERL_SWITCHES` instead of `PassEnv` plugin

We need such approach to be able to use any frontend, besides `prove`, e.g. `make test`

Fixes #2651
hurricup added a commit to Camelcade/Perl5-IDEA that referenced this issue Apr 3, 2023
- use `HARNESS_OPTIONS` to pass formatter and jobs number (still can't pass `--merge`, see Perl-Toolchain-Gang/Test-Harness#117)
- use `HARNESS_PERL_SWITCHES` instead of `PassEnv` plugin

We need such approach to be able to use any frontend, besides `prove`, e.g. `make test`

Fixes #2651
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants