159667Sjasone#!/usr/bin/perl -w
259667Sjasone#
359667Sjasone# Copyright (C) 2000 Jason Evans <jasone@freebsd.org>.
459667Sjasone# All rights reserved.
559667Sjasone#
659667Sjasone# Redistribution and use in source and binary forms, with or without
759667Sjasone# modification, are permitted provided that the following conditions
859667Sjasone# are met:
959667Sjasone# 1. Redistributions of source code must retain the above copyright
1059667Sjasone#    notice(s), this list of conditions and the following disclaimer as
1159667Sjasone#    the first lines of this file unmodified other than the possible
1259667Sjasone#    addition of one or more copyright notices.
1359667Sjasone# 2. Redistributions in binary form must reproduce the above copyright
1459667Sjasone#    notice(s), this list of conditions and the following disclaimer in
1559667Sjasone#    the documentation and/or other materials provided with the
1659667Sjasone#    distribution.
1759667Sjasone#
1859667Sjasone# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
1959667Sjasone# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2059667Sjasone# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
2159667Sjasone# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE
2259667Sjasone# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2359667Sjasone# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2459667Sjasone# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
2559667Sjasone# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
2659667Sjasone# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
2759667Sjasone# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
2859667Sjasone# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2959667Sjasone#
3059667Sjasone###########################################################################
3159667Sjasone#
32103412Smini# Verify that no cancellation points are propagated inside of libpthread.
3359667Sjasone#
3459667Sjasone# $FreeBSD$
3559667Sjasone#
3659667Sjasone
3759667Sjasone@CPOINTS = ("aio_suspend", "close", "creat", "fcntl", "fsync", "mq_receive",
3859667Sjasone	    "mq_send", "msync", "nanosleep", "open", "pause",
3959667Sjasone	    "pthread_cond_timedwait", "pthread_cond_wait", "pthread_join",
4059667Sjasone	    "pthread_testcancel", "read", "sem_wait", "sigsuspend",
4159667Sjasone	    "sigtimedwait", "sigwait", "sigwaitinfo", "sleep", "system",
4259667Sjasone	    "tcdrain", "wait", "waitpid", "write");
4359667Sjasone
4459667Sjasoneprint "1..1\n";
4559667Sjasone
4659667Sjasone$cpoints = join '\|', @CPOINTS;
4759667Sjasone$regexp = "\" U \\(" . $cpoints . "\\\)\$\"";
4859667Sjasone
4959667Sjasone`nm -a /usr/lib/libc.a |grep $regexp >propagate_s.out`;
5059667Sjasoneif (!open (NMOUT, "<./propagate_s.out"))
5159667Sjasone{
5259667Sjasone    print "not ok 1\n";
5359667Sjasone}
5459667Sjasoneelse
5559667Sjasone{
5659667Sjasone    $propagations = 0;
5759667Sjasone
5859667Sjasone    while (<NMOUT>)
5959667Sjasone    {
6059667Sjasone	$propagations++;
6159667Sjasone	print "$_\n";
6259667Sjasone    }
6359667Sjasone    if ($propagations != 0)
6459667Sjasone    {
6559667Sjasone	print "$propagations propagation(s)\n";
6659667Sjasone	print "not ok 1\n";
6759667Sjasone    }
6859667Sjasone    else
6959667Sjasone    {
7059667Sjasone	print "ok 1\n";
7159667Sjasone    }
7259667Sjasone    close NMOUT;
7359667Sjasone    unlink "propagate_s.out";
7459667Sjasone}
75