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