# HG changeset patch # User Paul Eggert # Date 1321674587 28800 # Node ID 7794e6651e42682f05d220d7e325c374ad621869 # Parent 4179fa4ac7588a1e4436b74ba977b4b189bf1645 test-getcwd: disambiguate exit status * tests/test-getcwd.c (test_long_name): Return 0..7. (main): Exit with an unambiguous exit status. The old code yielded a mysterious mixture of two failure codes. diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2011-11-18 Paul Eggert + test-getcwd: disambiguate exit status + * tests/test-getcwd.c (test_long_name): Return 0..7. + (main): Exit with an unambiguous exit status. The old + code yielded a mysterious mixture of two failure codes. + fstatat: fix configuration bug on mingw, OpenBSD 4, Solaris 8 * lib/fstatat.c (AT_FUNC_NAME): Use HAVE_FSTAT, not HAVE_WORKING_FSTATAT_ZERO_FLAG, to decide whether to define diff --git a/tests/test-getcwd.c b/tests/test-getcwd.c --- a/tests/test-getcwd.c +++ b/tests/test-getcwd.c @@ -134,7 +134,7 @@ size_t n_chdirs = 0; if (cwd == NULL) - return 10; + return 1; cwd_len = initial_cwd_len = strlen (cwd); @@ -152,7 +152,7 @@ if (mkdir (DIR_NAME, S_IRWXU) < 0 || chdir (DIR_NAME) < 0) { if (! (errno == ERANGE || errno == ENAMETOOLONG || errno == ENOENT)) - fail = 20; + fail = 2; break; } @@ -161,12 +161,12 @@ c = getcwd (buf, PATH_MAX); if (!c && errno == ENOENT) { - fail = 11; + fail = 3; break; } if (c || ! (errno == ERANGE || errno == ENAMETOOLONG)) { - fail = 21; + fail = 4; break; } } @@ -181,12 +181,12 @@ if (! (errno == ERANGE || errno == ENOENT || errno == ENAMETOOLONG)) { - fail = 22; + fail = 5; break; } if (AT_FDCWD || errno == ERANGE || errno == ENOENT) { - fail = 12; + fail = 6; break; } } @@ -194,7 +194,7 @@ if (c && strlen (c) != cwd_len) { - fail = 23; + fail = 7; break; } ++n_chdirs; @@ -224,5 +224,5 @@ int main (int argc, char **argv) { - return test_abort_bug () + test_long_name (); + return test_abort_bug () * 8 + test_long_name (); }