]> xenbits.xensource.com Git - libvirt.git/commitdiff
tests: ignore $__CF_USER_TEXT_ENCODING in env during commandtest
authorLaine Stump <laine@redhat.com>
Fri, 3 Nov 2023 03:55:27 +0000 (23:55 -0400)
committerLaine Stump <laine@redhat.com>
Fri, 3 Nov 2023 17:31:26 +0000 (13:31 -0400)
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>
tests/commandhelper.c

index 9b56feb1202870d11be7df6be0c6e4a841609709..334b02122c0caaafc25a52ae49caca25954711f6 100644 (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;