tests: tolerate SELinux setfscreatecon warning on Android/Termux
* init.cfg (remove_selinux_warning_): New function. * testsuite/in-place-hyphen.sh: Use it before comparing stderr. * testsuite/in-place-suffix-backup.sh: Likewise. * testsuite/panic-tests.sh: Likewise. * testsuite/temp-file-cleanup.sh: Likewise. Reported by Bruno Haible in https://lists.gnu.org/r/sed-devel/2026-04/msg00019.html
This commit is contained in:
1 parent
a8d3d77433
commit
13604c8f68
5 files changed
+13
No files matched your search
@@ -187,3 +187,12 @@ or use the shortcut target of the toplevel Makefile,
|
||||
'
|
||||
fi
|
||||
}
|
||||
|
||||
# Remove SELinux setfscreatecon warnings from FILE(s).
|
||||
# On Android/Termux, SELinux is enabled but setfscreatecon is denied,
|
||||
# producing harmless warnings on stderr during in-place editing.
|
||||
remove_selinux_warning_()
|
||||
{
|
||||
sed -i '/warning: failed to set default file creation context/d' "$@" \
|
||||
|| framework_failure_
|
||||
}
|
||||
@@ -24,6 +24,7 @@ echo aXc > exp-out || framework_failure_
|
||||
sed -i 's/b/X/' - > out 2> err || fail=1
|
||||
|
||||
compare exp-out ./- || fail=1
|
||||
remove_selinux_warning_ err
|
||||
compare /dev/null err || fail=1
|
||||
|
||||
Exit $fail
|
||||
@@ -52,6 +52,7 @@ test -e d=d || fail=1
|
||||
# TODO: improve error message;
|
||||
# document why exit code is 4.
|
||||
returns_ 4 sed -i'***' = ./e 2>err-rename || fail=1
|
||||
remove_selinux_warning_ err-rename
|
||||
compare_ exp-err-rename err-rename || fail=1
|
||||
|
||||
# backup filename resolving to the same as the input filename,
|
||||
|
||||
@@ -40,6 +40,7 @@ EOF
|
||||
# TODO: why exit-code 4 (currently hard-coded)
|
||||
returns_ 4 sed -i = a/a 2>err-temp || fail=1
|
||||
|
||||
remove_selinux_warning_ err-temp
|
||||
# trim the filename/errno message (using sed itself...)
|
||||
sed -i 's/file.*$/file/' err-temp || framework_failure_
|
||||
compare_ exp-err-temp err-temp || fail=1
|
||||
|
||||
@@ -28,6 +28,7 @@ printf 'sed: -e expression #1, char 0: no previous regular expression\n' \
|
||||
returns_ 1 sed -i s//b/ in > out 2> err || fail=1
|
||||
|
||||
compare /dev/null out || fail=1
|
||||
remove_selinux_warning_ err
|
||||
compare exp err || fail=1
|
||||
|
||||
# Ensure that no other file has been created in this directory.
|
||||
|
||||
Reference in new issue
Block a user