Add a --negative-filter option (#1108)#1114
Merged
martin-schulze-vireso merged 1 commit intobats-core:masterfrom Oct 11, 2025
Merged
Add a --negative-filter option (#1108)#1114martin-schulze-vireso merged 1 commit intobats-core:masterfrom
martin-schulze-vireso merged 1 commit intobats-core:masterfrom
Conversation
Contributor
Author
|
If there's a way to negate regexes that neither me nor @Luap99 could find, please let us know! I'd happily change this to just make the FAQ note more specific, in that case. |
|
Thanks @AdamWill |
Contributor
Author
|
The same test failures are happening on other PRs and don't seem related to the changes in this PR. I can add a changelog note, though. |
dde4e63 to
db826de
Compare
AdamWill
added a commit
to AdamWill/os-autoinst-distri-fedora-ai-test
that referenced
this pull request
Jul 30, 2025
Until bats-core/bats-core#1114 we can't easily filter out specific tests in a bats run. So let's hack it up with a sed that just negates the behavior of --filter - we don't need to use its default behavior. Then we can use --filter to filter out specific tests, like this. Use it to filter out the test that's known to fail with recent kernels. Signed-off-by: Adam Williamson <[email protected]>
db826de to
fec7c41
Compare
See https://pagure.io/fedora-qa/os-autoinst-distri-fedora/pull-request/389 . The FAQ claimed "So you could try to invert the regex", but as far as I can tell, there's no practical way to do this with bash regexes, if you want to express "run all tests except foo_in_a" or something like that. You can do it in some regex flavors using negative lookahead matches, but bash's regex flavor does not seem to support that, and you can't just stick a `!` on the front of the regex or anything like that. So, this adds --negative-filter which just does the opposite of --filter. The implementation is intentionally 'dumb' because handling 'what if one or both is not defined?' gets a bit awkward if you try to handle both in one function. Signed-off-by: Adam Williamson <[email protected]>
fec7c41 to
9e6627e
Compare
martin-schulze-vireso
approved these changes
Oct 11, 2025
Member
|
Thanks for your contribution! I am sorry for taking so long to merge this. |
Contributor
Author
|
No problem! Thanks for the merge. |
Contributor
Author
|
Are you planning a release soon, btw? |
Member
The new Version was just released @AdamWill . Sorry about the delay and late reply. I could not tell how long it would take and did not want to commit to any schedule. |
Contributor
Author
|
awesome news, thanks! |
truffle-dev
added a commit
to truffle-dev/bats-core
that referenced
this pull request
Apr 20, 2026
The bats(1) man page is missing OPTIONS entries for four flags that exist in `bats --help` and have working implementations in `libexec/bats-core/bats`: * `--abort` (added 2025-10-12, commit 2153e6a) * `--errexit` (added 2025-07-26, commit 185f268) * `--negative-filter` (added 2025-07-16, commit 9e6627e, bats-core#1114) * `--parallel-binary-name` (added 2023-05-28, commit 2c31eb3) `bats.1.ronn` was last touched in November 2022, before any of these landed. The descriptions added here mirror the wording of `bats --help` so the two stay in sync. Verified with `comm -23` of help-flags vs man-flags before and after; the gap is now empty in both directions. Only `bats.1.ronn` is touched. `bats.1` was not regenerated because the toolchain version available locally would have introduced unrelated header noise; happy to regen with a specific Ronn-NG version if a maintainer prefers.
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See https://pagure.io/fedora-qa/os-autoinst-distri-fedora/pull-request/389 . The FAQ claimed "So you could try to invert the regex", but as far as I can tell, there's no practical way to do this with bash regexes, if you want to express "run all tests except foo_in_a" or something like that. You can do it in some regex flavors using negative lookahead matches, but bash's regex flavor does not seem to support that, and you can't just stick a
!on the front of the regex or anything like that.So, this adds --negative-filter which just does the opposite of --filter. The implementation is intentionally 'dumb' because handling 'what if one or both is not defined?' gets a bit awkward if you try to handle both in one function.