From: Roman Bolshakov Date: Wed, 21 Aug 2019 16:13:18 +0000 (+0300) Subject: tests: Drop /private CWD prefix in commandhelper X-Git-Tag: v5.7.0-rc1~85 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c6b3bf9302f008fc7fd5f45587ad169444869562;p=thirdparty%2Flibvirt.git tests: Drop /private CWD prefix in commandhelper /tmp is a symbolic link to /private/tmp on macOS. That causes failures in commandtest, because getcwd returns /private/tmp and the expected output doesn't match to "CWD: /tmp". Rathern than making a copy of commanddata solely for macOS, the /private prefix is stripped. Signed-off-by: Roman Bolshakov --- diff --git a/tests/commandhelper.c b/tests/commandhelper.c index 1312f3ee52..872564b144 100644 --- a/tests/commandhelper.c +++ b/tests/commandhelper.c @@ -130,7 +130,16 @@ int main(int argc, char **argv) { if (strlen(cwd) > strlen(".../commanddata") && STREQ(cwd + strlen(cwd) - strlen("/commanddata"), "/commanddata")) strcpy(cwd, ".../commanddata"); +# ifdef __APPLE__ + char *noprivateprefix = NULL; + if (strstr(cwd, "/private")) + noprivateprefix = cwd + strlen("/private"); + else + noprivateprefix = cwd; + fprintf(log, "CWD:%s\n", noprivateprefix); +# else fprintf(log, "CWD:%s\n", cwd); +# endif free(cwd); fprintf(log, "UMASK:%04o\n", umask(0));