From: Bruno Haible Date: Sun, 22 Dec 2024 11:10:14 +0000 (+0100) Subject: posix_spawn_file_actions_addchdir tests: Avoid test failure on MSYS2. X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=40bc71a4388fd320e53fe6c14e8c8a0b1fca0b14;p=gnulib.git posix_spawn_file_actions_addchdir tests: Avoid test failure on MSYS2. * tests/test-posix_spawn-chdir.c (test): Recognize also the 'pwd' output for root on MSYS2. --- diff --git a/ChangeLog b/ChangeLog index f04dc46a62..7df1516c85 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2024-12-22 Bruno Haible + + posix_spawn_file_actions_addchdir tests: Avoid test failure on MSYS2. + * tests/test-posix_spawn-chdir.c (test): Recognize also the 'pwd' output + for root on MSYS2. + 2024-12-22 Bruno Haible test-framework-sh: Avoid test suite failures on MSYS2. diff --git a/tests/test-posix_spawn-chdir.c b/tests/test-posix_spawn-chdir.c index de8d251d90..a5f9b4af61 100644 --- a/tests/test-posix_spawn-chdir.c +++ b/tests/test-posix_spawn-chdir.c @@ -132,12 +132,19 @@ test (const char *pwd_prog) if (!(line_len == 2 && memcmp (line, "/\n", 2) == 0)) #if defined _WIN32 && !defined __CYGWIN__ /* If the pwd program is Cygwin's pwd, its output in the root directory is - "/cygdrive/N", where N is a lowercase letter. */ - if (!(line_len > 11 - && memcmp (line, "/cygdrive/", 10) == 0 - && line[10] >= 'a' && line[10] <= 'z' - && ((line_len == 12 && line[11] == '\n') - || (line_len == 13 && line[11] == '\r' && line[12] == '\n')))) + "/cygdrive/N", where N is a lowercase letter. + And if the pwd program is MSYS2 pwd, its output in the root directory is + "/N", where N is a lowercase letter. */ + if (!((line_len > 11 + && memcmp (line, "/cygdrive/", 10) == 0 + && line[10] >= 'a' && line[10] <= 'z' + && ((line_len == 12 && line[11] == '\n') + || (line_len == 13 && line[11] == '\r' && line[12] == '\n'))) + || (line_len > 2 + && line[0] == '/' + && line[1] >= 'a' && line[1] <= 'z' + && ((line_len == 3 && line[2] == '\n') + || (line_len == 4 && line[2] == '\r' && line[3] == '\n'))))) #endif { fprintf (stderr, "read output is not the expected output\n");