udevadm-test: introduce -v/--verbose option to show verbose log messages

Currently this does not show any extra log messages. In later commits,
more verbose log messages will be added.
This commit is contained in:
Yu Watanabe
2025-01-13 05:09:15 +09:00
parent ce2ef96c2b
commit 8846df63fa
6 changed files with 36 additions and 14 deletions

View File

@@ -69,7 +69,8 @@ _udevadm() {
[CONTROL_ARG]='-l --log-priority -p --property -m --children-max -t --timeout'
[MONITOR_STANDALONE]='-k --kernel -u --udev -p --property'
[MONITOR_ARG]='-s --subsystem-match -t --tag-match'
[TEST]='-a --action -N --resolve-names'
[TEST_STANDALONE]='-v --verbose'
[TEST_ARG]='-a --action -N --resolve-names'
[TEST_BUILTIN]='-a --action'
[VERIFY]='-N --resolve-names --root --no-summary --no-style'
[WAIT]='-t --timeout --initialized=no --removed --settle'
@@ -216,7 +217,7 @@ _udevadm() {
;;
'test')
if __contains_word "$prev" ${OPTS[TEST]}; then
if __contains_word "$prev" ${OPTS[TEST_ARG]}; then
case $prev in
-a|--action)
comps=$( udevadm test --action help )
@@ -225,12 +226,8 @@ _udevadm() {
comps='early late never'
;;
esac
COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
return 0
fi
if [[ $cur = -* ]]; then
comps="${OPTS[COMMON]} ${OPTS[TEST]}"
elif [[ $cur = -* ]]; then
comps="${OPTS[COMMON]} ${OPTS[TEST_ARG]} ${OPTS[TEST_STANDALONE]}"
else
comps=$( __get_all_devices )
local IFS=$'\n'

View File

@@ -88,6 +88,7 @@ _udevadm_test(){
'(-)'{-V,--version}'[Show package version]' \
'--action=[The action string.]:actions:(add change remove move online offline bind unbind)' \
'--subsystem=[The subsystem string.]' \
'(-v --verbose)'{-v,--verbose}'[Show verbose logs.]' \
'*::devpath:_files -P /sys/ -W /sys'
}