udev-rules: terminate log messages with period

This commit is contained in:
Yu Watanabe
2023-06-05 11:21:28 +09:00
parent c507c81ee7
commit 4134614fc0
3 changed files with 43 additions and 43 deletions
+30 -30
View File
@@ -168,16 +168,16 @@ assert_0 "${rules}"
printf 'RUN+="/bin/true"%8176s\\\n #\n' ' ' ' ' >"${rules}"
echo >>"${rules}"
cat >"${exp}" <<EOF
${rules}:5 Line is too long, ignored
${rules}: udev rules check failed
${rules}:5 Line is too long, ignored.
${rules}: udev rules check failed.
EOF
cp "${workdir}/default_output_1_fail" "${exo}"
assert_1 "${rules}"
printf '\\\n' >"${rules}"
cat >"${exp}" <<EOF
${rules}:1 Unexpected EOF after line continuation, line ignored
${rules}: udev rules check failed
${rules}:1 Unexpected EOF after line continuation, line ignored.
${rules}: udev rules check failed.
EOF
cp "${workdir}/default_output_1_fail" "${exo}"
assert_1 "${rules}"
@@ -191,7 +191,7 @@ test_syntax_error() {
printf '%s\n' "${rule}" >"${rules}"
cat >"${exp}" <<EOF
${rules}:1 ${msg}
${rules}: udev rules check failed
${rules}: udev rules check failed.
EOF
cp "${workdir}/default_output_1_fail" "${exo}"
assert_1 "${rules}"
@@ -273,12 +273,12 @@ test_syntax_error 'OWNER{a}="b"' 'Invalid attribute for OWNER.'
test_syntax_error 'OWNER-="b"' 'Invalid operator for OWNER.'
test_syntax_error 'OWNER!="b"' 'Invalid operator for OWNER.'
test_syntax_error 'OWNER+="0"' "OWNER key takes '=' or ':=' operator, assuming '='."
test_syntax_error 'OWNER=":nosuchuser:"' "Unknown user ':nosuchuser:', ignoring"
test_syntax_error 'OWNER=":nosuchuser:"' "Unknown user ':nosuchuser:', ignoring."
test_syntax_error 'GROUP{a}="b"' 'Invalid attribute for GROUP.'
test_syntax_error 'GROUP-="b"' 'Invalid operator for GROUP.'
test_syntax_error 'GROUP!="b"' 'Invalid operator for GROUP.'
test_syntax_error 'GROUP+="0"' "GROUP key takes '=' or ':=' operator, assuming '='."
test_syntax_error 'GROUP=":nosuchgroup:"' "Unknown group ':nosuchgroup:', ignoring"
test_syntax_error 'GROUP=":nosuchgroup:"' "Unknown group ':nosuchgroup:', ignoring."
test_syntax_error 'MODE{a}="b"' 'Invalid attribute for MODE.'
test_syntax_error 'MODE-="b"' 'Invalid operator for MODE.'
test_syntax_error 'MODE!="b"' 'Invalid operator for MODE.'
@@ -292,30 +292,30 @@ test_syntax_error 'SECLABEL{a}:="b"' "SECLABEL key takes '=' or '+=' operator, a
test_syntax_error 'RUN=="b"' 'Invalid operator for RUN.'
test_syntax_error 'RUN-="b"' 'Invalid operator for RUN.'
test_syntax_error 'RUN="%"' 'Invalid value "%" for RUN (char 1: invalid substitution type), ignoring.'
test_syntax_error 'RUN{builtin}+="foo"' "Unknown builtin command 'foo', ignoring"
test_syntax_error 'RUN{builtin}+="foo"' "Unknown builtin command 'foo', ignoring."
test_syntax_error 'GOTO{a}="b"' 'Invalid attribute for GOTO.'
test_syntax_error 'GOTO=="b"' 'Invalid operator for GOTO.'
test_syntax_error 'NAME="a", GOTO="b"' 'GOTO="b" has no matching label, ignoring'
test_syntax_error 'NAME="a", GOTO="b"' 'GOTO="b" has no matching label, ignoring.'
test_syntax_error 'GOTO="a", GOTO="b"
LABEL="a"' 'Contains multiple GOTO keys, ignoring GOTO="b".'
test_syntax_error 'LABEL{a}="b"' 'Invalid attribute for LABEL.'
test_syntax_error 'LABEL=="b"' 'Invalid operator for LABEL.'
test_syntax_error 'LABEL="b"' 'LABEL="b" is unused.'
test_syntax_error 'a="b"' "Invalid key 'a'"
test_syntax_error 'KERNEL=="", KERNEL=="?*", NAME="a"' 'conflicting match expressions, the line has no effect'
test_syntax_error 'KERNEL=="abc", KERNEL!="abc", NAME="b"' 'conflicting match expressions, the line has no effect'
test_syntax_error 'KERNEL=="|a|b", KERNEL!="b|a|", NAME="c"' 'conflicting match expressions, the line has no effect'
test_syntax_error 'KERNEL=="a|b", KERNEL=="c|d|e", NAME="f"' 'conflicting match expressions, the line has no effect'
test_syntax_error 'a="b"' "Invalid key 'a'."
test_syntax_error 'KERNEL=="", KERNEL=="?*", NAME="a"' 'conflicting match expressions, the line has no effect.'
test_syntax_error 'KERNEL=="abc", KERNEL!="abc", NAME="b"' 'conflicting match expressions, the line has no effect.'
test_syntax_error 'KERNEL=="|a|b", KERNEL!="b|a|", NAME="c"' 'conflicting match expressions, the line has no effect.'
test_syntax_error 'KERNEL=="a|b", KERNEL=="c|d|e", NAME="f"' 'conflicting match expressions, the line has no effect.'
# shellcheck disable=SC2016
test_syntax_error 'ENV{DISKSEQ}=="?*", ENV{DEVTYPE}!="partition", ENV{DISKSEQ}!="?*", ENV{ID_IGNORE_DISKSEQ}!="1", SYMLINK+="disk/by-diskseq/$env{DISKSEQ}"' \
'conflicting match expressions, the line has no effect'
test_syntax_error 'ACTION=="a*", ACTION=="bc*", NAME="d"' 'conflicting match expressions, the line has no effect'
test_syntax_error 'ACTION=="a*|bc*", ACTION=="d*|ef*", NAME="g"' 'conflicting match expressions, the line has no effect'
test_syntax_error 'KERNEL!="", KERNEL=="?*", NAME="a"' 'duplicate expressions'
test_syntax_error 'KERNEL=="|a|b", KERNEL=="b|a|", NAME="c"' 'duplicate expressions'
'conflicting match expressions, the line has no effect.'
test_syntax_error 'ACTION=="a*", ACTION=="bc*", NAME="d"' 'conflicting match expressions, the line has no effect.'
test_syntax_error 'ACTION=="a*|bc*", ACTION=="d*|ef*", NAME="g"' 'conflicting match expressions, the line has no effect.'
test_syntax_error 'KERNEL!="", KERNEL=="?*", NAME="a"' 'duplicate expressions.'
test_syntax_error 'KERNEL=="|a|b", KERNEL=="b|a|", NAME="c"' 'duplicate expressions.'
# shellcheck disable=SC2016
test_syntax_error 'ENV{DISKSEQ}=="?*", ENV{DEVTYPE}!="partition", ENV{DISKSEQ}=="?*", ENV{ID_IGNORE_DISKSEQ}!="1", SYMLINK+="disk/by-diskseq/$env{DISKSEQ}"' \
'duplicate expressions'
'duplicate expressions.'
test_syntax_error ',ACTION=="a", NAME="b"' 'Stray leading comma.'
test_syntax_error ' ,ACTION=="a", NAME="b"' 'Stray leading comma.'
test_syntax_error ', ACTION=="a", NAME="b"' 'Stray leading comma.'
@@ -342,9 +342,9 @@ assert_0 "${rules}"
echo 'GOTO="a"' >"${rules}"
cat >"${exp}" <<EOF
${rules}:1 GOTO="a" has no matching label, ignoring
${rules}:1 GOTO="a" has no matching label, ignoring.
${rules}:1 The line has no effect any more, dropping.
${rules}: udev rules check failed
${rules}: udev rules check failed.
EOF
cp "${workdir}/default_output_1_fail" "${exo}"
assert_1 "${rules}"
@@ -362,7 +362,7 @@ LABEL="b"
EOF
cat >"${exp}" <<EOF
${rules}:3 LABEL="b" is unused.
${rules}: udev rules check failed
${rules}: udev rules check failed.
EOF
cp "${workdir}/default_output_1_fail" "${exo}"
assert_1 "${rules}"
@@ -373,10 +373,10 @@ LABEL="a", LABEL="b"
EOF
cat >"${exp}" <<EOF
${rules}:2 Contains multiple LABEL keys, ignoring LABEL="a".
${rules}:1 GOTO="a" has no matching label, ignoring
${rules}:1 GOTO="a" has no matching label, ignoring.
${rules}:1 The line has no effect any more, dropping.
${rules}:2 LABEL="b" is unused.
${rules}: udev rules check failed
${rules}: udev rules check failed.
EOF
cp "${workdir}/default_output_1_fail" "${exo}"
assert_1 "${rules}"
@@ -385,9 +385,9 @@ cat >"${rules}" <<'EOF'
KERNEL!="", KERNEL=="?*", KERNEL=="", NAME="a"
EOF
cat >"${exp}" <<EOF
${rules}:1 duplicate expressions
${rules}:1 conflicting match expressions, the line has no effect
${rules}: udev rules check failed
${rules}:1 duplicate expressions.
${rules}:1 conflicting match expressions, the line has no effect.
${rules}: udev rules check failed.
EOF
cp "${workdir}/default_output_1_fail" "${exo}"
assert_1 "${rules}"
@@ -398,7 +398,7 @@ EOF
cat >"${exp}" <<EOF
${rules}:1 A comma between tokens is expected.
${rules}:1 Whitespace between tokens is expected.
${rules}: udev rules check failed
${rules}: udev rules check failed.
EOF
cp "${workdir}/default_output_1_fail" "${exo}"
assert_1 "${rules}"
@@ -409,7 +409,7 @@ EOF
cat >"${exp}" <<EOF
${rules}:1 Stray whitespace before comma.
${rules}:1 Whitespace after comma is expected.
${rules}: udev rules check failed
${rules}: udev rules check failed.
EOF
cp "${workdir}/default_output_1_fail" "${exo}"
assert_1 "${rules}"