Skip to content

Conversation

qec-pconner
Copy link
Contributor

@qec-pconner qec-pconner commented Jan 10, 2023

There are 2 common implementations of parallel: GNU parallel (https://www.gnu.org/software/parallel/) and moreutils' parallel (https://manpages.debian.org/testing/moreutils/parallel.1.en.html, https://linux.die.net/man/1/parallel).

The former is much more feature rich and is the actual intended dependency of parallel tests in bats.

The latter is far more common on many operating systems (including Ubuntu).

Currently, when the parallel.bats file runs, it checks to see if parallel is available and will skip the test if not. Unfortunately, this only checks that there is a parallel command available -- not necessarily the correct one. If moreutils parallel is installed, the skip will not occur and the test will later fail in "libexec/bats-core/bats-exec-suite", when trying to run parallel --keep-order --jobs ... -- these CLI args are unknown to moreutils parallel.

This PR improves the check such that not any parallel command will work. This check is extended by checking that the parallel command supports --version, which distinguishes between GNU parallel (supported) and moreutils parallel (unsupported).

Fixes #672.

There are 2 common implementations of `parallel`: GNU parallel
(https://www.gnu.org/software/parallel/) and moreutils' parallel
(https://manpages.debian.org/testing/moreutils/parallel.1.en.html,
https://linux.die.net/man/1/parallel).

The former is much more feature rich and is the actual intended
dependency of parallel tests in bats.

The latter is far more common on many operating systems (including
Ubuntu).

Currently, when the `parallel.bats` file runs, it checks to see if
`parallel` is available and will skip the test if not. Unfortunately,
this only checks that there is _a_ `parallel` command available -- not
necessarily the correct one. If moreutils parallel is installed, the
skip will not occur and the test will later fail in
"libexec/bats-core/bats-exec-suite", when trying to run `parallel
--keep-order --jobs ...` -- these CLI args are unknown to moreutils
`parallel`.

This PR improves the check such that not _any_ `parallel` command will
work. This check is extended by checking that the `parallel` command
supports `--version`, which distinguishes between GNU parallel
(supported) and moreutils parallel (unsupported).
@martin-schulze-vireso
Copy link
Member

This check should also be updated in libexec/bats. And we should make a test for that.

@qec-pconner
Copy link
Contributor Author

Added to description that this fixes #672.

martin-schulze-vireso added a commit to qec-pconner/bats-core that referenced this pull request Jan 14, 2023
@martin-schulze-vireso martin-schulze-vireso force-pushed the stricterParallelExistsCheck branch from 1043399 to 9a3b136 Compare January 14, 2023 20:05
@martin-schulze-vireso martin-schulze-vireso merged commit c06a125 into bats-core:master Jan 14, 2023
@martin-schulze-vireso
Copy link
Member

Thanks for your contribution.

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

Successfully merging this pull request may close these issues.

bats-core parallel tests assumes GNU parallel for the --jobs flag
2 participants