From: Laine Stump Date: Fri, 3 Nov 2023 03:55:27 +0000 (-0400) Subject: tests: ignore $__CF_USER_TEXT_ENCODING in env during commandtest X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=3d9019e64f5bd24835639e20f2c0a04f0f1feaa6;p=libvirt.git 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 Reviewed-by: Daniel P. Berrangé Reviewed-by: Andrea Bolognani --- diff --git a/tests/commandhelper.c b/tests/commandhelper.c index 9b56feb120..334b02122c 100644 --- a/tests/commandhelper.c +++ b/tests/commandhelper.c @@ -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;