Test::Smoke::SysInfo - OO interface to system specific information
use Test::Smoke::SysInfo; my $si = Test::Smoke::SysInfo->new; printf "Hostname: %s\n", $si->host; printf "Number of CPU's: %s\n", $si->ncpu; printf "Processor type: %s\n", $si->cpu_type; # short printf "Processor description: %s\n", $si->cpu; # long printf "OS and version: %s\n", $si->os;
or
use Test::Smoke::SysInfo qw( sysinfo ); printf "[%s]\n", sysinfo();
$ perl -MTest::Smoke::SysInfo=tsuname -le print+tsuname
Sometimes one wants a more eleborate description of the system one is smoking.
Dispatch to one of the OS-specific subs.
This is the short info string about the Operating System.
This is the short info string about the cpu-type. The POSIX module should provide one (portably) with POSIX::uname().
POSIX::uname()
We do not have a portable way to get this information, so assign _cpu_type to it.
_cpu_type
Get the hostname from POSIX::uname().
Get the information from POSIX::uname()
Use the lsdev program to find information.
Use the ioscan, getconf and machinfo programs to find information.
This routine was contributed by Rich Rauenzahn.
Use the sysctl program to find information.
If the system_profiler program is accessible (meaning that this is Mac OS X), use it to find information; otherwise treat as "BSD( )".
This sub was donated by Dominic Dunlup.
Use the hinv program to get the system information.
Helper function to get information from /proc/cpuinfo
Use the /proc/cpuinfo pseudofile to get the system information.
/proc/cpuinfo
Linux on sparc architecture seems too different from intel
Linux on ppc architecture seems too different from intel
Linux on ARM architecture.
Contents of /proc/cpuinfo on RaspberryPI, raspbian:
Processor : ARMv6-compatible processor rev 7 (v6l) BogoMIPS : 697.95 Features : swp half thumb fastmult vfp edsp java tls CPU implementer : 0x41 CPU architecture: 7 CPU variant : 0x0 CPU part : 0xb76 CPU revision : 7 Hardware : BCM2708 Revision : 000e Serial : 00000000dc08448c
Contents of /proc/cpuinfo on Archos 101IT, Android 2.2:
Processor : ARMv7 Processor rev 2 (v7l) BogoMIPS : 298.32 Features : swp half thumb fastmult vfp edsp neon vfpv3 CPU implementer : 0x41 CPU architecture: 7 CPU variant : 0x3 CPU part : 0xc08 CPU revision : 2 Hardware : Archos A101IT board Board : 0005 OMAP revision : ES1.2 Revision : 0000 Serial : 0000000000000000 Boot : 4.04.000000
Use the psrinfo program to get the system information. Used also in Tru64 (osf).
Use the %ENV hash to find information. Fall back on the *::Generic values if these values have been unset or are unavailable (sorry I do not have Win9[58]).
%ENV
Use Win32::TieRegistry if available to get better information.
Use some VMS specific stuff to get system information. These were suggested by Craig Berry.
sysinfo() returns a string with host, os and cpu_type.
sysinfo()
host
os
cpu_type
This class gathers most of the uname(1) info, make a comparable version. Takes almost the same arguments:
uname(1)
a for all (can be omitted) n for nodename s for os name and version m for cpu name c for cpu count p for cpu_type
Test::Smoke::Smoker, Test::Smoke::Reporter
(c) 2002-2006, Abe Timmerman <abeltje@cpan.org> All rights reserved.
With contributions from Jarkko Hietaniemi, Merijn Brand, Campo Weijerman, Alan Burlison, Allen Smith, Alain Barbet, Dominic Dunlop, Rich Rauenzahn, David Cantrell.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
See:
http://www.perl.com/perl/misc/Artistic.html
http://www.gnu.org/copyleft/gpl.html
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
To install Test::Smoke, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Test::Smoke
CPAN shell
perl -MCPAN -e shell install Test::Smoke
For more information on module installation, please visit the detailed CPAN module installation guide.