threads::shared 1.18
[p5sagit/p5-mst-13.2.git] / ext / threads / t / stack_env.t
CommitLineData
514612b7 1use strict;
2use warnings;
3
4BEGIN {
5 if ($ENV{'PERL_CORE'}){
6 chdir 't';
7 unshift @INC, '../lib';
8 }
9 use Config;
10 if (! $Config{'useithreads'}) {
11 print("1..0 # Skip: Perl not compiled with 'useithreads'\n");
12 exit(0);
13 }
14}
15
16use ExtUtils::testlib;
17
18sub ok {
19 my ($id, $ok, $name) = @_;
20
21 # You have to do it this way or VMS will get confused.
22 if ($ok) {
23 print("ok $id - $name\n");
24 } else {
25 print("not ok $id - $name\n");
26 printf("# Failed test at line %d\n", (caller)[2]);
27 }
28
29 return ($ok);
30}
31
32BEGIN {
33 $| = 1;
34 print("1..4\n"); ### Number of tests that will be run ###
35
a662d730 36 $ENV{'PERL5_ITHREADS_STACK_SIZE'} = 128*4096;
514612b7 37};
38
39use threads;
40ok(1, 1, 'Loaded');
41
42### Start of Testing ###
43
a662d730 44ok(2, threads->get_stack_size() == 128*4096,
514612b7 45 '$ENV{PERL5_ITHREADS_STACK_SIZE}');
a662d730 46ok(3, threads->set_stack_size(144*4096) == 128*4096,
514612b7 47 'Set returns previous value');
a662d730 48ok(4, threads->get_stack_size() == 144*4096,
514612b7 49 'Get stack size');
50
51# EOF