192372Sphk#!/usr/bin/perl -w 292372Sphk# 392372Sphk# Copyright (C) 2001 Jason Evans <jasone@freebsd.org>. 492372Sphk# All rights reserved. 592372Sphk# 692372Sphk# Redistribution and use in source and binary forms, with or without 792372Sphk# modification, are permitted provided that the following conditions 892372Sphk# are met: 992372Sphk# 1. Redistributions of source code must retain the above copyright 1092372Sphk# notice(s), this list of conditions and the following disclaimer 1192372Sphk# unmodified other than the allowable addition of one or more 1292372Sphk# copyright notices. 1392372Sphk# 2. Redistributions in binary form must reproduce the above copyright 1492372Sphk# notice(s), this list of conditions and the following disclaimer in 1592372Sphk# the documentation and/or other materials provided with the 1692372Sphk# distribution. 1792372Sphk# 1892372Sphk# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY 1992372Sphk# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2092372Sphk# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 2192372Sphk# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE 2292372Sphk# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 2392372Sphk# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 2492372Sphk# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 2592372Sphk# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 2692372Sphk# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 2792372Sphk# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 2892372Sphk# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2992372Sphk# 3092372Sphk# $FreeBSD$ 3192372Sphk# 3292372Sphk# Test thread stack guard functionality. The C test program needs to be driven 3392372Sphk# by this script because it segfaults when the stack guard is hit. 3492372Sphk# 3592372Sphk 3692372Sphkprint "1..30\n"; 3792372Sphk 3892372Sphk$i = 0; 3992372Sphk# Iterates 10 times. 4092372Sphkfor ($stacksize = 65536; $stacksize < 131072; $stacksize += 7168) 4192372Sphk{ 4292372Sphk # Iterates 3 times (1024, 4096, 7168). 4392372Sphk for ($guardsize = 1024; $guardsize < 8192; $guardsize += 3072) 4492372Sphk { 45110183Sphk $i++; 4692372Sphk 4792372Sphk print "stacksize: $stacksize, guardsize: $guardsize\n"; 4892372Sphk 4992372Sphk `./guard_b $stacksize $guardsize >guard_b.out 2>&1`; 5092372Sphk 5192372Sphk if (! -f "./guard_b.out") 5292372Sphk { 5392372Sphk print "not ok $i\n"; 5492372Sphk } 5592372Sphk else 5692372Sphk { 5792372Sphk `diff guard_b.exp guard_b.out >guard_b.diff 2>&1`; 5892372Sphk if ($?) 5992372Sphk { 6097075Sphk # diff returns non-zero if there is a difference. 6192372Sphk print "not ok $i\n"; 6292372Sphk } 63110183Sphk else 64106100Sphk { 65106100Sphk print "ok $i\n"; 66106100Sphk } 6792372Sphk } 6892372Sphk } 6992372Sphk} 70110183Sphk