tests: ignore $__CF_USER_TEXT_ENCODING in env during commandtest

This environment variable is supposedly set according to the contents
of ~/.CFUserTextEncoding, and certainly on MacOS 14 (Sonoma) it is set
in the environment of child processes created by execve() (used by
virCommand()), causing commandtest to fail. (However, the value that is
shown in $__CF_USER_TEXT_ENCODING during the test 1) is not in the
environment of the shell the test is run from, and 2) doesn't match
the contents of ~/.CFUserTextEncoding.)

It is true, though, that filtering out this environment setting from
the test results permits commandtest to pass on macOS 14 (Sonoma).

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
This commit is contained in:
Laine Stump 2023-11-02 23:55:27 -04:00
parent 4f4a8dce94
commit 3d9019e64f

View File

@ -169,9 +169,12 @@ static int printEnvironment(FILE *log)
for (i = 0; i < length; i++) {
/* Ignore the variables used to instruct the loader into
* behaving differently, as they could throw the tests off. */
if (!STRPREFIX(newenv[i], "LD_"))
* behaving differently, as they could throw the tests off.
* Also ignore __CF_USER_TEXT_ENCODING, which is set by macOS. */
if (!STRPREFIX(newenv[i], "LD_") &&
!STRPREFIX(newenv[i], "__CF_USER_TEXT_ENCODING=")) {
fprintf(log, "ENV:%s\n", newenv[i]);
}
}
return 0;