virt-what/SOURCES/0012-aws-Add-regression-test-for-AWS-on-Xen-on-x86_64-arc.patch
2021-10-08 17:33:41 +00:00

359 lines
10 KiB
Diff

From 350291e1ca417eab9d2aa2408589f0259cac007c Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Wed, 31 Oct 2018 15:23:45 +0000
Subject: [PATCH 12/12] aws: Add regression test for AWS on Xen on x86_64
architecture.
---
Makefile.am | 6 +
tests/aws-xen-x86/proc/cpuinfo | 52 +++++++
tests/aws-xen-x86/proc/self/status | 46 ++++++
tests/aws-xen-x86/sbin/dmidecode | 135 ++++++++++++++++++
tests/aws-xen-x86/sbin/uname | 2 +
tests/aws-xen-x86/sbin/virt-what-cpuid-helper | 2 +
tests/test-aws-xen-x86.sh | 36 +++++
7 files changed, 279 insertions(+)
create mode 100644 tests/aws-xen-x86/proc/cpuinfo
create mode 100644 tests/aws-xen-x86/proc/self/status
create mode 100755 tests/aws-xen-x86/sbin/dmidecode
create mode 100755 tests/aws-xen-x86/sbin/uname
create mode 100755 tests/aws-xen-x86/sbin/virt-what-cpuid-helper
create mode 100755 tests/test-aws-xen-x86.sh
diff --git a/Makefile.am b/Makefile.am
index ad47097..22680a0 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -41,6 +41,7 @@ endif
TESTS = \
tests/test-aws-baremetal-x86.sh \
tests/test-aws-kvm-x86.sh \
+ tests/test-aws-xen-x86.sh \
tests/test-baremetal.sh \
tests/test-bhyve.sh \
tests/test-docker.sh \
@@ -85,6 +86,11 @@ EXTRA_DIST = \
tests/aws-kvm-x86/sbin/dmidecode \
tests/aws-kvm-x86/sbin/uname \
tests/aws-kvm-x86/sbin/virt-what-cpuid-helper \
+ tests/aws-xen-x86/proc/cpuinfo \
+ tests/aws-xen-x86/proc/self/status \
+ tests/aws-xen-x86/sbin/dmidecode \
+ tests/aws-xen-x86/sbin/uname \
+ tests/aws-xen-x86/sbin/virt-what-cpuid-helper \
tests/baremetal/proc/cpuinfo \
tests/baremetal/proc/self/status \
tests/baremetal/sbin/dmidecode \
diff --git a/tests/aws-xen-x86/proc/cpuinfo b/tests/aws-xen-x86/proc/cpuinfo
new file mode 100644
index 0000000..ff0b16b
--- /dev/null
+++ b/tests/aws-xen-x86/proc/cpuinfo
@@ -0,0 +1,52 @@
+processor : 0
+vendor_id : GenuineIntel
+cpu family : 6
+model : 63
+model name : Intel(R) Xeon(R) CPU E5-2666 v3 @ 2.90GHz
+stepping : 2
+microcode : 0x3c
+cpu MHz : 2900.281
+cache size : 25600 KB
+physical id : 0
+siblings : 2
+core id : 0
+cpu cores : 1
+apicid : 0
+initial apicid : 0
+fpu : yes
+fpu_exception : yes
+cpuid level : 13
+wp : yes
+flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology eagerfpu pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm fsgsbase bmi1 avx2 smep bmi2 erms invpcid xsaveopt
+bogomips : 5800.06
+clflush size : 64
+cache_alignment : 64
+address sizes : 46 bits physical, 48 bits virtual
+power management:
+
+processor : 1
+vendor_id : GenuineIntel
+cpu family : 6
+model : 63
+model name : Intel(R) Xeon(R) CPU E5-2666 v3 @ 2.90GHz
+stepping : 2
+microcode : 0x3c
+cpu MHz : 2900.281
+cache size : 25600 KB
+physical id : 0
+siblings : 2
+core id : 0
+cpu cores : 1
+apicid : 1
+initial apicid : 1
+fpu : yes
+fpu_exception : yes
+cpuid level : 13
+wp : yes
+flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology eagerfpu pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm fsgsbase bmi1 avx2 smep bmi2 erms invpcid xsaveopt
+bogomips : 5800.06
+clflush size : 64
+cache_alignment : 64
+address sizes : 46 bits physical, 48 bits virtual
+power management:
+
diff --git a/tests/aws-xen-x86/proc/self/status b/tests/aws-xen-x86/proc/self/status
new file mode 100644
index 0000000..4e93816
--- /dev/null
+++ b/tests/aws-xen-x86/proc/self/status
@@ -0,0 +1,46 @@
+Name: cat
+Umask: 0022
+State: R (running)
+Tgid: 22828
+Ngid: 0
+Pid: 22828
+PPid: 17431
+TracerPid: 0
+Uid: 0 0 0 0
+Gid: 0 0 0 0
+FDSize: 256
+Groups: 0
+VmPeak: 107972 kB
+VmSize: 107972 kB
+VmLck: 0 kB
+VmPin: 0 kB
+VmHWM: 360 kB
+VmRSS: 360 kB
+RssAnon: 76 kB
+RssFile: 284 kB
+RssShmem: 0 kB
+VmData: 180 kB
+VmStk: 132 kB
+VmExe: 44 kB
+VmLib: 1936 kB
+VmPTE: 36 kB
+VmSwap: 0 kB
+Threads: 1
+SigQ: 0/14231
+SigPnd: 0000000000000000
+ShdPnd: 0000000000000000
+SigBlk: 0000000000000000
+SigIgn: 0000000000000000
+SigCgt: 0000000000000000
+CapInh: 0000000000000000
+CapPrm: 0000001fffffffff
+CapEff: 0000001fffffffff
+CapBnd: 0000001fffffffff
+CapAmb: 0000000000000000
+Seccomp: 0
+Cpus_allowed: 7fff
+Cpus_allowed_list: 0-14
+Mems_allowed: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000001
+Mems_allowed_list: 0
+voluntary_ctxt_switches: 1
+nonvoluntary_ctxt_switches: 1
diff --git a/tests/aws-xen-x86/sbin/dmidecode b/tests/aws-xen-x86/sbin/dmidecode
new file mode 100755
index 0000000..bc9cde5
--- /dev/null
+++ b/tests/aws-xen-x86/sbin/dmidecode
@@ -0,0 +1,135 @@
+#!/bin/sh -
+cat <<'EOF'
+# dmidecode 3.0
+Getting SMBIOS data from sysfs.
+SMBIOS 2.7 present.
+12 structures occupying 398 bytes.
+Table at 0x000EB01F.
+
+Handle 0x0000, DMI type 0, 24 bytes
+BIOS Information
+ Vendor: Xen
+ Version: 4.2.amazon
+ Release Date: 08/24/2006
+ Address: 0xE8000
+ Runtime Size: 96 kB
+ ROM Size: 64 kB
+ Characteristics:
+ PCI is supported
+ EDD is supported
+ Targeted content distribution is supported
+ BIOS Revision: 4.2
+
+Handle 0x0100, DMI type 1, 27 bytes
+System Information
+ Manufacturer: Xen
+ Product Name: HVM domU
+ Version: 4.2.amazon
+ Serial Number: ec2f5c70-6dfc-83a7-f5ec-ef7b97aea4c9
+ UUID: EC2F5C70-6DFC-83A7-F5EC-EF7B97AEA4C9
+ Wake-up Type: Power Switch
+ SKU Number: Not Specified
+ Family: Not Specified
+
+Handle 0x0300, DMI type 3, 13 bytes
+Chassis Information
+ Manufacturer: Xen
+ Type: Other
+ Lock: Not Present
+ Version: Not Specified
+ Serial Number: Not Specified
+ Asset Tag: Not Specified
+ Boot-up State: Safe
+ Power Supply State: Safe
+ Thermal State: Safe
+ Security Status: Unknown
+
+Handle 0x0401, DMI type 4, 26 bytes
+Processor Information
+ Socket Designation: CPU 1
+ Type: Central Processor
+ Family: Other
+ Manufacturer: Intel
+ ID: F2 06 03 00 FF FB 89 17
+ Version: Not Specified
+ Voltage: Unknown
+ External Clock: Unknown
+ Max Speed: 2900 MHz
+ Current Speed: 2900 MHz
+ Status: Populated, Enabled
+ Upgrade: Other
+
+Handle 0x0402, DMI type 4, 26 bytes
+Processor Information
+ Socket Designation: CPU 2
+ Type: Central Processor
+ Family: Other
+ Manufacturer: Intel
+ ID: F2 06 03 00 FF FB 89 17
+ Version: Not Specified
+ Voltage: Unknown
+ External Clock: Unknown
+ Max Speed: 2900 MHz
+ Current Speed: 2900 MHz
+ Status: Populated, Enabled
+ Upgrade: Other
+
+Handle 0x0B00, DMI type 11, 5 bytes
+OEM Strings
+ String 1: Xen
+
+Handle 0x1000, DMI type 16, 19 bytes
+Physical Memory Array
+ Location: Other
+ Use: System Memory
+ Error Correction Type: Multi-bit ECC
+ Maximum Capacity: 3840 MB
+ Error Information Handle: Not Provided
+ Number Of Devices: 1
+
+Handle 0x1100, DMI type 17, 34 bytes
+Memory Device
+ Array Handle: 0x1000
+ Error Information Handle: 0x0000
+ Total Width: 64 bits
+ Data Width: 64 bits
+ Size: 3840 MB
+ Form Factor: DIMM
+ Set: None
+ Locator: DIMM 0
+ Bank Locator: Not Specified
+ Type: RAM
+ Type Detail: None
+ Speed: Unknown
+ Manufacturer: Not Specified
+ Serial Number: Not Specified
+ Asset Tag: Not Specified
+ Part Number: Not Specified
+ Rank: Unknown
+ Configured Clock Speed: Unknown
+
+Handle 0x1300, DMI type 19, 31 bytes
+Memory Array Mapped Address
+ Starting Address: 0x00000000000
+ Ending Address: 0x000EFFFFFFF
+ Range Size: 3840 MB
+ Physical Array Handle: 0x1000
+ Partition Width: 1
+
+Handle 0x1400, DMI type 20, 35 bytes
+Memory Device Mapped Address
+ Starting Address: 0x00000000000
+ Ending Address: 0x000EFFFFFFF
+ Range Size: 3840 MB
+ Physical Device Handle: 0x1100
+ Memory Array Mapped Address Handle: 0x1300
+ Partition Row Position: 1
+
+Handle 0x2000, DMI type 32, 11 bytes
+System Boot Information
+ Status: No errors detected
+
+Handle 0x7F00, DMI type 127, 4 bytes
+End Of Table
+
+EOF
diff --git a/tests/aws-xen-x86/sbin/uname b/tests/aws-xen-x86/sbin/uname
new file mode 100755
index 0000000..ab0ec89
--- /dev/null
+++ b/tests/aws-xen-x86/sbin/uname
@@ -0,0 +1,2 @@
+#!/bin/sh -
+echo x86_64
diff --git a/tests/aws-xen-x86/sbin/virt-what-cpuid-helper b/tests/aws-xen-x86/sbin/virt-what-cpuid-helper
new file mode 100755
index 0000000..8d8df4a
--- /dev/null
+++ b/tests/aws-xen-x86/sbin/virt-what-cpuid-helper
@@ -0,0 +1,2 @@
+#!/bin/sh -
+echo XenVMMXenVMM
diff --git a/tests/test-aws-xen-x86.sh b/tests/test-aws-xen-x86.sh
new file mode 100755
index 0000000..22b7f83
--- /dev/null
+++ b/tests/test-aws-xen-x86.sh
@@ -0,0 +1,36 @@
+# Test for AWS.
+# Copyright (C) 2018 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/aws-xen-x86
+
+output="$(./virt-what --test-root=$root 2>&1)"
+expected="xen
+xen-hvm
+aws"
+
+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
--
2.19.0.rc0