From 7e679278431aa1a188dfe423526dfea82fddcbd3 Mon Sep 17 00:00:00 2001 From: Weisson Date: Thu, 27 May 2021 10:55:57 +0100 Subject: [PATCH] Add test for Alibaba Cloud Linux --- configure.ac | 2 + tests/alibaba-cloud-x86/Makefile.am | 27 +++++ tests/alibaba-cloud-x86/proc/cpuinfo | 53 +++++++++ tests/alibaba-cloud-x86/proc/self/status | 54 +++++++++ tests/alibaba-cloud-x86/sbin/dmidecode | 131 +++++++++++++++++++++ tests/alibaba-cloud-x86/sbin/uname | 2 + .../alibaba-cloud-x86/sbin/virt-what-cpuid-helper | 2 + tests/alibaba-cloud-x86/test.sh | 33 ++++++ 8 files changed, 304 insertions(+) create mode 100644 tests/alibaba-cloud-x86/Makefile.am create mode 100644 tests/alibaba-cloud-x86/proc/cpuinfo create mode 100644 tests/alibaba-cloud-x86/proc/self/status create mode 100755 tests/alibaba-cloud-x86/sbin/dmidecode create mode 100755 tests/alibaba-cloud-x86/sbin/uname create mode 100755 tests/alibaba-cloud-x86/sbin/virt-what-cpuid-helper create mode 100755 tests/alibaba-cloud-x86/test.sh diff --git a/configure.ac b/configure.ac index 9d0a423..61378cf 100644 --- a/configure.ac +++ b/configure.ac @@ -34,6 +34,7 @@ AM_CONDITIONAL([HOST_CPU_IA64], [ test "x$host_cpu" = "xia64" ]) dnl List of tests. tests="\ + alibaba-cloud-x86 \ aws-baremetal-x86 \ aws-kvm-arm \ aws-kvm-x86 \ @@ -79,6 +80,7 @@ AC_CONFIG_HEADERS([config.h]) AC_CONFIG_FILES([virt-what],[chmod +x virt-what]) AC_CONFIG_FILES([Makefile tests/Makefile + tests/alibaba-cloud-x86/Makefile tests/aws-baremetal-x86/Makefile tests/aws-kvm-arm/Makefile tests/aws-kvm-x86/Makefile diff --git a/tests/alibaba-cloud-x86/Makefile.am b/tests/alibaba-cloud-x86/Makefile.am new file mode 100644 index 0000000..c9ea7a1 --- /dev/null +++ b/tests/alibaba-cloud-x86/Makefile.am @@ -0,0 +1,27 @@ +# Makefile for virt-what +# 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. + +CLEANFILES = *~ + +TESTS = test.sh + +EXTRA_DIST = \ + test.sh \ + proc/cpuinfo \ + proc/self/status \ + sbin/dmidecode \ + sbin/virt-what-cpuid-helper diff --git a/tests/alibaba-cloud-x86/proc/cpuinfo b/tests/alibaba-cloud-x86/proc/cpuinfo new file mode 100644 index 0000000..99fa1af --- /dev/null +++ b/tests/alibaba-cloud-x86/proc/cpuinfo @@ -0,0 +1,53 @@ +processor : 0 +vendor_id : GenuineIntel +cpu family : 6 +model : 85 +model name : Intel(R) Xeon(R) Platinum 8269CY CPU @ 2.50GHz +stepping : 7 +microcode : 0x1 +cpu MHz : 2500.002 +cache size : 36608 KB +physical id : 0 +siblings : 2 +core id : 0 +cpu cores : 1 +apicid : 0 +initial apicid : 0 +fpu : yes +fpu_exception : yes +cpuid level : 22 +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 nonstop_tsc cpuid tsc_known_freq pni pclmulqdq monitor ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single pti fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx avx512f avx512dq rdseed adx smap avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves arat avx512_vnni +bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs taa itlb_multihit +bogomips : 5000.00 +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 8269CY CPU @ 2.50GHz +stepping : 7 +microcode : 0x1 +cpu MHz : 2500.002 +cache size : 36608 KB +physical id : 0 +siblings : 2 +core id : 0 +cpu cores : 1 +apicid : 1 +initial apicid : 1 +fpu : yes +fpu_exception : yes +cpuid level : 22 +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 nonstop_tsc cpuid tsc_known_freq pni pclmulqdq monitor ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single pti fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx avx512f avx512dq rdseed adx smap avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves arat avx512_vnni +bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs taa itlb_multihit +bogomips : 5000.00 +clflush size : 64 +cache_alignment : 64 +address sizes : 46 bits physical, 48 bits virtual +power management: \ No newline at end of file diff --git a/tests/alibaba-cloud-x86/proc/self/status b/tests/alibaba-cloud-x86/proc/self/status new file mode 100644 index 0000000..1ea7195 --- /dev/null +++ b/tests/alibaba-cloud-x86/proc/self/status @@ -0,0 +1,54 @@ +Name: cat +Umask: 0022 +State: R (running) +Tgid: 25933 +Ngid: 0 +Pid: 25933 +PPid: 25932 +TracerPid: 0 +Uid: 0 0 0 0 +Gid: 0 0 0 0 +FDSize: 64 +Groups: 0 +NStgid: 25933 +NSpid: 25933 +NSpgid: 25932 +NSsid: 25039 +VmPeak: 108084 kB +VmSize: 108084 kB +VmLck: 0 kB +VmPin: 0 kB +VmHWM: 748 kB +VmRSS: 748 kB +RssAnon: 76 kB +RssFile: 672 kB +RssShmem: 0 kB +VmData: 188 kB +VmStk: 132 kB +VmExe: 44 kB +VmLib: 1952 kB +VmPTE: 68 kB +VmSwap: 0 kB +HugetlbPages: 0 kB +CoreDumping: 0 +Threads: 1 +SigQ: 0/30350 +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: vulnerable +Cpus_allowed: 3 +Cpus_allowed_list: 0-1 +Mems_allowed: 00000000,00000001 +Mems_allowed_list: 0 +voluntary_ctxt_switches: 0 +nonvoluntary_ctxt_switches: 2 diff --git a/tests/alibaba-cloud-x86/sbin/dmidecode b/tests/alibaba-cloud-x86/sbin/dmidecode new file mode 100755 index 0000000..2ed2ef3 --- /dev/null +++ b/tests/alibaba-cloud-x86/sbin/dmidecode @@ -0,0 +1,131 @@ +#!/bin/sh - +cat <<'EOF' +# dmidecode 3.2 +Getting SMBIOS data from sysfs. +SMBIOS 2.8 present. +10 structures occupying 462 bytes. +Table at 0x000F5840. + +Handle 0x0000, DMI type 0, 24 bytes +BIOS Information + Vendor: SeaBIOS + Version: 8c24b4c + Release Date: 04/01/2014 + Address: 0xE8000 + Runtime Size: 96 kB + ROM Size: 64 kB + Characteristics: + BIOS characteristics not supported + Targeted content distribution is supported + BIOS Revision: 0.0 + +Handle 0x0100, DMI type 1, 27 bytes +System Information + Manufacturer: Alibaba Cloud + Product Name: Alibaba Cloud ECS + Version: pc-i440fx-2.1 + Serial Number: 20fb1c97-feb0-4c45-b8b9-bb06feeba0b5 + UUID: 20fb1c97-feb0-4c45-b8b9-bb06feeba0b5 + Wake-up Type: Power Switch + SKU Number: Not Specified + Family: Not Specified + +Handle 0x0300, DMI type 3, 21 bytes +Chassis Information + Manufacturer: Alibaba Cloud + Type: Other + Lock: Not Present + Version: pc-i440fx-2.1 + 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 + Contained Elements: 0 + +Handle 0x0400, DMI type 4, 42 bytes +Processor Information + Socket Designation: CPU 0 + Type: Central Processor + Family: Other + Manufacturer: Alibaba Cloud + ID: 57 06 05 00 FF FB 8B 0F + Version: pc-i440fx-2.1 + Voltage: Unknown + External Clock: Unknown + Max Speed: Unknown + Current Speed: Unknown + Status: Populated, Enabled + Upgrade: Other + L1 Cache Handle: Not Provided + L2 Cache Handle: Not Provided + L3 Cache Handle: Not Provided + Serial Number: Not Specified + Asset Tag: Not Specified + Part Number: Not Specified + Core Count: 1 + Core Enabled: 1 + Thread Count: 2 + Characteristics: None + +Handle 0x1000, DMI type 16, 23 bytes +Physical Memory Array + Location: Other + Use: System Memory + Error Correction Type: Multi-bit ECC + Maximum Capacity: 8 GB + Error Information Handle: Not Provided + Number Of Devices: 1 + +Handle 0x1100, DMI type 17, 40 bytes +Memory Device + Array Handle: 0x1000 + Error Information Handle: Not Provided + Total Width: Unknown + Data Width: Unknown + Size: 8192 MB + Form Factor: DIMM + Set: None + Locator: DIMM 0 + Bank Locator: Not Specified + Type: RAM + Type Detail: Other + Speed: Unknown + Manufacturer: Alibaba Cloud + Serial Number: Not Specified + Asset Tag: Not Specified + Part Number: Not Specified + Rank: Unknown + Configured Memory Speed: Unknown + Minimum Voltage: Unknown + Maximum Voltage: Unknown + Configured Voltage: Unknown + +Handle 0x1300, DMI type 19, 31 bytes +Memory Array Mapped Address + Starting Address: 0x00000000000 + Ending Address: 0x000BFFFFFFF + Range Size: 3 GB + Physical Array Handle: 0x1000 + Partition Width: 1 + +Handle 0x1301, DMI type 19, 31 bytes +Memory Array Mapped Address + Starting Address: 0x00100000000 + Ending Address: 0x0023FFFFFFF + Range Size: 5 GB + Physical Array Handle: 0x1000 + Partition Width: 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/alibaba-cloud-x86/sbin/uname b/tests/alibaba-cloud-x86/sbin/uname new file mode 100755 index 0000000..ab0ec89 --- /dev/null +++ b/tests/alibaba-cloud-x86/sbin/uname @@ -0,0 +1,2 @@ +#!/bin/sh - +echo x86_64 diff --git a/tests/alibaba-cloud-x86/sbin/virt-what-cpuid-helper b/tests/alibaba-cloud-x86/sbin/virt-what-cpuid-helper new file mode 100755 index 0000000..f52a9d7 --- /dev/null +++ b/tests/alibaba-cloud-x86/sbin/virt-what-cpuid-helper @@ -0,0 +1,2 @@ +#!/bin/sh - +echo KVMKVMKVM diff --git a/tests/alibaba-cloud-x86/test.sh b/tests/alibaba-cloud-x86/test.sh new file mode 100755 index 0000000..afa2f44 --- /dev/null +++ b/tests/alibaba-cloud-x86/test.sh @@ -0,0 +1,33 @@ +# Test for Alibaba Cloud +# 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. + +output="$(PATH=../..:$PATH virt-what --test-root=. 2>&1)" +expected="alibaba_cloud +kvm" + +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 -- 1.8.3.1