-
Notifications
You must be signed in to change notification settings - Fork 331
Open
Description
Description
When using buck test with the --include flag, the position of the flag relative to the target pattern affects whether tests are matched.
This is probably intentional behaviour but it is extremely confusing and merits a warning at minimum (and quite possibly revision).
Setup
Create a directory //foobar in this repo:
BUCK:
sh_test(
name = "test_with_label",
test = "test.sh",
labels = ["some_test_label"],
)
sh_test(
name = "test_without_label",
test = "test.sh",
)test.sh:
#!/bin/bash
# Simple passing test
exit 0
Reproduction
Repro'd on: a72a88b
Weird: Flag before target pattern (matches no tests)
cargo run -p buck2 -- test --include some_test_label //foobar/...
Tests finished: Pass 0. Fail 0. Fatal 0. Skip 0. Omit 0. Infra Failure 0. Build failure 0
NO TESTS RAN
Working: Flag after target pattern
cargo run -p buck2 -- test //foobar/... --include some_test_label
✓ Pass: gh_facebook_buck2//foobar:test_with_label (0.1s)
Tests finished: Pass 1. Fail 0. Fatal 0. Skip 0. Omit 0. Infra Failure 0. Build failure 0
Verification
I didn't goof up the labels AFAIK:
cargo run -p buck2 -- uquery //foobar:test_with_label --output-attribute labels
{
"gh_facebook_buck2//foobar:test_with_label": {
"labels": [
"some_test_label"
]
}
}
Expected Behavior
Either:
- Both commands should produce the same result
- The one that silently does the surprising thing of skipping all tests should print a warning
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels