This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] tst-makecontext does not handle ENOSYS


For platforms that do not support *context functions, older kernels, or
when --enable-kernel= is not specified, some platforms generate ENOSYS
stubs for the *context functions. For example powerpc64 before 2.4.21. 

In this case the new stdlib/tst-makecontext.c test will fail when it
should just report the missing function and allow the make check to
continue.

The following patch adds the ENOSYS check and integrates tst-makecontext
with test-skeleton.c


2007-01-05  Steven Munroe  <sjmunroe@us.ibm.com>

	* stdlib/tst-makecontext.c: Include errno.h and error.h. Change main()
	to do_test(). Define TEST_FUNCTION. Include test-skeleton.c.
	(do_test): Check errno and exit(0) if ENOSYS.
	

diff -urN libc25-cvstip-20070104/stdlib/tst-makecontext.c libc24/stdlib/tst-makecontext.c
--- libc25-cvstip-20070104/stdlib/tst-makecontext.c	2006-12-19 09:33:58.000000000 -0600
+++ libc24/stdlib/tst-makecontext.c	2007-01-05 14:57:38.159727312 -0600
@@ -1,4 +1,4 @@
-/* Copyright (C) 2006 Free Software Foundation, Inc.
+/* Copyright (C) 2006, 2007 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
@@ -16,6 +16,8 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
+#include <errno.h>
+#include <error.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <ucontext.h>
@@ -36,10 +38,16 @@
 }
 
 int
-main (void)
+do_test (void)
 {
   if (getcontext (&ucp) != 0)
     {
+      if (errno == ENOSYS)
+	{
+	  puts ("context handling not supported");
+	  exit (0);
+	}
+
       puts ("getcontext failed");
       return 1;
     }
@@ -55,3 +63,6 @@
     }
   return 2;
 }
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]