2 # Copyright (C) 2008-2010, Parrot Foundation.
5 # initial work by Brad Gilbert b2gills <at> gmail <dot> com
9 use lib qw( . lib ../lib ../../lib );
14 use Parrot::Test tests => 14;
20 t/op/sysinfo.t - System Info
24 % prove t/op/sysinfo.t
28 Tests for basic system information.
32 =item 1 The size of a platform integer
34 =item 2 The size of a platform float
36 =item 3 The size of a platform pointer. (Largest possible data pointer)
40 =item 5 The OS version string
42 =item 6 The OS version number string
44 =item 7 The CPU architecture
48 =item 9, 10 The min and max INTVAL values
56 { pconfig_key => 'intvalsize',
58 pir_key => 'SYSINFO_PARROT_INTSIZE',
59 desc => 'integer size',
62 { pconfig_key => 'doublesize',
64 pir_key => 'SYSINFO_PARROT_FLOATSIZE',
68 { pconfig_key => 'ptrsize',
70 pir_key => 'SYSINFO_PARROT_POINTERSIZE',
71 desc => 'pointer size',
74 { pconfig_key => 'osname',
76 pir_key => 'SYSINFO_PARROT_OS',
80 { pconfig_key => 'cpuarch',
82 pir_key => 'SYSINFO_CPU_ARCH',
83 desc => 'CPU Arch Family',
89 if ( $_->{reg_type} eq 'I' ) {
90 pasm_output_is( <<"CODE", $PConfig{$_->{pconfig_key}}, "PASM sysinfo $_->{desc}" );
91 sysinfo_i_ic I1, $_->{pasm_key}
95 pir_output_is( <<"CODE", $PConfig{$_->{pconfig_key}}, "PIR sysinfo $_->{desc}" );
96 .include 'sysinfo.pasm'
98 \$I0 = sysinfo .$_->{pir_key}
104 pasm_output_is( <<"CODE", $PConfig{$_->{pconfig_key}}, "sysinfo $_->{desc}" );
105 sysinfo_s_ic S1, $_->{pasm_key}
109 pir_output_is( <<"CODE", $PConfig{$_->{pconfig_key}}, "PIR sysinfo $_->{desc}" );
110 .include 'sysinfo.pasm'
112 \$S0 = sysinfo .$_->{pir_key}
121 $PConfig{osname} eq 'MSWin32'
122 or skip "Tests only meaningful on Win32", 2;
125 eval { require Win32; } or
126 skip "requires package Win32 for these tests", 2;
128 my $osname = Win32::GetOSName();
129 $osname = 'WinXP' if $osname =~ m/^WinXP/;
131 local $TODO = "Not Currently Implemented";
132 pasm_output_is( <<'CODE', $osname, "sysinfo OS version string" );
138 my ( $osvername, $major, $minor, $id ) = Win32::GetOSVersion();
140 pasm_output_is( <<'CODE', "$major.$minor", "sysinfo OS version number string" );
146 } # END inner SKIP block
147 } # END outer SKIP block
151 skip "Requires a lot of work to find out the correct answer", 1;
153 pasm_output_is( <<'CODE', $PConfig{archname}, "sysinfo CPU Model" );
164 skip 'Testing only in some known platforms', 1
165 unless $PConfig{osname} eq 'linux';
167 pir_output_like( <<'CODE', '/^-[1-9][0-9]*\n[1-9][0-9]*\n$/', 'INTVAL min and max values');
168 .include 'sysinfo.pasm'
170 $I0 = sysinfo .SYSINFO_PARROT_INTMIN
172 $I0 = sysinfo .SYSINFO_PARROT_INTMAX
180 # cperl-indent-level: 4
183 # vim: expandtab shiftwidth=4: