1238104Sdes#!/usr/bin/perl -w
2238104Sdes#
3238104Sdes# Copyright (C) 2000 Jason Evans <jasone@freebsd.org>.
4238104Sdes# All rights reserved.
5238104Sdes#
6238104Sdes# Redistribution and use in source and binary forms, with or without
7238104Sdes# modification, are permitted provided that the following conditions
8238104Sdes# are met:
9238104Sdes# 1. Redistributions of source code must retain the above copyright
10238104Sdes#    notice(s), this list of conditions and the following disclaimer as
11238104Sdes#    the first lines of this file unmodified other than the possible
12238104Sdes#    addition of one or more copyright notices.
13238104Sdes# 2. Redistributions in binary form must reproduce the above copyright
14238104Sdes#    notice(s), this list of conditions and the following disclaimer in
15238104Sdes#    the documentation and/or other materials provided with the
16238104Sdes#    distribution.
17238104Sdes#
18238104Sdes# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
19238104Sdes# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20238104Sdes# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21238104Sdes# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE
22238104Sdes# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23238104Sdes# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24238104Sdes# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
25238104Sdes# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26238104Sdes# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
27238104Sdes# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
28238104Sdes# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29238104Sdes#
30238104Sdes###########################################################################
31238104Sdes#
32238104Sdes# Verify that no cancellation points are propagated inside of libpthread.
33238104Sdes#
34238104Sdes# $FreeBSD$
35238104Sdes#
36238104Sdes
37238104Sdes@CPOINTS = ("aio_suspend", "close", "creat", "fcntl", "fsync", "mq_receive",
38238104Sdes	    "mq_send", "msync", "nanosleep", "open", "pause",
39238104Sdes	    "pthread_cond_timedwait", "pthread_cond_wait", "pthread_join",
40238104Sdes	    "pthread_testcancel", "read", "sem_wait", "sigsuspend",
41238104Sdes	    "sigtimedwait", "sigwait", "sigwaitinfo", "sleep", "system",
42238104Sdes	    "tcdrain", "wait", "waitpid", "write");
43238104Sdes
44238104Sdesprint "1..1\n";
45238104Sdes
46238104Sdes$cpoints = join '\|', @CPOINTS;
47238104Sdes$regexp = "\" U \\(" . $cpoints . "\\\)\$\"";
48238104Sdes
49238104Sdes`nm -a /usr/lib/libc.a |grep $regexp >propagate_s.out`;
50238104Sdesif (!open (NMOUT, "<./propagate_s.out"))
51238104Sdes{
52238104Sdes    print "not ok 1\n";
53238104Sdes}
54238104Sdeselse
55238104Sdes{
56238104Sdes    $propagations = 0;
57238104Sdes
58238104Sdes    while (<NMOUT>)
59238104Sdes    {
60238104Sdes	$propagations++;
61238104Sdes	print "$_\n";
62238104Sdes    }
63238104Sdes    if ($propagations != 0)
64238104Sdes    {
65238104Sdes	print "$propagations propagation(s)\n";
66238104Sdes	print "not ok 1\n";
67238104Sdes    }
68238104Sdes    else
69238104Sdes    {
70238104Sdes	print "ok 1\n";
71238104Sdes    }
72238104Sdes    close NMOUT;
73238104Sdes    unlink "propagate_s.out";
74238104Sdes}
75238104Sdes