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