]> git.saurik.com Git - apple/dyld.git/blame - unit-tests/bin/exit-non-zero-pass.pl
dyld-360.22.tar.gz
[apple/dyld.git] / unit-tests / bin / exit-non-zero-pass.pl
CommitLineData
0959b6d4
A
1#!/usr/bin/perl -w
2
3use strict;
4
5sub PASS
6{
7 my ($format, $args) = @_;
8 if(!defined $args)
9 { $args = []; }
10 printf("PASS \"$format\"\n", @$args);
11}
12
13sub FAIL
14{
15 my ($format, $args) = @_;
16 if(!defined $args)
17 { $args = []; }
18 printf("FAIL \"$format\"\n", @$args);
19}
20
21my $pass_string = shift @ARGV;
22my $fail_string = shift @ARGV;
23
bac542e6
A
24
25# redirect stderr to stdout
26open(STDERR, ">/tmp/exit-non-zero.tmp") || die("$!");
0959b6d4
A
27if(0 != system(@ARGV))
28{
29 PASS($pass_string);
30}
31else
32{
33 FAIL($fail_string);
34}
bac542e6
A
35close(STDERR) || die("$!");
36open(OUT, "</tmp/exit-non-zero.tmp") || die("$!");
37while(<OUT>)
38{
39 print $_;
40}
41close(OUT) || die("$!");
412ebb8e 42unlink "/tmp/exit-non-zero.tmp";
0959b6d4
A
43exit 0;
44