summaryrefslogtreecommitdiffstats
path: root/tests/ts/lscpu/mk-input.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 14:30:35 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 14:30:35 +0000
commit378c18e5f024ac5a8aef4cb40d7c9aa9633d144c (patch)
tree44dfb6ca500d32cabd450649b322a42e70a30683 /tests/ts/lscpu/mk-input.sh
parentInitial commit. (diff)
downloadutil-linux-upstream.tar.xz
util-linux-upstream.zip
Adding upstream version 2.38.1.upstream/2.38.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ts/lscpu/mk-input.sh')
-rw-r--r--tests/ts/lscpu/mk-input.sh43
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/ts/lscpu/mk-input.sh b/tests/ts/lscpu/mk-input.sh
new file mode 100644
index 0000000..65e3d20
--- /dev/null
+++ b/tests/ts/lscpu/mk-input.sh
@@ -0,0 +1,43 @@
+#!/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
+
+tar zcvf $TS_NAME.tar.gz $TS_DUMP
+rm -rf $TS_DUMP
+
+