[patch] tst-nice.c
Amos Waterland
apw@us.ibm.com
Wed Mar 19 01:15:00 GMT 2003
I don't know if there is any interest in regression tests, but if so,
here is one for the nice() return value problem fixed on 2002-03-02 by
Thorsten Kukuk.
2003-03-18 Amos Waterland <apw@us.ibm.com>
* posix/tst-nice.c: New file.
* posix/Makefile (tests): Add tst-nice.
--- /dev/null 2002-08-30 18:31:37.000000000 -0500
+++ tst-nice.c 2003-03-18 18:45:38.000000000 -0600
@@ -0,0 +1,49 @@
+/* Copyright (C) 2001 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <stdio.h>
+#include <unistd.h>
+
+#define TEST_FUNCTION do_test ()
+static int
+do_test (void)
+{
+ int result = 0;
+
+ /* Test that nice() does not return 0 on positive argument. */
+ {
+ int r;
+ const int incr = 10;
+
+ errno = 0;
+ r = nice (incr);
+
+ printf ("nice(%d) returned: %d\n", incr, r);
+
+ if (r != incr)
+ {
+ printf ("fail: return value (%d) of nice(%d) != %d\n", r, incr, incr);
+ ++result;
+ }
+ }
+
+ return result;
+}
+
+#include "../test-skeleton.c"
--- Makefile 2003-03-18 18:50:05.000000000 -0600
+++ Makefile.apw 2003-03-18 18:27:31.000000000 -0600
@@ -75,7 +75,7 @@
tst-chmod bug-regex1 bug-regex2 bug-regex3 bug-regex4 \
tst-gnuglob tst-regex bug-regex5 bug-regex6 bug-regex7 \
bug-regex8 bug-regex9 bug-regex10 bug-regex11 bug-regex12 \
- bug-regex13 bug-regex14 bug-regex15 bug-regex16
+ bug-regex13 bug-regex14 bug-regex15 bug-regex16 tst-nice
ifeq (yes,$(build-shared))
test-srcs := globtest
tests += wordexp-test tst-exec tst-spawn
More information about the Libc-alpha
mailing list