Imported Upstream version 1.4.19
[platform/upstream/m4.git] / tests / test-stat.h
index 22552dc..e728ca2 100644 (file)
@@ -1,5 +1,5 @@
 /* Tests of stat.
-   Copyright (C) 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2009-2021 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
@@ -12,7 +12,7 @@
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
 
 /* Written by Eric Blake <ebb9@byu.net>, 2009.  */
 
@@ -27,17 +27,23 @@ test_stat_func (int (*func) (char const *, struct stat *), bool print)
 {
   struct stat st1;
   struct stat st2;
-  char cwd[PATH_MAX];
+  char *cwd = getcwd (NULL, 0);
 
-  ASSERT (getcwd (cwd, PATH_MAX) == cwd);
+  ASSERT (cwd);
   ASSERT (func (".", &st1) == 0);
   ASSERT (func ("./", &st2) == 0);
+#if !(defined _WIN32 && !defined __CYGWIN__ && !_GL_WINDOWS_STAT_INODES)
   ASSERT (SAME_INODE (st1, st2));
+#endif
   ASSERT (func (cwd, &st2) == 0);
+#if !(defined _WIN32 && !defined __CYGWIN__ && !_GL_WINDOWS_STAT_INODES)
   ASSERT (SAME_INODE (st1, st2));
+#endif
   ASSERT (func ("/", &st1) == 0);
   ASSERT (func ("///", &st2) == 0);
+#if !(defined _WIN32 && !defined __CYGWIN__ && !_GL_WINDOWS_STAT_INODES)
   ASSERT (SAME_INODE (st1, st2));
+#endif
 
   errno = 0;
   ASSERT (func ("", &st1) == -1);
@@ -95,6 +101,7 @@ test_stat_func (int (*func) (char const *, struct stat *), bool print)
   ASSERT (unlink (BASE "link2") == 0);
   ASSERT (unlink (BASE "link3") == 0);
   ASSERT (unlink (BASE "link4") == 0);
+  free (cwd);
 
   return 0;
 }