changeset 16098:7794e6651e42

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.
author Paul Eggert <eggert@cs.ucla.edu>
date Fri, 18 Nov 2011 19:49:47 -0800
parents 4179fa4ac758
children 8cde7f4a7e97
files ChangeLog tests/test-getcwd.c
diffstat 2 files changed, 13 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2011-11-18  Paul Eggert  <eggert@cs.ucla.edu>
 
+	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
--- 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 ();
 }