Deleted Added
full compact
unaligned.t (139595) unaligned.t (140892)
1#!/usr/bin/env perl -w
2#
3# Copyright (c) 2005 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:

--- 10 unchanged lines hidden (view full) ---

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#
1#!/usr/bin/env perl -w
2#
3# Copyright (c) 2005 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:

--- 10 unchanged lines hidden (view full) ---

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: head/tools/regression/ia64/unaligned/unaligned.t 139595 2005-01-02 21:33:40Z marcel $
27# $FreeBSD: head/tools/regression/ia64/unaligned/unaligned.t 140892 2005-01-27 06:50:05Z marcel $
28
29my $srcdir = `dirname $0`;
30chomp $srcdir;
31
28
29my $srcdir = `dirname $0`;
30chomp $srcdir;
31
32my $tmpfile = "/tmp/unaligned." . $$;
32my @accesses = ("Load", "Store");
33my @types = ("Integer", "FloatingPoint");
34my @sizes = ("Small", "Medium", "Large");
35my @postincs = ("NoPostInc", "MinConstPostInc", "PlusConstPostInc",
36 "ScratchRegPostInc", "PreservedRegPostInc");
33
37
34my @types = ("short", "int", "long", "float", "double", "long double");
35my %values = ( "short" => "0x1234",
36 "int" => "0x12345678",
37 "long" => "0x123456789abcdef0",
38 "float" => "1.04716",
39 "double" => "3.1415",
40 "long double" => "0.33312112048384"
41 );
42my @tests = ("TEST_LOAD", "TEST_STORE");
38sub run ($$$$$) {
39 local ($nr, $access, $type, $size, $postinc) = @_;
40 local $test = "${access}_${type}_${size}_${postinc}";
41 local $tmpfile = "/tmp/" . $$ . "_$test";
42 local $st;
43
43
44sub run ($$$) {
45 local ($nr, $type, $test) = @_;
46 local $value = $values{$type};
47 local $st;
48 $st = system("cc -o $tmpfile -DDATA_TYPE='$type' -DDATA_VALUE=$value -D$test -Wall $srcdir/test.c");
49 if ($st != 0) {
50 print "not ok $nr ($type,$test) # compiling $tmpfile\n";
51 return;
52 }
44 $st = system("cc -o $tmpfile -DACCESS=$access -DTYPE=$type -DSIZE=$size -DPOSTINC=$postinc -Wall -O -g $srcdir/test.c");
45 if ($st != 0) {
46 print "not ok $nr $test # compiling $test\n";
47 }
48 else {
53 $st = system($tmpfile);
54 if ($st == 0) {
49 $st = system($tmpfile);
50 if ($st == 0) {
55 print "ok $nr ($type,$test)\n";
51 print "ok $nr $test\n";
56 }
52 }
57 elsif ($st == 1) {
58 print "not ok $nr ($type,$test) # value mismatch\n";
53 elsif ($st == 256) {
54 print "ok $nr $test # SKIP nonexistent combination\n";
59 }
55 }
56 elsif ($st == 512) {
57 print "not ok $nr $test # value mismatch\n";
58 }
59 elsif ($st == 1024) {
60 print "not ok $nr $test # post increment mismatch\n";
61 }
60 else {
62 else {
61 print "not ok $nr ($type,$test) # signalled\n";
63 print "not ok $nr $test # signalled (exit status $st)\n";
64 return; # Preserve the executable
62 }
65 }
63 unlink $tmpfile;
66 }
67 unlink $tmpfile;
64}
65
66system("sysctl debug.unaligned_test=1");
67if (`sysctl -n debug.unaligned_test` != "1") {
68 print "1..0 # SKIP The debug.unaligned_test sysctl could not be set\n";
69 exit 0;
70}
71
68}
69
70system("sysctl debug.unaligned_test=1");
71if (`sysctl -n debug.unaligned_test` != "1") {
72 print "1..0 # SKIP The debug.unaligned_test sysctl could not be set\n";
73 exit 0;
74}
75
72my $count = @types * @tests;
76my $count = @accesses * @types * @sizes * @postincs;
73print "1..$count\n";
74
75my $nr=0;
77print "1..$count\n";
78
79my $nr=0;
76foreach $type (@types) {
77 foreach $test (@tests) {
78 run ++$nr, $type, $test;
80foreach $access (@accesses) {
81 foreach $type (@types) {
82 foreach $size (@sizes) {
83 foreach $postinc (@postincs) {
84 run ++$nr, $access, $type, $size, $postinc;
85 }
79 }
86 }
87 }
80}
81
82system("sysctl debug.unaligned_test=0");
83
84exit 0;
88}
89
90system("sysctl debug.unaligned_test=0");
91
92exit 0;