From: Richard W.M. Jones Date: Tue, 18 Jan 2011 17:03:36 +0000 (+0000) Subject: Add a test for baremetal. X-Git-Tag: 1.5~4 X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=f74a5f24635f8dbb202ad1c7ea141606ca864f1f;p=virt-what.git Add a test for baremetal. This modifies the virt-what script slightly so that a test root can be passed, which causes all tests to be run relative to that root directory (similar to a chroot). We then provide a root directory with just enough files in it to convince virt-what that it is a baremetal machine. Note that the data in the files is completely real. We do not intend to add a test unless we can get data from the real system. --- diff --git a/.gitignore b/.gitignore index 72dc52e..4f171bb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,22 +1,22 @@ *~ *.o -virt-what-*.tar.gz -.deps -Makefile -Makefile.in -aclocal.m4 -autom4te.cache -compile -config.h -config.h.in -config.log -config.status -configure -depcomp -install-sh -missing -stamp-h1 -virt-what -virt-what-cpuid-helper -virt-what.1 -virt-what.txt +/virt-what-*.tar.gz +/.deps +/Makefile +/Makefile.in +/aclocal.m4 +/autom4te.cache +/compile +/config.h +/config.h.in +/config.log +/config.status +/configure +/depcomp +/install-sh +/missing +/stamp-h1 +/virt-what +/virt-what-cpuid-helper +/virt-what.1 +/virt-what.txt diff --git a/Makefile.am b/Makefile.am index 5f76d8f..add8678 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,5 +1,5 @@ # Makefile for virt-what -# Copyright (C) 2008-2009 Red Hat Inc. +# Copyright (C) 2008-2011 Red Hat Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -32,3 +32,12 @@ virt-what.1: virt-what.pod virt-what.txt: virt-what.pod pod2text $< > $@ + +TESTS = \ + tests/test-baremetal.sh +# tests/test-kvm.sh \ +# tests/test-qemu.sh \ +# tests/test-virtualbox.sh \ +# tests/test-vmware.sh \ +# tests/test-xen-dom0.sh \ +# tests/test-xen-domU.sh diff --git a/tests/baremetal/proc/cpuinfo b/tests/baremetal/proc/cpuinfo new file mode 100644 index 0000000..c735038 --- /dev/null +++ b/tests/baremetal/proc/cpuinfo @@ -0,0 +1,100 @@ +processor : 0 +vendor_id : GenuineIntel +cpu family : 6 +model : 37 +model name : Intel(R) Core(TM) i7 CPU M 620 @ 2.67GHz +stepping : 5 +cpu MHz : 1199.000 +cache size : 4096 KB +physical id : 0 +siblings : 4 +core id : 0 +cpu cores : 2 +apicid : 0 +initial apicid : 0 +fpu : yes +fpu_exception : yes +cpuid level : 11 +wp : yes +flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm sse4_1 sse4_2 popcnt aes lahf_lm ida arat dts tpr_shadow vnmi flexpriority ept vpid +bogomips : 5320.31 +clflush size : 64 +cache_alignment : 64 +address sizes : 36 bits physical, 48 bits virtual +power management: + +processor : 1 +vendor_id : GenuineIntel +cpu family : 6 +model : 37 +model name : Intel(R) Core(TM) i7 CPU M 620 @ 2.67GHz +stepping : 5 +cpu MHz : 1199.000 +cache size : 4096 KB +physical id : 0 +siblings : 4 +core id : 0 +cpu cores : 2 +apicid : 1 +initial apicid : 1 +fpu : yes +fpu_exception : yes +cpuid level : 11 +wp : yes +flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm sse4_1 sse4_2 popcnt aes lahf_lm ida arat dts tpr_shadow vnmi flexpriority ept vpid +bogomips : 5319.69 +clflush size : 64 +cache_alignment : 64 +address sizes : 36 bits physical, 48 bits virtual +power management: + +processor : 2 +vendor_id : GenuineIntel +cpu family : 6 +model : 37 +model name : Intel(R) Core(TM) i7 CPU M 620 @ 2.67GHz +stepping : 5 +cpu MHz : 2667.000 +cache size : 4096 KB +physical id : 0 +siblings : 4 +core id : 2 +cpu cores : 2 +apicid : 4 +initial apicid : 4 +fpu : yes +fpu_exception : yes +cpuid level : 11 +wp : yes +flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm sse4_1 sse4_2 popcnt aes lahf_lm ida arat dts tpr_shadow vnmi flexpriority ept vpid +bogomips : 5319.71 +clflush size : 64 +cache_alignment : 64 +address sizes : 36 bits physical, 48 bits virtual +power management: + +processor : 3 +vendor_id : GenuineIntel +cpu family : 6 +model : 37 +model name : Intel(R) Core(TM) i7 CPU M 620 @ 2.67GHz +stepping : 5 +cpu MHz : 1199.000 +cache size : 4096 KB +physical id : 0 +siblings : 4 +core id : 2 +cpu cores : 2 +apicid : 5 +initial apicid : 5 +fpu : yes +fpu_exception : yes +cpuid level : 11 +wp : yes +flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm sse4_1 sse4_2 popcnt aes lahf_lm ida arat dts tpr_shadow vnmi flexpriority ept vpid +bogomips : 5319.71 +clflush size : 64 +cache_alignment : 64 +address sizes : 36 bits physical, 48 bits virtual +power management: + diff --git a/tests/baremetal/sbin/dmidecode b/tests/baremetal/sbin/dmidecode new file mode 100755 index 0000000..d7d67f3 --- /dev/null +++ b/tests/baremetal/sbin/dmidecode @@ -0,0 +1,653 @@ +#!/bin/sh - +cat <<'EOF' +# dmidecode 2.10 +SMBIOS 2.6 present. +78 structures occupying 2863 bytes. +Table at 0x000E0010. + +Handle 0x0000, DMI type 0, 24 bytes +BIOS Information + Vendor: LENOVO + Version: 6MET61WW (1.24 ) + Release Date: 06/07/2010 + Address: 0xE0000 + Runtime Size: 128 kB + ROM Size: 8192 kB + Characteristics: + PCI is supported + PC Card (PCMCIA) is supported + PNP is supported + BIOS is upgradeable + BIOS shadowing is allowed + ESCD support is available + Boot from CD is supported + Selectable boot is supported + EDD is supported + 3.5"/720 kB floppy services are supported (int 13h) + Print screen service is supported (int 5h) + 8042 keyboard services are supported (int 9h) + Serial services are supported (int 14h) + Printer services are supported (int 17h) + CGA/mono video services are supported (int 10h) + ACPI is supported + USB legacy is supported + BIOS boot specification is supported + Targeted content distribution is supported + BIOS Revision: 1.36 + Firmware Revision: 1.19 + +Handle 0x0001, DMI type 1, 27 bytes +System Information + Manufacturer: LENOVO + Product Name: 4384BR2 + Version: ThinkPad T510 + Serial Number: R96KY83 + UUID: 806F8C2B-5CB1-DF11-9CFD-B727E82CF6BB + Wake-up Type: Power Switch + SKU Number: Not Specified + Family: ThinkPad T510 + +Handle 0x0002, DMI type 2, 15 bytes +Base Board Information + Manufacturer: LENOVO + Product Name: 4384BR2 + Version: Not Available + Serial Number: 1ZHXV08ACAF + Asset Tag: Not Specified + Features: None + Location In Chassis: Not Specified + Chassis Handle: 0xFFFF + Type: Unknown + Contained Object Handles: 0 + +Handle 0x0003, DMI type 3, 21 bytes +Chassis Information + Manufacturer: LENOVO + Type: Notebook + Lock: Not Present + Version: Not Available + Serial Number: R96KY83 + Asset Tag: No Asset Information + Boot-up State: Unknown + Power Supply State: Unknown + Thermal State: Unknown + Security Status: Unknown + OEM Information: 0x00000000 + Height: Unspecified + Number Of Power Cords: Unspecified + Contained Elements: 0 + +Handle 0x0004, DMI type 126, 21 bytes +Inactive + +Handle 0x0005, DMI type 126, 21 bytes +Inactive + +Handle 0x0006, DMI type 4, 42 bytes +Processor Information + Socket Designation: None + Type: Central Processor + Family: Other + Manufacturer: GenuineIntel + ID: 55 06 02 00 FF FB EB BF + Version: Intel(R) Core(TM) i7 CPU M 620 @ 2.67GHz + Voltage: 1.3 V + External Clock: 133 MHz + Max Speed: 2660 MHz + Current Speed: 2660 MHz + Status: Populated, Enabled + Upgrade: None + L1 Cache Handle: 0x000A + L2 Cache Handle: 0x000B + L3 Cache Handle: 0x000C + Serial Number: Not Specified + Asset Tag: Not Specified + Part Number: Not Specified + Core Count: 2 + Core Enabled: 2 + Thread Count: 4 + Characteristics: None + +Handle 0x0007, DMI type 5, 20 bytes +Memory Controller Information + Error Detecting Method: None + Error Correcting Capabilities: + None + Supported Interleave: One-way Interleave + Current Interleave: One-way Interleave + Maximum Memory Module Size: 4096 MB + Maximum Total Memory Size: 8192 MB + Supported Speeds: + Other + Supported Memory Types: + DIMM + SDRAM + Memory Module Voltage: 2.9 V + Associated Memory Slots: 2 + 0x0008 + 0x0009 + Enabled Error Correcting Capabilities: + Unknown + +Handle 0x0008, DMI type 6, 12 bytes +Memory Module Information + Socket Designation: DIMM Slot 1 + Bank Connections: 0 1 + Current Speed: 43 ns + Type: DIMM SDRAM + Installed Size: 2048 MB (Double-bank Connection) + Enabled Size: 2048 MB (Double-bank Connection) + Error Status: OK + +Handle 0x0009, DMI type 6, 12 bytes +Memory Module Information + Socket Designation: DIMM Slot 2 + Bank Connections: 2 3 + Current Speed: 43 ns + Type: DIMM SDRAM + Installed Size: 2048 MB (Double-bank Connection) + Enabled Size: 2048 MB (Double-bank Connection) + Error Status: OK + +Handle 0x000A, DMI type 7, 19 bytes +Cache Information + Socket Designation: Internal L1 Cache + Configuration: Enabled, Socketed, Level 1 + Operational Mode: Write Through + Location: Internal + Installed Size: 32 kB + Maximum Size: 32 kB + Supported SRAM Types: + Burst + Pipeline Burst + Asynchronous + Installed SRAM Type: Asynchronous + Speed: Unknown + Error Correction Type: Single-bit ECC + System Type: Data + Associativity: 8-way Set-associative + +Handle 0x000B, DMI type 7, 19 bytes +Cache Information + Socket Designation: Internal L2 Cache + Configuration: Enabled, Socketed, Level 2 + Operational Mode: Write Through + Location: Internal + Installed Size: 256 kB + Maximum Size: 256 kB + Supported SRAM Types: + Burst + Pipeline Burst + Asynchronous + Installed SRAM Type: Burst + Speed: Unknown + Error Correction Type: Single-bit ECC + System Type: Unified + Associativity: 8-way Set-associative + +Handle 0x000C, DMI type 7, 19 bytes +Cache Information + Socket Designation: Internal L3 Cache + Configuration: Enabled, Socketed, Level 3 + Operational Mode: Write Back + Location: Internal + Installed Size: 4096 kB + Maximum Size: 8192 kB + Supported SRAM Types: + Burst + Pipeline Burst + Asynchronous + Installed SRAM Type: Burst + Speed: Unknown + Error Correction Type: Unknown + System Type: Unknown + Associativity: Unknown + +Handle 0x000D, DMI type 8, 9 bytes +Port Connector Information + Internal Reference Designator: Not Available + Internal Connector Type: None + External Reference Designator: External Monitor + External Connector Type: DB-15 female + Port Type: Video Port + +Handle 0x000E, DMI type 8, 9 bytes +Port Connector Information + Internal Reference Designator: Not Available + Internal Connector Type: None + External Reference Designator: DisplayPort + External Connector Type: Other + Port Type: Video Port + +Handle 0x000F, DMI type 126, 9 bytes +Inactive + +Handle 0x0010, DMI type 126, 9 bytes +Inactive + +Handle 0x0011, DMI type 8, 9 bytes +Port Connector Information + Internal Reference Designator: Not Available + Internal Connector Type: None + External Reference Designator: Headphone/Microphone Combo Jack + External Connector Type: Mini Jack (headphones) + Port Type: Audio Port + +Handle 0x0012, DMI type 126, 9 bytes +Inactive + +Handle 0x0013, DMI type 126, 9 bytes +Inactive + +Handle 0x0014, DMI type 8, 9 bytes +Port Connector Information + Internal Reference Designator: Not Available + Internal Connector Type: None + External Reference Designator: Ethernet + External Connector Type: RJ-45 + Port Type: Network Port + +Handle 0x0015, DMI type 8, 9 bytes +Port Connector Information + Internal Reference Designator: Not Available + Internal Connector Type: None + External Reference Designator: Modem + External Connector Type: RJ-11 + Port Type: Modem Port + +Handle 0x0016, DMI type 8, 9 bytes +Port Connector Information + Internal Reference Designator: Not Available + Internal Connector Type: None + External Reference Designator: USB 1 + External Connector Type: Access Bus (USB) + Port Type: USB + +Handle 0x0017, DMI type 8, 9 bytes +Port Connector Information + Internal Reference Designator: Not Available + Internal Connector Type: None + External Reference Designator: USB 2 + External Connector Type: Access Bus (USB) + Port Type: USB + +Handle 0x0018, DMI type 8, 9 bytes +Port Connector Information + Internal Reference Designator: Not Available + Internal Connector Type: None + External Reference Designator: USB 3 + External Connector Type: Access Bus (USB) + Port Type: USB + +Handle 0x0019, DMI type 8, 9 bytes +Port Connector Information + Internal Reference Designator: Not Available + Internal Connector Type: None + External Reference Designator: USB 4 + External Connector Type: Access Bus (USB) + Port Type: USB + +Handle 0x001A, DMI type 126, 9 bytes +Inactive + +Handle 0x001B, DMI type 126, 9 bytes +Inactive + +Handle 0x001C, DMI type 126, 9 bytes +Inactive + +Handle 0x001D, DMI type 126, 9 bytes +Inactive + +Handle 0x001E, DMI type 126, 9 bytes +Inactive + +Handle 0x001F, DMI type 126, 9 bytes +Inactive + +Handle 0x0020, DMI type 126, 9 bytes +Inactive + +Handle 0x0021, DMI type 8, 9 bytes +Port Connector Information + Internal Reference Designator: Not Available + Internal Connector Type: None + External Reference Designator: eSATA 1 + External Connector Type: SAS/SATA Plug Receptacle + Port Type: SATA + +Handle 0x0022, DMI type 126, 9 bytes +Inactive + +Handle 0x0023, DMI type 9, 17 bytes +System Slot Information + Designation: ExpressCard Slot + Type: x1 PCI Express + Current Usage: Available + Length: Other + ID: 0 + Characteristics: + Hot-plug devices are supported + Bus Address: 00ff:ff:1f.7 + +Handle 0x0024, DMI type 9, 17 bytes +System Slot Information + Designation: Media Card Slot + Type: Other + Current Usage: Available + Length: Other + Characteristics: + Hot-plug devices are supported + Bus Address: 00ff:ff:1f.7 + +Handle 0x0025, DMI type 126, 17 bytes +Inactive + +Handle 0x0026, DMI type 10, 6 bytes +On Board Device Information + Type: Other + Status: Disabled + Description: IBM Embedded Security hardware + +Handle 0x0027, DMI type 11, 5 bytes +OEM Strings + String 1: IBM ThinkPad Embedded Controller -[6MHT38WW-1.13 ]- + +Handle 0x0028, DMI type 13, 22 bytes +BIOS Language Information + Installable Languages: 1 + enUS + Currently Installed Language: enUS + +Handle 0x0029, DMI type 15, 25 bytes +System Event Log + Area Length: 0 bytes + Header Start Offset: 0x0000 + Header Length: 16 bytes + Data Start Offset: 0x0010 + Access Method: General-purpose non-volatile data functions + Access Address: 0x0000 + Status: Invalid, Full + Change Token: 0x000000F8 + Header Format: Type 1 + Supported Log Type Descriptors: 1 + Descriptor 1: POST error + Data Format 1: POST results bitmap + +Handle 0x002A, DMI type 16, 15 bytes +Physical Memory Array + Location: System Board Or Motherboard + Use: System Memory + Error Correction Type: None + Maximum Capacity: 8 GB + Error Information Handle: Not Provided + Number Of Devices: 2 + +Handle 0x002B, DMI type 17, 28 bytes +Memory Device + Array Handle: 0x002A + Error Information Handle: No Error + Total Width: 64 bits + Data Width: 64 bits + Size: 2048 MB + Form Factor: SODIMM + Set: None + Locator: DIMM 1 + Bank Locator: Bank 0/1 + Type: DDR3 + Type Detail: Synchronous + Speed: 1066 MHz + Manufacturer: 80AD + Serial Number: 5B2297AA + Asset Tag: 1018 + Part Number: HMT125S6TFR8C-G7 + Rank: Unknown + +Handle 0x002C, DMI type 17, 28 bytes +Memory Device + Array Handle: 0x002A + Error Information Handle: No Error + Total Width: 64 bits + Data Width: 64 bits + Size: 2048 MB + Form Factor: SODIMM + Set: None + Locator: DIMM 2 + Bank Locator: Bank 2/3 + Type: DDR3 + Type Detail: Synchronous + Speed: 1066 MHz + Manufacturer: 80AD + Serial Number: 5B22979A + Asset Tag: 1018 + Part Number: HMT125S6TFR8C-G7 + Rank: Unknown + +Handle 0x002D, DMI type 18, 23 bytes +32-bit Memory Error Information + Type: OK + Granularity: Unknown + Operation: Unknown + Vendor Syndrome: Unknown + Memory Array Address: Unknown + Device Address: Unknown + Resolution: Unknown + +Handle 0x002E, DMI type 19, 15 bytes +Memory Array Mapped Address + Starting Address: 0x00000000000 + Ending Address: 0x000FFFFFFFF + Range Size: 4 GB + Physical Array Handle: 0x002A + Partition Width: 0 + +Handle 0x002F, DMI type 20, 19 bytes +Memory Device Mapped Address + Starting Address: 0x00000000000 + Ending Address: 0x0007FFFFFFF + Range Size: 2 GB + Physical Device Handle: 0x002B + Memory Array Mapped Address Handle: 0x002E + Partition Row Position: 1 + +Handle 0x0030, DMI type 20, 19 bytes +Memory Device Mapped Address + Starting Address: 0x00080000000 + Ending Address: 0x000FFFFFFFF + Range Size: 2 GB + Physical Device Handle: 0x002C + Memory Array Mapped Address Handle: 0x002E + Partition Row Position: 1 + +Handle 0x0031, DMI type 21, 7 bytes +Built-in Pointing Device + Type: Track Point + Interface: PS/2 + Buttons: 3 + +Handle 0x0032, DMI type 21, 7 bytes +Built-in Pointing Device + Type: Touch Pad + Interface: PS/2 + Buttons: 0 + +Handle 0x0033, DMI type 22, 26 bytes +Portable Battery + Location: Rear + Manufacturer: SANYO + Name: 42T4799 + Design Capacity: 93240 mWh + Design Voltage: 11100 mV + SBDS Version: 03.01 + Maximum Error: Unknown + SBDS Serial Number: 4069 + SBDS Manufacture Date: 2010-08-12 + SBDS Chemistry: LION + OEM-specific Information: 0x00000000 + +Handle 0x0034, DMI type 126, 26 bytes +Inactive + +Handle 0x0035, DMI type 24, 5 bytes +Hardware Security + Power-On Password Status: Disabled + Keyboard Password Status: Disabled + Administrator Password Status: Disabled + Front Panel Reset Status: Unknown + +Handle 0x0036, DMI type 32, 11 bytes +System Boot Information + Status: No errors detected + +Handle 0x0037, DMI type 131, 17 bytes +OEM-specific Type + Header and Data: + 83 11 37 00 01 02 03 FF FF 1F 00 00 00 00 00 03 + 00 + Strings: + BOOTINF 20h + BOOTDEV 21h + KEYPTRS 23h + +Handle 0x0038, DMI type 131, 22 bytes +OEM-specific Type + Header and Data: + 83 16 38 00 01 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 01 + Strings: + TVT-Enablement + +Handle 0x0039, DMI type 132, 7 bytes +OEM-specific Type + Header and Data: + 84 07 39 00 02 D8 36 + +Handle 0x003A, DMI type 133, 5 bytes +OEM-specific Type + Header and Data: + 85 05 3A 00 01 + Strings: + KHOIHGIUCCHHII + +Handle 0x003B, DMI type 134, 13 bytes +OEM-specific Type + Header and Data: + 86 0D 3B 00 26 08 10 20 00 00 00 00 00 + +Handle 0x003C, DMI type 134, 16 bytes +OEM-specific Type + Header and Data: + 86 10 3C 00 00 53 54 4D 20 01 01 00 00 02 01 02 + Strings: + TPM INFO + System Reserved + +Handle 0x003D, DMI type 135, 13 bytes +OEM-specific Type + Header and Data: + 87 0D 3D 00 54 50 07 00 01 00 00 00 00 + +Handle 0x003E, DMI type 135, 18 bytes +OEM-specific Type + Header and Data: + 87 12 3E 00 54 50 07 01 01 C1 00 00 00 00 00 00 + 00 00 + +Handle 0x003F, DMI type 135, 58 bytes +OEM-specific Type + Header and Data: + 87 3A 3F 00 54 50 07 02 42 41 59 20 49 2F 4F 20 + 02 00 04 FF 00 00 00 00 00 00 00 FF 00 00 00 00 + 00 00 00 FF 00 00 00 00 00 00 00 FF 00 00 00 00 + 00 00 00 06 00 02 FF FF 03 03 + +Handle 0x0040, DMI type 135, 30 bytes +OEM-specific Type + Header and Data: + 87 1E 40 00 54 50 07 04 01 05 01 01 02 00 02 01 + 02 00 03 01 02 00 05 01 02 00 06 01 02 00 + +Handle 0x0041, DMI type 135, 10 bytes +OEM-specific Type + Header and Data: + 87 0A 41 00 54 50 07 03 01 00 + +Handle 0x0042, DMI type 136, 6 bytes +OEM-specific Type + Header and Data: + 88 06 42 00 5A 5A + +Handle 0x0043, DMI type 140, 67 bytes +OEM-specific Type + Header and Data: + 8C 43 43 00 4C 45 4E 4F 56 4F 0B 00 01 7C 83 82 + 71 7A A6 93 A6 51 1F 42 08 36 CB 5D E3 01 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 + +Handle 0x0044, DMI type 140, 47 bytes +OEM-specific Type + Header and Data: + 8C 2F 44 00 4C 45 4E 4F 56 4F 0B 01 01 09 00 AE + DE 32 F2 4E 3C 06 CE 68 AA 33 46 86 B2 3A 43 00 + 00 00 00 10 00 10 00 10 01 D0 00 20 01 00 01 + +Handle 0x0045, DMI type 140, 63 bytes +OEM-specific Type + Header and Data: + 8C 3F 45 00 4C 45 4E 4F 56 4F 0B 02 01 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + +Handle 0x0046, DMI type 140, 17 bytes +OEM-specific Type + Header and Data: + 8C 11 46 00 4C 45 4E 4F 56 4F 0B 03 01 00 00 00 + 00 + +Handle 0x0047, DMI type 140, 19 bytes +OEM-specific Type + Header and Data: + 8C 13 47 00 4C 45 4E 4F 56 4F 0B 04 01 B2 00 53 + 4D 20 00 + +Handle 0x0048, DMI type 140, 19 bytes +OEM-specific Type + Header and Data: + 8C 13 48 00 4C 45 4E 4F 56 4F 0B 05 01 06 00 00 + 00 53 55 + +Handle 0x0049, DMI type 140, 23 bytes +OEM-specific Type + Header and Data: + 8C 17 49 00 4C 45 4E 4F 56 4F 0B 06 01 7E 14 00 + 00 00 00 00 00 00 00 + +Handle 0x004A, DMI type 129, 8 bytes +OEM-specific Type + Header and Data: + 81 08 4A 00 01 01 02 01 + Strings: + Intel_ASF + Intel_ASF_001 + +Handle 0x004B, DMI type 130, 20 bytes +OEM-specific Type + Header and Data: + 82 14 4B 00 24 41 4D 54 01 01 01 01 01 A5 8B 02 + 00 00 01 00 + +Handle 0x004C, DMI type 131, 64 bytes +OEM-specific Type + Header and Data: + 83 40 4C 00 35 00 00 00 00 00 00 00 00 00 00 00 + F8 00 07 3B 00 00 00 00 09 41 6C 06 00 00 06 00 + C0 04 29 00 01 00 01 02 C8 00 EA 10 00 00 00 00 + 00 00 00 00 3E 00 00 00 76 50 72 6F 00 00 00 00 + +Handle 0x004D, DMI type 127, 4 bytes +End Of Table + +EOF diff --git a/tests/baremetal/sbin/id b/tests/baremetal/sbin/id new file mode 100755 index 0000000..6c704ac --- /dev/null +++ b/tests/baremetal/sbin/id @@ -0,0 +1,2 @@ +#!/bin/sh - +echo 0 diff --git a/tests/baremetal/sbin/virt-what-cpuid-helper b/tests/baremetal/sbin/virt-what-cpuid-helper new file mode 100755 index 0000000..b446009 --- /dev/null +++ b/tests/baremetal/sbin/virt-what-cpuid-helper @@ -0,0 +1,2 @@ +#!/bin/sh - +echo diff --git a/tests/test-baremetal.sh b/tests/test-baremetal.sh new file mode 100755 index 0000000..1ca4bcf --- /dev/null +++ b/tests/test-baremetal.sh @@ -0,0 +1,34 @@ +# Test for baremetal +# Copyright (C) 2008-2011 Red Hat Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# 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. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +root=tests/baremetal + +output="$(./virt-what --test-root=$root 2>&1)" +expected="" + +if [ "$output" != "$expected" ]; then + echo "$0: test failed because output did not match expected" + echo "Expected output was:" + echo "----------------------------------------" + echo "$expected" + echo "----------------------------------------" + echo "But the actual output of the program was:" + echo "----------------------------------------" + echo "$output" + echo "----------------------------------------" + exit 1 +fi diff --git a/virt-what.in b/virt-what.in index 2324f12..e311067 100644 --- a/virt-what.in +++ b/virt-what.in @@ -43,19 +43,31 @@ function usage { # Handle the command line arguments, if any. -TEMP=`getopt -o v --long help --long version -n 'virt-what' -- "$@"` +TEMP=`getopt -o v --long help --long version --long test-root: -n 'virt-what' -- "$@"` if [ $? != 0 ]; then exit 1; fi eval set -- "$TEMP" while true; do case "$1" in --help) usage ;; + --test-root) + # Deliberately undocumented: used for 'make check'. + root="$2" + shift 2 + ;; -v|--version) echo $VERSION; exit 0 ;; --) shift; break ;; - *) fail "internal error" ;; + *) fail "internal error ($1)" ;; esac done +# Add /sbin and /usr/sbin to the path so we can find system +# binaries like dmicode. +# Add /usr/libexec to the path so we can find the helper binary. +prefix=@prefix@ +exec_prefix=@exec_prefix@ +PATH=$root@libexecdir@:$root/sbin:$root/usr/sbin:$PATH + # Check we're running as root. uid=`id -u` @@ -63,13 +75,6 @@ if [ "$uid" != 0 ]; then fail "this script must be run as root" fi -# Add /sbin and /usr/sbin to the path so we can find system -# binaries like dmicode. -# Add /usr/libexec to the path so we can find the helper binary. -prefix=@prefix@ -exec_prefix=@exec_prefix@ -PATH=@libexecdir@:/sbin:/usr/sbin:$PATH - # Many fullvirt hypervisors give an indication through CPUID. Use the # helper program to get this information. @@ -112,18 +117,18 @@ fi # container) # /proc/bc - exists on node, but not inside container. -if [ -d /proc/vz -a ! -d /proc/bc ]; then +if [ -d $root/proc/vz -a ! -d $root/proc/bc ]; then echo openvz fi # Check for UML. # Added by Laurent Léonard. -if grep -q 'UML' /proc/cpuinfo; then +if grep -q 'UML' $root/proc/cpuinfo; then echo uml fi # Check for IBM PowerVM Lx86 Linux/x86 emulator. -if grep -q '^vendor_id.*PowerVM Lx86' /proc/cpuinfo; then +if grep -q '^vendor_id.*PowerVM Lx86' $root/proc/cpuinfo; then echo powervm_lx86 fi @@ -138,15 +143,15 @@ fi if [ "$cpuid" = "XenVMMXenVMM" ]; then echo xen; echo xen-hvm is_xen=1 -elif [ -f /proc/xen/capabilities ]; then +elif [ -f $root/proc/xen/capabilities ]; then echo xen - if grep -q "control_d" /proc/xen/capabilities; then + if grep -q "control_d" $root/proc/xen/capabilities; then echo xen-dom0 else echo xen-domU fi is_xen=1 -elif [ -d /proc/xen ]; then +elif [ -d $root/proc/xen ]; then # This directory can be present when Xen paravirt drivers are # installed, even on baremetal. Don't confuse people by # printing anything. @@ -159,7 +164,7 @@ if [ ! "$is_xen" ]; then # Disable this test if we know this is Xen already, because Xen # uses QEMU for its device model. - if grep -q 'QEMU' /proc/cpuinfo; then + if grep -q 'QEMU' $root/proc/cpuinfo; then if [ "$cpuid" = "KVMKVMKVM" ]; then echo kvm else