File: threads.t

package info (click to toggle)
slic3r 1.3.0%2Bdfsg1-6
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 8,572 kB
  • sloc: cpp: 63,126; perl: 21,512; ansic: 6,312; sh: 591; xml: 201; makefile: 37; python: 11
file content (40 lines) | stat: -rw-r--r-- 841 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
use Test::More;
use strict;
use warnings;

BEGIN {
    use FindBin;
    use lib "$FindBin::Bin/../lib";
    use local::lib "$FindBin::Bin/../local-lib";
}

use List::Util qw(first);
use Slic3r;
use Slic3r::Test;

if (!$Slic3r::have_threads) {
    plan skip_all => "this perl is not compiled with threads";
}
plan tests => 2;

{
    my $print = Slic3r::Test::init_print('20mm_cube');
    {
        my $thread = threads->create(sub { Slic3r::thread_cleanup(); return 1; });
        ok $thread->join, "print survives thread spawning";
    }
}
    
{
    my $thread = threads->create(sub {
        {
            my $print = Slic3r::Test::init_print('20mm_cube');
            Slic3r::Test::gcode($print);
        }
        Slic3r::thread_cleanup();
        return 1;
    });
    ok $thread->join, "process print in a separate thread";
}

__END__