Blob Blame History Raw
From f25e07d43db40355b321493f78758ea058fa3849 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 13/21] aws: Add regression test for AWS on KVM on ARM
 architecture.

---
 Makefile.am                                   |  1 +
 tests/aws-kvm-arm/proc/cpuinfo                |  9 +++
 tests/aws-kvm-arm/proc/self/status            | 54 +++++++++++++++
 tests/aws-kvm-arm/sbin/dmidecode              | 68 +++++++++++++++++++
 tests/aws-kvm-arm/sbin/uname                  |  2 +
 tests/aws-kvm-arm/sbin/virt-what-cpuid-helper |  2 +
 tests/test-aws-kvm-arm.sh                     | 36 ++++++++++
 7 files changed, 172 insertions(+)
 create mode 100644 tests/aws-kvm-arm/proc/cpuinfo
 create mode 100644 tests/aws-kvm-arm/proc/self/status
 create mode 100755 tests/aws-kvm-arm/sbin/dmidecode
 create mode 100755 tests/aws-kvm-arm/sbin/uname
 create mode 100755 tests/aws-kvm-arm/sbin/virt-what-cpuid-helper
 create mode 100755 tests/test-aws-kvm-arm.sh

diff --git a/Makefile.am b/Makefile.am
index 22680a0..67502fc 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -40,6 +40,7 @@ endif
 
 TESTS = \
 	tests/test-aws-baremetal-x86.sh \
+	tests/test-aws-kvm-arm.sh \
 	tests/test-aws-kvm-x86.sh \
 	tests/test-aws-xen-x86.sh \
 	tests/test-baremetal.sh \
diff --git a/tests/aws-kvm-arm/proc/cpuinfo b/tests/aws-kvm-arm/proc/cpuinfo
new file mode 100644
index 0000000..bc5a5bb
--- /dev/null
+++ b/tests/aws-kvm-arm/proc/cpuinfo
@@ -0,0 +1,9 @@
+processor	: 0
+BogoMIPS	: 166.66
+Features	: fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid
+CPU implementer	: 0x41
+CPU architecture: 8
+CPU variant	: 0x0
+CPU part	: 0xd08
+CPU revision	: 3
+
diff --git a/tests/aws-kvm-arm/proc/self/status b/tests/aws-kvm-arm/proc/self/status
new file mode 100644
index 0000000..121a8cc
--- /dev/null
+++ b/tests/aws-kvm-arm/proc/self/status
@@ -0,0 +1,54 @@
+Name:	cat
+Umask:	0022
+State:	R (running)
+Tgid:	17874
+Ngid:	0
+Pid:	17874
+PPid:	9992
+TracerPid:	0
+Uid:	0	0	0	0
+Gid:	0	0	0	0
+FDSize:	256
+Groups:	0 
+NStgid:	17874
+NSpid:	17874
+NSpgid:	17874
+NSsid:	9992
+VmPeak:	  109760 kB
+VmSize:	  109760 kB
+VmLck:	       0 kB
+VmPin:	       0 kB
+VmHWM:	     832 kB
+VmRSS:	     832 kB
+RssAnon:	     448 kB
+RssFile:	     384 kB
+RssShmem:	       0 kB
+VmData:	     384 kB
+VmStk:	     192 kB
+VmExe:	      64 kB
+VmLib:	    1664 kB
+VmPTE:	     192 kB
+VmPMD:	     128 kB
+VmSwap:	       0 kB
+HugetlbPages:	       0 kB
+Threads:	1
+SigQ:	0/1470
+SigPnd:	0000000000000000
+ShdPnd:	0000000000000000
+SigBlk:	0000000000000000
+SigIgn:	0000000000000000
+SigCgt:	0000000000000000
+CapInh:	0000000000000000
+CapPrm:	0000003fffffffff
+CapEff:	0000003fffffffff
+CapBnd:	0000003fffffffff
+CapAmb:	0000000000000000
+NoNewPrivs:	0
+Seccomp:	0
+Speculation Store Bypass:	unknown
+Cpus_allowed:	1
+Cpus_allowed_list:	0
+Mems_allowed:	1
+Mems_allowed_list:	0
+voluntary_ctxt_switches:	0
+nonvoluntary_ctxt_switches:	0
diff --git a/tests/aws-kvm-arm/sbin/dmidecode b/tests/aws-kvm-arm/sbin/dmidecode
new file mode 100755
index 0000000..d126758
--- /dev/null
+++ b/tests/aws-kvm-arm/sbin/dmidecode
@@ -0,0 +1,68 @@
+#!/bin/sh -
+cat <<'EOF'
+# dmidecode 3.1
+Getting SMBIOS data from sysfs.
+SMBIOS 2.7 present.
+5 structures occupying 233 bytes.
+Table at 0x7F780000.
+
+Handle 0x0000, DMI type 0, 24 bytes
+BIOS Information
+	Vendor: Amazon EC2
+	Version: 1.0
+	Release Date: 12/1/2018
+	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: a1.medium
+	Version: Not Specified
+	Serial Number: ec2ce86a-12c2-9388-d9b0-8dc833cba752
+	UUID: ec2ce86a-12c2-9388-d9b0-8dc833cba752
+	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-01c1b85d3dcc02ed7
+	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 0xFEFF, DMI type 127, 4 bytes
+End Of Table
+
+EOF
diff --git a/tests/aws-kvm-arm/sbin/uname b/tests/aws-kvm-arm/sbin/uname
new file mode 100755
index 0000000..bd33a2d
--- /dev/null
+++ b/tests/aws-kvm-arm/sbin/uname
@@ -0,0 +1,2 @@
+#!/bin/sh -
+echo aarch64
diff --git a/tests/aws-kvm-arm/sbin/virt-what-cpuid-helper b/tests/aws-kvm-arm/sbin/virt-what-cpuid-helper
new file mode 100755
index 0000000..4475399
--- /dev/null
+++ b/tests/aws-kvm-arm/sbin/virt-what-cpuid-helper
@@ -0,0 +1,2 @@
+#!/bin/sh -
+# prints nothing but exits successfully
diff --git a/tests/test-aws-kvm-arm.sh b/tests/test-aws-kvm-arm.sh
new file mode 100755
index 0000000..8875421
--- /dev/null
+++ b/tests/test-aws-kvm-arm.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-kvm-arm
+
+output="$(./virt-what --test-root=$root 2>&1)"
+# XXX At the moment KVM cannot be detected on this platform.
+# We hope to fix that, but for now the only fact printed is "aws".
+expected="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.23.0