Commit graph

29 commits

Author SHA1 Message Date
Daan De Meyer 7a321b5a21 test: Rename testsuite-XX units to match test name
Having these named differently than the test itself mostly creates
unecessary confusion and makes writing logic against the tests harder
so let's rename the testsuite-xx units and scripts to just use the
test name itself.
2024-05-14 12:43:28 +02:00
Yu Watanabe 1bf3dd4153 udev: downgrade log level about style issues
And add --no-style switch that make style issues not critical.
2023-06-05 11:37:26 +09:00
Yu Watanabe 2ef0959fbe test: drop unnecessary copy of expected output 2023-06-05 11:21:28 +09:00
Yu Watanabe 4134614fc0 udev-rules: terminate log messages with period 2023-06-05 11:21:28 +09:00
Dmitry V. Levin 9e36da1541 udevadm-verify: introduce --no-summary option
When udevadm verify is invoked by an analyzer tool like rpminspect
to verify individual udev rules files, the summary just clutters the
output, so provide an option to turn the summary off.
2023-05-21 23:20:30 +09:00
Dmitry V. Levin a9802abaee udevadm-verify: add support for directory arguments
When an argument specified to udevadm verify is a directory,
verify all *.rules files in that directory.

Suggested-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
2023-05-18 17:00:00 +00:00
Dmitry V. Levin 75390455cb testsuite-17.11.sh: fix assert_1()
Fix assert_1() to exit with an error status in case of a failed assertion.
2023-05-18 15:45:55 +00:00
Frantisek Sumsal e71bac7222 test: make shellcheck happy again
No functional changes.
2023-05-16 23:07:45 +02:00
Frantisek Sumsal cb153b4fe9 test: rename assert.sh to util.sh
So we can extend it with additional utility functions without making it
confusing.

No functional change.
2023-05-16 22:43:52 +02:00
Dmitry V. Levin 56df2f6f9b udev-rules: check tokens order
When invoked by udevadm verify, warn about rules that have PROGRAM
assignments specified after RESULT checks.
2023-04-03 23:44:26 +09:00
Dmitry V. Levin 139203e1d4 udev_rules_parse_file: do not ignore ENOENT when invoked by udevadm verify
Make sure the ENOENT exception reintroduced by commit
9db7081d83 is not applied when the parser
is invoked by udevadm verify.
2023-03-29 18:50:29 +09:00
Dmitry V. Levin ebb00082d8 udev-rules: fix grammar in diagnostics about lines that have no effect
Fixes: 25de7aa7b9 ("udev: modernize udev-rules.c")
2023-03-27 10:00:30 +00:00
Dmitry V. Levin 860e2a1115 udev-rules: extend the check for conflicting expressions
Log an error when a rule line contains the following kind of conflicting
match expressions:

  KEY=="foo*", KEY=="bar*"
2023-03-27 10:00:30 +00:00
Dmitry V. Levin acc1954a03 udev-rules: check token delimiters
When udev_rules_parse_file() is called by udevadm verify, issue warnings
about the following conditions in udev rules:
* the first token in the rule is preceded with a comma
* the last token in the rule is followed by a comma
* there is no comma between tokens
* there is no whitespace between tokens
* there is more than a single comma between tokens
* there is whitespace between a token and a comma
* there is no whitespace after comma
2023-03-27 10:00:30 +00:00
Dmitry V. Levin d656c49604 testsuite-17.11.sh: add commas between tokens 2023-03-27 10:00:30 +00:00
Dmitry V. Levin f0a16c9ae8 udev-rules: add another check for conflicting expressions
Log an error when a rule line contains the following kind of conflicting
match expressions:

  KEY=="foo", KEY=="bar"
2023-03-21 09:34:50 +09:00
Dmitry V. Levin 5004aa84ac udev-rules: fix check for conflicting and duplicate expressions
Fix check for conflicting and duplicate expressions of types that
support alternative patterns.

Fixes: 3ec58d0cd8 ("udev-rules: check for conflicting and duplicate expressions")
2023-03-19 11:32:09 +00:00
Yu Watanabe 7b4cae904b test: add tests for summary output of udevadm verify 2023-03-16 14:54:46 +09:00
Yu Watanabe f99deb1e94 test: reindent testsuite-17.11.sh 2023-03-16 14:54:46 +09:00
Dmitry V. Levin 3ec58d0cd8 udev-rules: check for conflicting and duplicate expressions
Log an error when a rule line contains conflicting match expressions, e.g.
  NAME=="value", NAME!="value"

Log a warning when a rule line contains duplicate expressions, e.g.
  NAME=="value", NAME=="value"
2023-03-16 03:49:57 +09:00
Dmitry V. Levin b2f7bb760a udev_rules_parse_file: issue diagnostics about duplicate LABEL tokens
When a rules contains several LABEL tokens, the parser used to silently
discard all of them besides the last one without any diagnostics at all.
It's time to break the vow of silence and let the parser issue a warning.
2023-03-10 17:10:41 +00:00
Dmitry V. Levin c8f39ddcf6 testsuite-17.11.sh: check udevadm verify --root 2023-03-10 17:10:41 +00:00
Dmitry V. Levin e8c53080c4 udevadm verify: load all rules from the system if no rules were given
When udevadm verify is invoked without positional arguments, that is,
when no udev rules files are specified, load all rules files from the system
like the udev daemon does, and verify them.
2023-03-10 17:10:41 +00:00
Dmitry V. Levin 197f695a75 testsuite-17.11.sh: prepare to test udevadm verify --root 2023-03-10 17:10:41 +00:00
Dmitry V. Levin 99f2445171 testsuite-17.11.sh: create all files in a temporary directory
Make sure the test would not collide with anything else by moving
all files it created into a temporary directory.
2023-03-10 17:10:41 +00:00
Dmitry V. Levin 0b1ee3e311 testsuite-17.11.sh: robustify unknown user/group checks
Use certainly invalid user/group names in the tests that check
unknown user/group diagnostics.
2023-03-10 17:10:41 +00:00
Dmitry V. Levin b27e5e2aca udev_rules_parse_file: issue diagnostics about line continuation at EOF
When udev rules file ends with a line continuation, the parser
used to silently ignore the line without any diagnostics at all.
It's time to break the vow of silence and let the parser issue some
error diagnostics.
2023-03-08 18:55:40 +00:00
Dmitry V. Levin 5040401b43 test: check udevadm verify diagnostics of unused labels 2023-03-08 18:55:40 +00:00
Dmitry V. Levin 45183cdd6d test: add a test for udevadm verify 2023-03-08 18:55:40 +00:00