Merge pull request #3566 from lordofhyphens/broken-exceptions

Add unit test to pre-emptively check for Slic3r hangs (thanks Strawberry Perl!)
This commit is contained in:
Alessandro Ranellucci 2016-11-21 18:49:16 +01:00 committed by GitHub
commit 7bae3ccd6b
3 changed files with 26 additions and 1 deletions

View File

@ -121,6 +121,7 @@ t/18_motionplanner.t
t/19_model.t
t/20_print.t
t/21_gcode.t
t/22_exception.t
xsp/BoundingBox.xsp
xsp/BridgeDetector.xsp
xsp/Clipper.xsp

16
xs/t/22_exception.t Normal file
View File

@ -0,0 +1,16 @@
#!/usr/bin/perl
use strict;
use warnings;
use Slic3r::XS;
use Test::More tests => 1;
{
eval {
Slic3r::xspp_test_croak_hangs_on_strawberry();
};
is $@, "xspp_test_croak_hangs_on_strawberry: exception catched\n", 'croak from inside a C++ exception delivered';
}
__END__

View File

@ -16,4 +16,12 @@ VERSION()
RETVAL = newSVpv(SLIC3R_VERSION, 0);
OUTPUT: RETVAL
%}
void
xspp_test_croak_hangs_on_strawberry()
CODE:
try {
throw 1;
} catch (...) {
croak("xspp_test_croak_hangs_on_strawberry: exception catched\n");
}
%}