]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - tools/regression/ia64/emulated/brl.t
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / tools / regression / ia64 / emulated / brl.t
1 #!/usr/bin/env perl -w
2 #
3 # Copyright (c) 2006 Marcel Moolenaar
4 # All rights reserved.
5 #
6 # Redistribution and use in source and binary forms, with or without
7 # modification, are permitted provided that the following conditions
8 # are met:
9 #
10 # 1. Redistributions of source code must retain the above copyright
11 #    notice, this list of conditions and the following disclaimer.
12 # 2. Redistributions in binary form must reproduce the above copyright
13 #    notice, this list of conditions and the following disclaimer in the
14 #    documentation and/or other materials provided with the distribution.
15 #
16 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 #
27 # $FreeBSD$
28
29 my $srcdir = `dirname $0`;
30 chomp $srcdir;
31
32 my @types = ("Call", "Cond");
33 my @preds = ("False", "True");
34 my %variant_mapping = (
35         "Call" => "",
36         "Cond" => "Backward Forward"
37 );
38
39 sub run ($$$$) {
40     local ($nr, $type, $pred, $var) = @_;
41     local $test = "${type}_${pred}_${var}";
42     local $tmpfile = "/tmp/" . $$ . "_$test";
43     local $st;
44
45     $st = system("cc -o $tmpfile -DTYPE=$type -DPRED=$pred -DVAR=$var -Wall -O1 -g $srcdir/test.c");
46     if ($st != 0) {
47         print "not ok $nr $test # compiling $test\n";
48     }
49     else {
50         $st = system($tmpfile);
51         if ($st == 0) {
52             print "ok $nr $test\n";
53         }
54         elsif ($st == 256) {
55             print "not ok $nr $test # invalid combination\n";
56         }
57         elsif ($st == 512) {
58             print "not ok $nr $test # long branch failure\n";
59         }
60         else {
61             print "not ok $nr $test # signalled (exit status $st)\n";
62             return; # Preserve the executable
63         }
64     }
65     unlink $tmpfile;
66 }
67
68 #
69 # We can only test the long brach emulation on the Merced processor.
70 # Check for that and skip these tests if it's not...
71 #
72 $_ = `sysctl -n hw.model`;
73 if (! /^Merced$/) {
74     print "1..0 # SKIP This test can only be run on the Merced\n";
75     exit 0;
76 }
77
78 #
79 # Get the total number of tests we're going to perform.
80 #
81 my $count = 0;
82 foreach $type (@types) {
83     my @variants = split(/ /, $variant_mapping{$type});
84     $count += @preds * @variants;
85 }
86
87 print "1..$count\n";
88
89 my $nr=0;
90 foreach $type (@types) {
91     my @variants = split(/ /, $variant_mapping{$type});
92     foreach $pred (@preds) {
93         foreach $var (@variants) {
94             run ++$nr, $type, $pred, $var;
95         }
96     }
97 }
98
99 exit 0;