1*b39c5158Smillert#!perl 2*b39c5158Smillert 3*b39c5158Smillertuse strict; 4*b39c5158Smillertuse warnings; 5*b39c5158Smillert 6*b39c5158Smillertrequire "test.pl"; 7*b39c5158Smillert 8*b39c5158Smillertplan(4); 9*b39c5158Smillert 10*b39c5158Smillertuse XS::APItest; 11*b39c5158Smillert 12*b39c5158Smillertmy ($prog, $expect) = (<<'PROG', <<'EXPECT'); 13*b39c5158Smillertuse XS::APItest; 14*b39c5158Smillertprint "ok\n"; 15*b39c5158Smillertmy_exit(1); 16*b39c5158Smillertprint "not\n"; 17*b39c5158SmillertPROG 18*b39c5158Smillertok 19*b39c5158SmillertEXPECT 20*b39c5158Smillertfresh_perl_is($prog, $expect); 21*b39c5158Smillert 22*b39c5158Smillert# C's EXIT_FAILURE ends up as SS$_ABORT (decimal 44) on VMS, which gets 23*b39c5158Smillert# shifted to 4. Perl_my_exit (unlike Perl_my_failure_exit) does not 24*b39c5158Smillert# have access to the vmsish pragmas to modify that behavior. 25*b39c5158Smillert 26*b39c5158Smillertmy $exit_failure = $^O eq 'VMS' ? 4 : 1; 27*b39c5158Smillertis($? >> 8, $exit_failure, "exit code plain my_exit"); 28*b39c5158Smillert 29*b39c5158Smillert($prog, $expect) = (<<'PROG', <<'EXPECT'); 30*b39c5158Smillertuse XS::APItest; 31*b39c5158Smillertprint "ok\n"; 32*b39c5158Smillertcall_sv( sub { my_exit(1); }, G_EVAL ); 33*b39c5158Smillertprint "not\n"; 34*b39c5158SmillertPROG 35*b39c5158Smillertok 36*b39c5158SmillertEXPECT 37*b39c5158Smillertfresh_perl_is($prog, $expect); 38*b39c5158Smillertis($? >> 8, $exit_failure, "exit code my_exit inside a call_sv with G_EVAL"); 39*b39c5158Smillert 40