X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=tests%2Ftest-canonicalize.c;h=f8d35365f456131cd5bd2bec7d30ca870f08383b;hb=4e48756921cae0aec44afad18bfaa881890e6142;hp=7de6059e06f44d6a357ee388ff1dca1e01753ea8;hpb=231bdaf6198a766ae5442fef6f4b8e661d523868;p=gnulib.git diff --git a/tests/test-canonicalize.c b/tests/test-canonicalize.c index 7de6059e0..f8d35365f 100644 --- a/tests/test-canonicalize.c +++ b/tests/test-canonicalize.c @@ -1,5 +1,5 @@ /* Test of execution of file name canonicalization. - Copyright (C) 2007-2009 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -29,29 +29,25 @@ #include #include "same-inode.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "ignore-value.h" +#include "macros.h" #define BASE "t-can.tmp" +static void * +null_ptr (void) +{ + return NULL; +} + int -main () +main (void) { /* Setup some hierarchy to be used by this test. Start by removing any leftovers from a previous partial run. */ { int fd; - ASSERT (system ("rm -rf " BASE " ise") == 0); + ignore_value (system ("rm -rf " BASE " ise")); ASSERT (mkdir (BASE, 0700) == 0); fd = creat (BASE "/tra", 0600); ASSERT (0 <= fd); @@ -67,7 +63,7 @@ main () ASSERT (result2 != NULL); ASSERT (strcmp (result1, result2) == 0); ASSERT (strstr (result1, "/" BASE "/tra") - == result1 + strlen (result1) - strlen ("/" BASE "/tra")); + == result1 + strlen (result1) - strlen ("/" BASE "/tra")); free (result1); free (result2); errno = 0; @@ -79,7 +75,7 @@ main () ASSERT (result2 == NULL); ASSERT (errno == ENOENT); errno = 0; - result1 = canonicalize_file_name (NULL); + result1 = canonicalize_file_name (null_ptr ()); ASSERT (result1 == NULL); ASSERT (errno == EINVAL); errno = 0; @@ -122,7 +118,7 @@ main () ASSERT (remove (BASE "/tra") == 0); ASSERT (rmdir (BASE) == 0); fputs ("skipping test: symlinks not supported on this file system\n", - stderr); + stderr); return 77; } ASSERT (symlink ("bef", BASE "/plo") == 0);