summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2007-10-20 12:37:10 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2007-10-20 12:37:10 +0000
commitf3c3058e17d6e7c0f6d0af5829d7f013c60dcd66 (patch)
tree6b9698140c331499049b90abf06fa6739c252308
parent74de22b76500c4bf124bd4f215423e6b1fa03a1d (diff)
Give more details on failure.
-rw-r--r--regress/lib/libc/dirname/dirname_test.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/regress/lib/libc/dirname/dirname_test.c b/regress/lib/libc/dirname/dirname_test.c
index 0dd95d6c308..add76980cfd 100644
--- a/regress/lib/libc/dirname/dirname_test.c
+++ b/regress/lib/libc/dirname/dirname_test.c
@@ -30,7 +30,7 @@ main(void)
strlcat(path, fname, sizeof(path));
str = dirname(path);
if (strcmp(str, dname) != 0)
- goto fail;
+ errx(1, "0: dirname(%s) = %s != %s", path, str, dname);
/*
* There are four states that require special handling:
@@ -52,20 +52,20 @@ main(void)
/* Case 1 */
str = dirname(NULL);
if (strcmp(str, ".") != 0)
- goto fail;
+ errx(1, "1: dirname(NULL) = %s != .", str);
/* Case 2 */
strlcpy(path, "", sizeof(path));
str = dirname(path);
if (strcmp(str, ".") != 0)
- goto fail;
+ errx(1, "2: dirname(%s) = %s != .", path, str);
/* Case 3 */
for (i = 0; i < MAXPATHLEN - 1; i++)
strlcat(path, "/", sizeof(path)); /* path cleared above */
str = dirname(path);
if (strcmp(str, "/") != 0)
- goto fail;
+ errx(1, "3: dirname(%s) = %s != /", path, str);
/* Case 4 */
strlcpy(path, "/", sizeof(path)); /* reset path */
@@ -73,10 +73,10 @@ main(void)
strlcat(path, dir, sizeof(path));
strlcat(path, fname, sizeof(path));
str = dirname(path);
- if (str != NULL || errno != ENAMETOOLONG)
- goto fail;
+ if (str != NULL)
+ errx(1, "4: dirname(%s) = %s != NULL", path, str);
+ if (errno != ENAMETOOLONG)
+ errx(1, "4: dirname(%s) sets errno to %d", path, errno);
return (0);
-fail:
- return (1);
}