]> git.saurik.com Git - apple/ld64.git/blame - unit-tests/bin/pass-iff-exit-non-zero.pl
ld64-409.12.tar.gz
[apple/ld64.git] / unit-tests / bin / pass-iff-exit-non-zero.pl
CommitLineData
a61fdf0a
A
1#!/usr/bin/perl -w
2
3#
4# Usage:
5#
6# ${PASS_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
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)
23{
24 printf("FAIL $test_name\n");
25 exit 1;
26}
27
28printf("PASS $test_name\n");
29exit 0;