]> git.saurik.com Git - apple/ld64.git/blob - unit-tests/bin/fail-if-exit-zero.pl
ld64-409.12.tar.gz
[apple/ld64.git] / unit-tests / bin / fail-if-exit-zero.pl
1 #!/usr/bin/perl -w
2
3 use strict;
4
5 my $test_name = "";
6 if ( exists $ENV{UNIT_TEST_NAME} ) {
7 $test_name = $ENV{UNIT_TEST_NAME};
8 }
9
10 my $ret = system(@ARGV);
11 my $exit_value = $ret >> 8;
12 my $signal_num = $ret & 127;
13 my $dumped_core = $ret & 128;
14 my $crashed = $signal_num + $dumped_core;
15
16 if(0 == $exit_value || 0 != $crashed)
17 {
18 printf("FAIL $test_name\n");
19 exit 1;
20 }
21
22 exit 0;