]> git.saurik.com Git - apple/ld64.git/blob - unit-tests/bin/fail-iff-exit-zero.pl
ld64-274.1.tar.gz
[apple/ld64.git] / unit-tests / bin / fail-iff-exit-zero.pl
1 #!/usr/bin/perl -w
2
3 #
4 # Usage:
5 #
6 # ${FALL_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;