summaryrefslogtreecommitdiffstats
path: root/tests/ts/lscpu
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-14 19:10:49 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-14 19:10:49 +0000
commitcfe5e3905201349e9cf3f95d52ff4bd100bde37d (patch)
treed0baf160cbee3195249d095f85e52d20c21acf02 /tests/ts/lscpu
parentInitial commit. (diff)
downloadutil-linux-cfe5e3905201349e9cf3f95d52ff4bd100bde37d.tar.xz
util-linux-cfe5e3905201349e9cf3f95d52ff4bd100bde37d.zip
Adding upstream version 2.39.3.upstream/2.39.3
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ts/lscpu')
-rw-r--r--tests/ts/lscpu/dumps/armv7.tar.gzbin0 -> 3163 bytes
-rw-r--r--tests/ts/lscpu/dumps/loongarch-loongson_3a5000_hv.tar.gzbin0 -> 7954 bytes
-rw-r--r--tests/ts/lscpu/dumps/ppc-qemu.tar.gzbin0 -> 2014 bytes
-rw-r--r--tests/ts/lscpu/dumps/ppc64-POWER7-64cpu.tar.gzbin0 -> 56867 bytes
-rw-r--r--tests/ts/lscpu/dumps/ppc64-POWER7.tar.gzbin0 -> 14350 bytes
-rw-r--r--tests/ts/lscpu/dumps/rv64-linux.tar.gzbin0 -> 4215 bytes
-rw-r--r--tests/ts/lscpu/dumps/s390-kvm.tar.gzbin0 -> 2275 bytes
-rw-r--r--tests/ts/lscpu/dumps/s390-lpar-drawer.tar.gzbin0 -> 18131 bytes
-rw-r--r--tests/ts/lscpu/dumps/s390-lpar.tar.gzbin0 -> 6611 bytes
-rw-r--r--tests/ts/lscpu/dumps/s390-nested-virt.tar.gzbin0 -> 7199 bytes
-rw-r--r--tests/ts/lscpu/dumps/s390-zvm.tar.gzbin0 -> 2582 bytes
-rw-r--r--tests/ts/lscpu/dumps/sparc64.tar.gzbin0 -> 2756 bytes
-rw-r--r--tests/ts/lscpu/dumps/vbox-win.tar.gzbin0 -> 15769 bytes
-rw-r--r--tests/ts/lscpu/dumps/vmware_fpe.tar.gzbin0 -> 59743 bytes
-rw-r--r--tests/ts/lscpu/dumps/x86_64-64cpu-linux6.2.tar.gzbin0 -> 39020 bytes
-rw-r--r--tests/ts/lscpu/dumps/x86_64-64cpu.tar.gzbin0 -> 153140 bytes
-rw-r--r--tests/ts/lscpu/dumps/x86_64-dell_e4310.tar.gzbin0 -> 12933 bytes
-rw-r--r--tests/ts/lscpu/dumps/x86_64-epyc_7451.tar.gzbin0 -> 361027 bytes
-rwxr-xr-xtests/ts/lscpu/lscpu61
-rwxr-xr-xtests/ts/lscpu/mk-input.sh48
20 files changed, 109 insertions, 0 deletions
diff --git a/tests/ts/lscpu/dumps/armv7.tar.gz b/tests/ts/lscpu/dumps/armv7.tar.gz
new file mode 100644
index 0000000..67a2c66
--- /dev/null
+++ b/tests/ts/lscpu/dumps/armv7.tar.gz
Binary files differ
diff --git a/tests/ts/lscpu/dumps/loongarch-loongson_3a5000_hv.tar.gz b/tests/ts/lscpu/dumps/loongarch-loongson_3a5000_hv.tar.gz
new file mode 100644
index 0000000..ee29d80
--- /dev/null
+++ b/tests/ts/lscpu/dumps/loongarch-loongson_3a5000_hv.tar.gz
Binary files differ
diff --git a/tests/ts/lscpu/dumps/ppc-qemu.tar.gz b/tests/ts/lscpu/dumps/ppc-qemu.tar.gz
new file mode 100644
index 0000000..a428271
--- /dev/null
+++ b/tests/ts/lscpu/dumps/ppc-qemu.tar.gz
Binary files differ
diff --git a/tests/ts/lscpu/dumps/ppc64-POWER7-64cpu.tar.gz b/tests/ts/lscpu/dumps/ppc64-POWER7-64cpu.tar.gz
new file mode 100644
index 0000000..ea8b79a
--- /dev/null
+++ b/tests/ts/lscpu/dumps/ppc64-POWER7-64cpu.tar.gz
Binary files differ
diff --git a/tests/ts/lscpu/dumps/ppc64-POWER7.tar.gz b/tests/ts/lscpu/dumps/ppc64-POWER7.tar.gz
new file mode 100644
index 0000000..c8fcc23
--- /dev/null
+++ b/tests/ts/lscpu/dumps/ppc64-POWER7.tar.gz
Binary files differ
diff --git a/tests/ts/lscpu/dumps/rv64-linux.tar.gz b/tests/ts/lscpu/dumps/rv64-linux.tar.gz
new file mode 100644
index 0000000..e108d85
--- /dev/null
+++ b/tests/ts/lscpu/dumps/rv64-linux.tar.gz
Binary files differ
diff --git a/tests/ts/lscpu/dumps/s390-kvm.tar.gz b/tests/ts/lscpu/dumps/s390-kvm.tar.gz
new file mode 100644
index 0000000..340f7ea
--- /dev/null
+++ b/tests/ts/lscpu/dumps/s390-kvm.tar.gz
Binary files differ
diff --git a/tests/ts/lscpu/dumps/s390-lpar-drawer.tar.gz b/tests/ts/lscpu/dumps/s390-lpar-drawer.tar.gz
new file mode 100644
index 0000000..ca1bc96
--- /dev/null
+++ b/tests/ts/lscpu/dumps/s390-lpar-drawer.tar.gz
Binary files differ
diff --git a/tests/ts/lscpu/dumps/s390-lpar.tar.gz b/tests/ts/lscpu/dumps/s390-lpar.tar.gz
new file mode 100644
index 0000000..59aea6a
--- /dev/null
+++ b/tests/ts/lscpu/dumps/s390-lpar.tar.gz
Binary files differ
diff --git a/tests/ts/lscpu/dumps/s390-nested-virt.tar.gz b/tests/ts/lscpu/dumps/s390-nested-virt.tar.gz
new file mode 100644
index 0000000..7992699
--- /dev/null
+++ b/tests/ts/lscpu/dumps/s390-nested-virt.tar.gz
Binary files differ
diff --git a/tests/ts/lscpu/dumps/s390-zvm.tar.gz b/tests/ts/lscpu/dumps/s390-zvm.tar.gz
new file mode 100644
index 0000000..b13594d
--- /dev/null
+++ b/tests/ts/lscpu/dumps/s390-zvm.tar.gz
Binary files differ
diff --git a/tests/ts/lscpu/dumps/sparc64.tar.gz b/tests/ts/lscpu/dumps/sparc64.tar.gz
new file mode 100644
index 0000000..7edfba8
--- /dev/null
+++ b/tests/ts/lscpu/dumps/sparc64.tar.gz
Binary files differ
diff --git a/tests/ts/lscpu/dumps/vbox-win.tar.gz b/tests/ts/lscpu/dumps/vbox-win.tar.gz
new file mode 100644
index 0000000..e8204fe
--- /dev/null
+++ b/tests/ts/lscpu/dumps/vbox-win.tar.gz
Binary files differ
diff --git a/tests/ts/lscpu/dumps/vmware_fpe.tar.gz b/tests/ts/lscpu/dumps/vmware_fpe.tar.gz
new file mode 100644
index 0000000..1fc6aed
--- /dev/null
+++ b/tests/ts/lscpu/dumps/vmware_fpe.tar.gz
Binary files differ
diff --git a/tests/ts/lscpu/dumps/x86_64-64cpu-linux6.2.tar.gz b/tests/ts/lscpu/dumps/x86_64-64cpu-linux6.2.tar.gz
new file mode 100644
index 0000000..05d0aa6
--- /dev/null
+++ b/tests/ts/lscpu/dumps/x86_64-64cpu-linux6.2.tar.gz
Binary files differ
diff --git a/tests/ts/lscpu/dumps/x86_64-64cpu.tar.gz b/tests/ts/lscpu/dumps/x86_64-64cpu.tar.gz
new file mode 100644
index 0000000..4d7516e
--- /dev/null
+++ b/tests/ts/lscpu/dumps/x86_64-64cpu.tar.gz
Binary files differ
diff --git a/tests/ts/lscpu/dumps/x86_64-dell_e4310.tar.gz b/tests/ts/lscpu/dumps/x86_64-dell_e4310.tar.gz
new file mode 100644
index 0000000..2988cbc
--- /dev/null
+++ b/tests/ts/lscpu/dumps/x86_64-dell_e4310.tar.gz
Binary files differ
diff --git a/tests/ts/lscpu/dumps/x86_64-epyc_7451.tar.gz b/tests/ts/lscpu/dumps/x86_64-epyc_7451.tar.gz
new file mode 100644
index 0000000..cb7cbd9
--- /dev/null
+++ b/tests/ts/lscpu/dumps/x86_64-epyc_7451.tar.gz
Binary files differ
diff --git a/tests/ts/lscpu/lscpu b/tests/ts/lscpu/lscpu
new file mode 100755
index 0000000..03249c3
--- /dev/null
+++ b/tests/ts/lscpu/lscpu
@@ -0,0 +1,61 @@
+#!/bin/bash
+#
+# Copyright (C) 2008 Cai Qian <qcai@redhat.com>
+#
+# This file is part of util-linux.
+#
+# This file 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 3 of the License, or
+# (at your option) any later version.
+#
+# This file 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, see <http://www.gnu.org/licenses/>.
+#
+TS_TOPDIR="${0%/*}/../.."
+. "$TS_TOPDIR"/functions.sh
+
+ts_init "$*"
+
+ts_check_prog "tar"
+ts_check_prog "gzip"
+ts_check_test_command "$TS_CMD_LSCPU"
+
+for dump in $(ls $TS_SELF/dumps/*.tar.gz | sort); do
+ name=$(basename $dump .tar.gz)
+ dumpdir="$TS_OUTDIR/dumps"
+
+ ts_init_subtest $name
+ mkdir -p $dumpdir
+
+ tar -C $dumpdir -zxf $dump
+
+ # Architecture information is not applicable with -s.
+ "${TS_CMD_LSCPU}" -s "${dumpdir}/${name}" | \
+ grep -v "Architecture" >> ${TS_OUTPUT} 2>> $TS_ERRLOG
+
+ echo >>"${TS_OUTPUT}"
+
+ "${TS_CMD_LSCPU}" -p -s "${dumpdir}/${name}" \
+ >> ${TS_OUTPUT} 2>> $TS_ERRLOG
+
+ echo >>"${TS_OUTPUT}"
+
+ "${TS_CMD_LSCPU}" -p -y -s "${dumpdir}/${name}" \
+ >> ${TS_OUTPUT} 2>> $TS_ERRLOG
+
+ if [[ ! -e "${dumpdir}/${name}/sys/kernel/cpu_byteorder" ]]; then
+ # LE/BE depends on binary if we can't read it from the dump
+ sed -i -e '/Byte Order:.*/d' $TS_OUTPUT
+ fi
+
+ ts_finalize_subtest
+done
+
+ts_finalize
+
diff --git a/tests/ts/lscpu/mk-input.sh b/tests/ts/lscpu/mk-input.sh
new file mode 100755
index 0000000..a19bad3
--- /dev/null
+++ b/tests/ts/lscpu/mk-input.sh
@@ -0,0 +1,48 @@
+#!/bin/bash
+#
+# Copyright (C) 2008-2009 Karel Zak <kzak@redhat.com>
+#
+# This script makes a copy of relevant files from /sys and /proc.
+# The files are useful for lscpu(1) regression tests.
+#
+progname=$(basename $0)
+
+if [ -z "$1" ]; then
+ echo -e "\nusage: $progname <testname>\n"
+ exit 1
+fi
+
+TS_NAME="$1"
+TS_DUMP="$TS_NAME"
+CP="cp -r --parents"
+
+mkdir -p $TS_DUMP/{proc,sys}
+
+$CP /proc/cpuinfo $TS_DUMP
+
+mkdir -p $TS_DUMP/proc/bus/pci
+$CP /proc/bus/pci/devices $TS_DUMP
+
+if [ -d "/proc/xen" ]; then
+ mkdir -p $TS_DUMP/proc/xen
+ if [ -f "/proc/xen/capabilities" ]; then
+ $CP /proc/xen/capabilities $TS_DUMP
+ fi
+fi
+
+if [ -e "/proc/sysinfo" ]; then
+ $CP /proc/sysinfo $TS_DUMP
+fi
+
+$CP /sys/devices/system/cpu/* $TS_DUMP
+$CP /sys/devices/system/node/*/cpumap $TS_DUMP
+
+if [ -e "/sys/kernel/cpu_byteorder" ]; then
+ $CP /sys/kernel/cpu_byteorder $TS_DUMP
+fi
+
+
+tar zcvf $TS_NAME.tar.gz $TS_DUMP
+rm -rf $TS_DUMP
+
+