tests: Add test for Google Cloud Engine
authorRichard W.M. Jones <rjones@redhat.com>
Wed, 3 Aug 2022 17:53:19 +0000 (17:53 +0000)
committerRichard W.M. Jones <rjones@redhat.com>
Wed, 3 Aug 2022 17:55:22 +0000 (17:55 +0000)
This was actually a GCE aarch64 instance, but I believe the
architecture makes no difference as all we're looking for is the
characteristic string in dmidecode output.

Thanks: Craig Donnelly
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2114997
Updates: commit 8363fa9f0e2cbd970f34ffb7c7b23ed0ac2c374a

configure.ac
tests/google-cloud/Makefile.am [new file with mode: 0644]
tests/google-cloud/proc/cpuinfo [new file with mode: 0644]
tests/google-cloud/proc/self/status [new file with mode: 0644]
tests/google-cloud/sbin/dmidecode [new file with mode: 0755]
tests/google-cloud/sbin/uname [new file with mode: 0755]
tests/google-cloud/sbin/virt-what-cpuid-helper [new file with mode: 0755]
tests/google-cloud/test.sh [new file with mode: 0755]
virt-what.pod

index 9a69c02..222f7bb 100644 (file)
@@ -44,6 +44,7 @@ tests="\
        docker \
        esx-arm \
        esx4.1 \
+       google-cloud \
        hyperv \
        illumos-lx \
        kvm \
@@ -91,6 +92,7 @@ AC_CONFIG_FILES([Makefile
                 tests/docker/Makefile
                 tests/esx-arm/Makefile
                 tests/esx4.1/Makefile
+                tests/google-cloud/Makefile
                 tests/hyperv/Makefile
                 tests/illumos-lx/Makefile
                 tests/kvm/Makefile
diff --git a/tests/google-cloud/Makefile.am b/tests/google-cloud/Makefile.am
new file mode 100644 (file)
index 0000000..eabaa01
--- /dev/null
@@ -0,0 +1,28 @@
+# Makefile for virt-what
+# Copyright (C) 2008-2022 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.
+
+CLEANFILES = *~
+
+TESTS = test.sh
+
+EXTRA_DIST = \
+       test.sh \
+       proc/cpuinfo \
+       proc/self/status \
+       sbin/dmidecode \
+       sbin/uname \
+       sbin/virt-what-cpuid-helper
diff --git a/tests/google-cloud/proc/cpuinfo b/tests/google-cloud/proc/cpuinfo
new file mode 100644 (file)
index 0000000..801a7b5
--- /dev/null
@@ -0,0 +1,9 @@
+processor      : 0
+BogoMIPS       : 50.00
+Features       : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp ssbs
+CPU implementer        : 0x41
+CPU architecture: 8
+CPU variant    : 0x3
+CPU part       : 0xd0c
+CPU revision   : 1
+
diff --git a/tests/google-cloud/proc/self/status b/tests/google-cloud/proc/self/status
new file mode 100644 (file)
index 0000000..686ccb9
--- /dev/null
@@ -0,0 +1,57 @@
+Name:  cat
+Umask: 0022
+State: R (running)
+Tgid:  22886
+Ngid:  0
+Pid:   22886
+PPid:  9416
+TracerPid:     0
+Uid:   1002    1002    1002    1002
+Gid:   1003    1003    1003    1003
+FDSize:        256
+Groups:        1003 
+NStgid:        22886
+NSpid: 22886
+NSpgid:        22886
+NSsid: 9416
+VmPeak:            5288 kB
+VmSize:            5288 kB
+VmLck:        0 kB
+VmPin:        0 kB
+VmHWM:      816 kB
+VmRSS:      816 kB
+RssAnon:             80 kB
+RssFile:            736 kB
+RssShmem:             0 kB
+VmData:             348 kB
+VmStk:      132 kB
+VmExe:       24 kB
+VmLib:     1728 kB
+VmPTE:       56 kB
+VmSwap:               0 kB
+HugetlbPages:         0 kB
+CoreDumping:   0
+THP_enabled:   1
+Threads:       1
+SigQ:  0/13683
+SigPnd:        0000000000000000
+ShdPnd:        0000000000000000
+SigBlk:        0000000000000000
+SigIgn:        0000000000000000
+SigCgt:        0000000000000000
+CapInh:        0000000000000000
+CapPrm:        0000000000000000
+CapEff:        0000000000000000
+CapBnd:        000001ffffffffff
+CapAmb:        0000000000000000
+NoNewPrivs:    0
+Seccomp:       0
+Seccomp_filters:       0
+Speculation_Store_Bypass:      thread vulnerable
+SpeculationIndirectBranch:     unknown
+Cpus_allowed:  1
+Cpus_allowed_list:     0
+Mems_allowed:  00000000,00000001
+Mems_allowed_list:     0
+voluntary_ctxt_switches:       0
+nonvoluntary_ctxt_switches:    0
diff --git a/tests/google-cloud/sbin/dmidecode b/tests/google-cloud/sbin/dmidecode
new file mode 100755 (executable)
index 0000000..3fd6432
--- /dev/null
@@ -0,0 +1,186 @@
+#!/bin/sh -
+cat <<'EOF'
+# dmidecode 3.3
+Getting SMBIOS data from sysfs.
+SMBIOS 2.4 present.
+16 structures occupying 588 bytes.
+Table at 0xFFFE0000.
+
+Handle 0x0000, DMI type 0, 24 bytes
+BIOS Information
+       Vendor: Google
+       Version: Google
+       Release Date: 06/20/2022
+       Address: 0xE8000
+       Runtime Size: 96 kB
+       ROM Size: 64 kB
+       Characteristics:
+               BIOS characteristics not supported
+               Targeted content distribution is supported
+       BIOS Revision: 1.0
+
+Handle 0x0097, DMI type 1, 27 bytes
+System Information
+       Manufacturer: Google
+       Product Name: Google Compute Engine
+       Version: Not Specified
+       Serial Number: GoogleCloud-957EDC416C53B28F6DA35168B6F8648D
+       UUID: 957edc41-6c53-b28f-6da3-5168b6f8648d
+       Wake-up Type: Power Switch
+       SKU Number: Not Specified
+       Family: Not Specified
+
+Handle 0x0098, DMI type 2, 15 bytes
+Base Board Information
+       Manufacturer: KVM
+       Product Name: Google Compute Engine
+       Version: Not Specified
+       Serial Number: Board-GoogleCloud-957EDC416C53B28F6DA35168B6F8648D
+       Asset Tag: 957EDC41-6C53-B28F-6DA3-5168B6F8648D
+       Features:
+               Board is a hosting board
+       Location In Chassis: Not Specified
+       Chassis Handle: 0x0099
+       Type: Motherboard
+       Contained Object Handles: 0
+
+Handle 0x0099, DMI type 3, 20 bytes
+Chassis Information
+       Manufacturer: Google
+       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
+       OEM Information: 0x00000000
+       Height: Unspecified
+       Number Of Power Cords: Unspecified
+
+Handle 0x3001, DMI type 7, 17 bytes
+Cache Information
+       Socket Designation: L1 Cache
+       Configuration: Disabled, Not Socketed, Level 1
+       Operational Mode: Write Through
+       Location: Internal
+       Installed Size: 0 kB
+       Maximum Size: 1 kB
+       Supported SRAM Types: None
+       Installed SRAM Type: None
+
+Handle 0x3002, DMI type 7, 17 bytes
+Cache Information
+       Socket Designation: L2 Cache
+       Configuration: Disabled, Not Socketed, Level 1
+       Operational Mode: Write Back
+       Location: Internal
+       Installed Size: 0 kB
+       Maximum Size: 0 kB
+       Supported SRAM Types: None
+       Installed SRAM Type: None
+
+Handle 0x3003, DMI type 7, 17 bytes
+Cache Information
+       Socket Designation: L3 Cache
+       Configuration: Disabled, Not Socketed, Level 1
+       Operational Mode: Varies With Memory Address
+       Location: Internal
+       Installed Size: 256 kB
+       Maximum Size: 256 kB
+       Supported SRAM Types: None
+       Installed SRAM Type: None
+
+Handle 0x1000, DMI type 4, 42 bytes
+Processor Information
+       Socket Designation: CPU 1
+       Type: Central Processor
+       Family: ARMv8
+       Manufacturer: Google
+       ID: 00 00 00 00 00 00 00 00
+       Version: Not Specified
+       Voltage: Unknown
+       External Clock: Unknown
+       Max Speed: 3000 MHz
+       Current Speed: 3000 MHz
+       Status: Populated, Enabled
+       Upgrade: Other
+       L1 Cache Handle: 0x3001
+       L2 Cache Handle: 0x3002
+       L3 Cache Handle: 0x3003
+       Serial Number: Not Specified
+       Asset Tag: Not Specified
+       Part Number: Not Specified
+       Core Count: 1
+       Core Enabled: 1
+       Thread Count: 1
+       Characteristics:
+               64-bit capable
+
+Handle 0x0200, DMI type 16, 15 bytes
+Physical Memory Array
+       Location: Other
+       Use: System Memory
+       Error Correction Type: Multi-bit ECC
+       Maximum Capacity: 4 GB
+       Error Information Handle: Not Provided
+       Number Of Devices: 1
+
+Handle 0x7000, DMI type 17, 21 bytes
+Memory Device
+       Array Handle: 0x0200
+       Error Information Handle: Not Provided
+       Total Width: 64 bits
+       Data Width: 64 bits
+       Size: 4 GB
+       Form Factor: DIMM
+       Set: None
+       Locator: DIMM 0
+       Bank Locator: Not Specified
+       Type: RAM
+       Type Detail: Synchronous
+
+Handle 0x0300, DMI type 19, 15 bytes
+Memory Array Mapped Address
+       Starting Address: 0x00000000000
+       Ending Address: 0x000BFFFFFFF
+       Range Size: 3 GB
+       Physical Array Handle: 0x0200
+       Partition Width: 1
+
+Handle 0x0301, DMI type 19, 15 bytes
+Memory Array Mapped Address
+       Starting Address: 0x00100000000
+       Ending Address: 0x0013FFFFFFF
+       Range Size: 1 GB
+       Physical Array Handle: 0x0200
+       Partition Width: 1
+
+Handle 0x4000, DMI type 20, 19 bytes
+Memory Device Mapped Address
+       Starting Address: 0x00000000000
+       Ending Address: 0x000BFFFFFFF
+       Range Size: 3 GB
+       Physical Device Handle: 0x7000
+       Memory Array Mapped Address Handle: 0x0300
+       Partition Row Position: 1
+
+Handle 0x4001, DMI type 20, 19 bytes
+Memory Device Mapped Address
+       Starting Address: 0x00100000000
+       Ending Address: 0x0013FFFFFFF
+       Range Size: 1 GB
+       Physical Device Handle: 0x7000
+       Memory Array Mapped Address Handle: 0x0301
+       Partition Row Position: 1
+
+Handle 0x0100, DMI type 32, 11 bytes
+System Boot Information
+       Status: No errors detected
+
+Handle 0xFEFF, DMI type 127, 4 bytes
+End Of Table
+
+EOF
diff --git a/tests/google-cloud/sbin/uname b/tests/google-cloud/sbin/uname
new file mode 100755 (executable)
index 0000000..bd33a2d
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh -
+echo aarch64
diff --git a/tests/google-cloud/sbin/virt-what-cpuid-helper b/tests/google-cloud/sbin/virt-what-cpuid-helper
new file mode 100755 (executable)
index 0000000..b446009
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh -
+echo
diff --git a/tests/google-cloud/test.sh b/tests/google-cloud/test.sh
new file mode 100755 (executable)
index 0000000..39287a2
--- /dev/null
@@ -0,0 +1,32 @@
+# Test for GCE
+# Copyright (C) 2008-2022 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.
+
+output="$(PATH=../..:$PATH virt-what --test-root=. 2>&1)"
+expected="google_cloud"
+
+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
index 69fa456..2c346bd 100644 (file)
@@ -59,7 +59,7 @@ Status: confirmed by Charles Nguyen
 
 This is running on Google Cloud Platform / Google Compute Engine.
 
-Status: not confirmed
+Status: confirmed by RWMJ
 
 =item B<hyperv>