From bdfb88423763fc4b132f69a7a73ec68841a3c34c Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Fri, 4 Jul 2025 16:54:49 +0900 Subject: [PATCH] TEST-17-UDEV: conditionalize test cases for testuser Then, we can also run the test script in our local machine. --- test/units/TEST-17-UDEV.verify.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/test/units/TEST-17-UDEV.verify.sh b/test/units/TEST-17-UDEV.verify.sh index 9580ba4ac1..b456fdef72 100755 --- a/test/units/TEST-17-UDEV.verify.sh +++ b/test/units/TEST-17-UDEV.verify.sh @@ -315,8 +315,10 @@ if ! getent passwd 12345 >/dev/null; then test_syntax_error 'OWNER="12345"' "Unknown user '12345', ignoring." fi # regular user -test_syntax_error 'OWNER="testuser"' "User 'testuser' is not a system user, ignoring." -test_syntax_error "OWNER=\"$(id -u testuser)\"" "User '$(id -u testuser)' is not a system user, ignoring." +if getent passwd testuser >/dev/null; then + test_syntax_error 'OWNER="testuser"' "User 'testuser' is not a system user, ignoring." + test_syntax_error "OWNER=\"$(id -u testuser)\"" "User '$(id -u testuser)' is not a system user, ignoring." +fi 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.' @@ -345,8 +347,10 @@ if ! getent group 12345 >/dev/null; then test_syntax_error 'GROUP="12345"' "Unknown group '12345', ignoring." fi # regular group -test_syntax_error 'GROUP="testuser"' "Group 'testuser' is not a system group, ignoring." -test_syntax_error "GROUP=\"$(id -g testuser)\"" "Group '$(id -g testuser)' is not a system group, ignoring." +if getent group testuser >/dev/null; then + test_syntax_error 'GROUP="testuser"' "Group 'testuser' is not a system group, ignoring." + test_syntax_error "GROUP=\"$(id -g testuser)\"" "Group '$(id -g testuser)' is not a system group, ignoring." +fi 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.'