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