From bea8978fb8ab1a6d106fc6761b50fb55a98373d4 Mon Sep 17 00:00:00 2001 From: rpj Date: Tue, 19 Aug 2003 07:09:12 +0000 Subject: Fix accidental corruption of some test cases. --- tests/GNUmakefile | 56 ++++++++++++++++++++++++------------------------ tests/Makefile | 64 +++++++++++++++++++++++++++---------------------------- tests/kill1.c | 2 +- tests/reuse2.c | 4 ++-- tests/valid2.c | 15 ++++++------- 5 files changed, 70 insertions(+), 71 deletions(-) (limited to 'tests') diff --git a/tests/GNUmakefile b/tests/GNUmakefile index 560cb42..d4ce2ce 100644 --- a/tests/GNUmakefile +++ b/tests/GNUmakefile @@ -1,34 +1,34 @@ # Makefile for the pthreads test suite. # If all of the .pass files can be created, the test suite has passed. # - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2003 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This 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 of the License, or (at your option) any later version. - * - * This 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 this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA +# -------------------------------------------------------------------------- +# +# Pthreads-win32 - POSIX Threads Library for Win32 +# Copyright(C) 1998 John E. Bossom +# Copyright(C) 1999,2003 Pthreads-win32 contributors +# +# Contact Email: rpj@callisto.canberra.edu.au +# +# The current list of contributors is contained +# in the file CONTRIBUTORS included with the source +# code distribution. The list can also be seen at the +# following World Wide Web location: +# http://sources.redhat.com/pthreads-win32/contributors.html +# +# This 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 of the License, or (at your option) any later version. +# +# This 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 this library in the file COPYING.LIB; +# if not, write to the Free Software Foundation, Inc., +# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA # diff --git a/tests/Makefile b/tests/Makefile index 11e2b82..0000e8c 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -1,34 +1,34 @@ # Makefile for the pthreads test suite. # If all of the .pass files can be created, the test suite has passed. # - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2003 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This 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 of the License, or (at your option) any later version. - * - * This 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 this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA +# -------------------------------------------------------------------------- +# +# Pthreads-win32 - POSIX Threads Library for Win32 +# Copyright(C) 1998 John E. Bossom +# Copyright(C) 1999,2003 Pthreads-win32 contributors +# +# Contact Email: rpj@callisto.canberra.edu.au +# +# The current list of contributors is contained +# in the file CONTRIBUTORS included with the source +# code distribution. The list can also be seen at the +# following World Wide Web location: +# http://sources.redhat.com/pthreads-win32/contributors.html +# +# This 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 of the License, or (at your option) any later version. +# +# This 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 this library in the file COPYING.LIB; +# if not, write to the Free Software Foundation, Inc., +# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA # @@ -75,7 +75,7 @@ PASSES= loadfree.pass \ mutex1.pass mutex1n.pass mutex1e.pass mutex1r.pass mutex2.pass mutex3.pass \ condvar1.pass condvar1_1.pass condvar1_2.pass condvar2.pass condvar2_1.pass \ exit1.pass create1.pass create2.pass reuse1.pass reuse2.pass equal1.pass \ - kill1.pass valid1.pass valid2.pass \ + kill1.pass valid1.pass valid2.pass \ exit2.pass exit3.pass \ join0.pass join1.pass join2.pass \ mutex4.pass mutex6.pass mutex6n.pass mutex6e.pass mutex6r.pass \ @@ -249,7 +249,7 @@ inherit1.pass: join1.pass join0.pass: create1.pass join1.pass: create1.pass join2.pass: create1.pass -kill1.pass: +kill1.pass: loadfree.pass: pthread.dll mutex1.pass: self1.pass mutex1n.pass: mutex1.pass @@ -298,5 +298,5 @@ spin2.pass: spin1.pass spin3.pass: spin2.pass spin4.pass: spin3.pass tsd1.pass: join1.pass -valid1.pass: join1.pass -valid2.pass: valid1.pass +valid1.pass: join1.pass +valid2.pass: valid1.pass diff --git a/tests/kill1.c b/tests/kill1.c index d1bad37..b9477fc 100644 --- a/tests/kill1.c +++ b/tests/kill1.c @@ -79,7 +79,7 @@ main() { void * result = NULL; - assert(pthread_kill(pthread_self(), 0) == EINVAL); + assert(pthread_kill(pthread_self(), 1) == EINVAL); return 0; } diff --git a/tests/reuse2.c b/tests/reuse2.c index e517d7a..625611e 100644 --- a/tests/reuse2.c +++ b/tests/reuse2.c @@ -79,13 +79,13 @@ enum { }; -static int done = ; +static long done = 0; void * func(void * arg) { sched_yield(); - InterlockedIncrement((void *) &done); + InterlockedIncrement(&done); return (void *) 0; } diff --git a/tests/valid2.c b/tests/valid2.c index 84b94a4..ad01b55 100644 --- a/tests/valid2.c +++ b/tests/valid2.c @@ -72,20 +72,19 @@ */ #include "test.h" - int main() { - pthread_t t; - - assert(sizeof(t) > (4 * sizeof(void *))); + pthread_t ptrToNull = NULL; + /* This should be bigger than a pthread handle. */ + char corruptDummy[1000]; - t = (pthread_t) malloc(sizeof(t)); + memset(corruptDummy, 0x5A, sizeof(corruptDummy)); - assert(t != NULL); - memset(t, 0x5A, sizeof(t)); - assert(pthread_kill(t, 0) == ESRCH); + assert(pthread_kill(NULL, 0) == ESRCH); + assert(pthread_kill(ptrToNull, 0) == ESRCH); + assert(pthread_kill((pthread_t) corruptDummy, 0) == ESRCH); return 0; } -- cgit v1.2.3