changeset 23417:80c1fc2b4112

system.tst: fix failing system call tests in some corner cases * system.tst: Adjust test of getppid to allow return value to be zero, for example if Octave runs as PID 1. Ensure that endpwent is called before tests of getpwent. Ensure that endgrent is called before tests of getgrent.
author Mike Miller <mtmiller@octave.org>
date Wed, 19 Apr 2017 21:04:28 -0700
parents a40434df6f54
children 0412433f016f
files test/system.tst
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/test/system.tst	Thu Apr 20 01:10:18 2017 +0100
+++ b/test/system.tst	Wed Apr 19 21:04:28 2017 -0700
@@ -232,7 +232,7 @@
 %!error <... getpid> getpid (1)
 
 %!testif HAVE_GETPPID
-%! assert (getppid () > 0);
+%! assert (getppid () >= 0);
 
 %!error <... getppid> getppid (1)
 
@@ -296,6 +296,7 @@
 %!assert (ischar (pwd ()))
 
 %!testif HAVE_GETPWENT
+%! endpwent ();
 %! s = getpwent ();
 %! endpwent ();
 %! assert (isstruct (s)
@@ -310,6 +311,7 @@
 %!error <Invalid call to getpwent> getpwent (1)
 
 %!testif HAVE_GETPWUID
+%! endpwent ();
 %! x = getpwent ();
 %! y = getpwuid (x.uid);
 %! endpwent ();
@@ -319,6 +321,7 @@
 %!error <Invalid call to getpwuid> getpwuid (1, 2)
 
 %!testif HAVE_GETPWNAM
+%! endpwent ();
 %! x = getpwent ();
 %! y = getpwnam (x.name);
 %! endpwent ();
@@ -328,6 +331,7 @@
 %!error <Invalid call to getpwnam> getpwnam ("foo", 1)
 
 %!testif HAVE_SETPWENT
+%! endpwent ();
 %! x = getpwent ();
 %! setpwent ();
 %! y = getpwent ();
@@ -338,6 +342,7 @@
 %!error <Invalid call to endpwent> endpwent (1)
 
 %!testif HAVE_GETGRENT
+%! endgrent ();
 %! x = getgrent ();
 %! endgrent ();
 %! assert (isstruct (x)
@@ -349,6 +354,7 @@
 %!error <Invalid call to getgrent> getgrent (1)
 
 %!testif HAVE_GETGRGID
+%! endgrent ();
 %! x = getgrent ();
 %! y = getgrgid (x.gid);
 %! endgrent ();
@@ -358,6 +364,7 @@
 %!error <Invalid call to getgrgid> getgrgid (1, 2)
 
 %!testif HAVE_GETGRNAM
+%! endgrent ();
 %! x = getgrent ();
 %! y = getgrnam (x.name);
 %! endgrent ();
@@ -367,6 +374,7 @@
 %!error <Invalid call to getgrnam> getgrnam ("foo", 1)
 
 %!testif HAVE_SETGRENT
+%! endgrent ();
 %! x = getgrent ();
 %! setgrent ();
 %! y = getgrent ();