]> git.saurik.com Git - apple/ld64.git/blob - ld64-134.9/unit-tests/bin/pass-iff-exit-non-zero.pl
beb76a99400973ac844fc51808889fb48d492c30
[apple/ld64.git] / ld64-134.9 / unit-tests / bin / pass-iff-exit-non-zero.pl
1 #!/usr/bin/perl -w
2
3 #
4 # Usage:
5 #
6 # ${PASS_IFF} command
7 #
8
9 use strict;
10
11 my $test_name = "";
12 if ( exists $ENV{UNIT_TEST_NAME} ) {
13 $test_name = $ENV{UNIT_TEST_NAME};
14 }
15
16 my $ret = system(@ARGV);
17 my $exit_value = $ret >> 8;
18 my $signal_num = $ret & 127;
19 my $dumped_core = $ret & 128;
20 my $crashed = $signal_num + $dumped_core;
21
22 if(0 == $exit_value || 0 != $crashed)
23 {
24 printf("FAIL $test_name\n");
25 exit 1;
26 }
27
28 printf("PASS $test_name\n");
29 exit 0;