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

291 lines
8.9 KiB
Diff

From 129a25f9854930928351c8cc3913a5b9a1c558b4 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 10/12] aws: Add regression test for AWS on KVM on x86_64
architecture.
---
Makefile.am | 6 ++
tests/aws-kvm-x86/proc/cpuinfo | 52 ++++++++++++++
tests/aws-kvm-x86/proc/self/status | 46 +++++++++++++
tests/aws-kvm-x86/sbin/dmidecode | 68 +++++++++++++++++++
tests/aws-kvm-x86/sbin/uname | 2 +
tests/aws-kvm-x86/sbin/virt-what-cpuid-helper | 2 +
tests/test-aws-kvm-x86.sh | 35 ++++++++++
7 files changed, 211 insertions(+)
create mode 100644 tests/aws-kvm-x86/proc/cpuinfo
create mode 100644 tests/aws-kvm-x86/proc/self/status
create mode 100755 tests/aws-kvm-x86/sbin/dmidecode
create mode 100755 tests/aws-kvm-x86/sbin/uname
create mode 100755 tests/aws-kvm-x86/sbin/virt-what-cpuid-helper
create mode 100755 tests/test-aws-kvm-x86.sh
diff --git a/Makefile.am b/Makefile.am
index 3c0d5ba..1029902 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -39,6 +39,7 @@ virt-what.txt: virt-what.pod
endif
TESTS = \
+ tests/test-aws-kvm-x86.sh \
tests/test-baremetal.sh \
tests/test-bhyve.sh \
tests/test-docker.sh \
@@ -73,6 +74,11 @@ TESTS = \
EXTRA_DIST = \
virt-what.in \
virt-what.pod \
+ tests/aws-kvm-x86/proc/cpuinfo \
+ tests/aws-kvm-x86/proc/self/status \
+ tests/aws-kvm-x86/sbin/dmidecode \
+ tests/aws-kvm-x86/sbin/uname \
+ tests/aws-kvm-x86/sbin/virt-what-cpuid-helper \
tests/baremetal/proc/cpuinfo \
tests/baremetal/proc/self/status \
tests/baremetal/sbin/dmidecode \
diff --git a/tests/aws-kvm-x86/proc/cpuinfo b/tests/aws-kvm-x86/proc/cpuinfo
new file mode 100644
index 0000000..449f885
--- /dev/null
+++ b/tests/aws-kvm-x86/proc/cpuinfo
@@ -0,0 +1,52 @@
+processor : 0
+vendor_id : GenuineIntel
+cpu family : 6
+model : 85
+model name : Intel(R) Xeon(R) Platinum 8124M CPU @ 3.00GHz
+stepping : 3
+microcode : 0x1000141
+cpu MHz : 2999.996
+cache size : 25344 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 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc aperfmperf 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 3dnowprefetch fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx avx512f avx512dq rdseed adx smap clflushopt clwb avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 ida arat pku ospke
+bogomips : 5999.99
+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 : 85
+model name : Intel(R) Xeon(R) Platinum 8124M CPU @ 3.00GHz
+stepping : 3
+microcode : 0x1000141
+cpu MHz : 2999.996
+cache size : 25344 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 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc aperfmperf 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 3dnowprefetch fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx avx512f avx512dq rdseed adx smap clflushopt clwb avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 ida arat pku ospke
+bogomips : 5999.99
+clflush size : 64
+cache_alignment : 64
+address sizes : 46 bits physical, 48 bits virtual
+power management:
+
diff --git a/tests/aws-kvm-x86/proc/self/status b/tests/aws-kvm-x86/proc/self/status
new file mode 100644
index 0000000..5baf8de
--- /dev/null
+++ b/tests/aws-kvm-x86/proc/self/status
@@ -0,0 +1,46 @@
+Name: cat
+Umask: 0022
+State: R (running)
+Tgid: 20776
+Ngid: 0
+Pid: 20776
+PPid: 17444
+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: 1/14026
+SigPnd: 0000000000000000
+ShdPnd: 0000000000000000
+SigBlk: 0000000000000000
+SigIgn: 0000000000000000
+SigCgt: 0000000000000000
+CapInh: 0000000000000000
+CapPrm: 0000001fffffffff
+CapEff: 0000001fffffffff
+CapBnd: 0000001fffffffff
+CapAmb: 0000000000000000
+Seccomp: 0
+Cpus_allowed: 3
+Cpus_allowed_list: 0-1
+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-kvm-x86/sbin/dmidecode b/tests/aws-kvm-x86/sbin/dmidecode
new file mode 100755
index 0000000..3b5aa03
--- /dev/null
+++ b/tests/aws-kvm-x86/sbin/dmidecode
@@ -0,0 +1,68 @@
+#!/bin/sh -
+cat <<'EOF'
+# dmidecode 3.0
+Getting SMBIOS data from sysfs.
+SMBIOS 2.7 present.
+5 structures occupying 233 bytes.
+Table at 0x000F8FD0.
+
+Handle 0x0000, DMI type 0, 24 bytes
+BIOS Information
+ Vendor: Amazon EC2
+ Version: 1.0
+ Release Date: 10/16/2017
+ Address: 0xF0000
+ Runtime Size: 64 kB
+ ROM Size: 64 kB
+ Characteristics:
+ PCI is supported
+ EDD is supported
+ ACPI is supported
+ System is a virtual machine
+ BIOS Revision: 1.0
+
+Handle 0x0001, DMI type 1, 27 bytes
+System Information
+ Manufacturer: Amazon EC2
+ Product Name: c5.large
+ Version: Not Specified
+ Serial Number: ec2cecdd-c1c8-7a71-0ea8-aef580c9f845
+ UUID: EC2CECDD-C1C8-7A71-0EA8-AEF580C9F845
+ Wake-up Type: Power Switch
+ SKU Number: Not Specified
+ Family: Not Specified
+
+Handle 0x0002, DMI type 2, 15 bytes
+Base Board Information
+ Manufacturer: Amazon EC2
+ Product Name: Not Specified
+ Version: Not Specified
+ Serial Number: Not Specified
+ Asset Tag: i-04f9b1c56b3c301b5
+ Features: None
+ Location In Chassis: Not Specified
+ Chassis Handle: 0x0003
+ Type: Other
+ Contained Object Handles: 0
+
+Handle 0x0003, DMI type 3, 21 bytes
+Chassis Information
+ Manufacturer: Amazon EC2
+ Type: Other
+ Lock: Not Present
+ Version: Not Specified
+ Serial Number: Not Specified
+ Asset Tag: Amazon EC2
+ Boot-up State: Safe
+ Power Supply State: Safe
+ Thermal State: Safe
+ Security Status: None
+ OEM Information: 0x00000000
+ Height: Unspecified
+ Number Of Power Cords: 1
+ Contained Elements: 0
+
+Handle 0x0004, DMI type 127, 4 bytes
+End Of Table
+
+EOF
diff --git a/tests/aws-kvm-x86/sbin/uname b/tests/aws-kvm-x86/sbin/uname
new file mode 100755
index 0000000..ab0ec89
--- /dev/null
+++ b/tests/aws-kvm-x86/sbin/uname
@@ -0,0 +1,2 @@
+#!/bin/sh -
+echo x86_64
diff --git a/tests/aws-kvm-x86/sbin/virt-what-cpuid-helper b/tests/aws-kvm-x86/sbin/virt-what-cpuid-helper
new file mode 100755
index 0000000..f52a9d7
--- /dev/null
+++ b/tests/aws-kvm-x86/sbin/virt-what-cpuid-helper
@@ -0,0 +1,2 @@
+#!/bin/sh -
+echo KVMKVMKVM
diff --git a/tests/test-aws-kvm-x86.sh b/tests/test-aws-kvm-x86.sh
new file mode 100755
index 0000000..db4c19f
--- /dev/null
+++ b/tests/test-aws-kvm-x86.sh
@@ -0,0 +1,35 @@
+# 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-kvm-x86
+
+output="$(./virt-what --test-root=$root 2>&1)"
+expected="kvm
+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