summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarel Zak2008-10-22 13:13:41 +0200
committerKarel Zak2008-10-22 13:56:52 +0200
commit6c7bba315c0737931dc2d4b0a5393146c2afb83b (patch)
tree3ed33e25a1951f0df369fcd168d34748f3f50e88
parentlscpu: add Hypervisor detection (diff)
downloadkernel-qcow2-util-linux-6c7bba315c0737931dc2d4b0a5393146c2afb83b.tar.gz
kernel-qcow2-util-linux-6c7bba315c0737931dc2d4b0a5393146c2afb83b.tar.xz
kernel-qcow2-util-linux-6c7bba315c0737931dc2d4b0a5393146c2afb83b.zip
tests: add mk-lscpu-input.sh
This script makes a copy from system /proc and /sys. The result is useful for lscpu(1) regression tests. Signed-off-by: Karel Zak <kzak@redhat.com>
-rw-r--r--tests/Makefile.am1
-rwxr-xr-xtests/mk-lscpu-input.sh48
2 files changed, 49 insertions, 0 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 827b8493e..59eb62929 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -6,6 +6,7 @@ EXTRA_DIST = expected \
functions.sh \
input \
README \
+ mk-lscpu-input.sh \
run.sh \
ts-cal-1 \
ts-cal-3 \
diff --git a/tests/mk-lscpu-input.sh b/tests/mk-lscpu-input.sh
new file mode 100755
index 000000000..dd7a6aaa9
--- /dev/null
+++ b/tests/mk-lscpu-input.sh
@@ -0,0 +1,48 @@
+#!/bin/bash
+#
+# Copyright (C) 2008 Karel Zak <kzak@redhat.com>
+#
+# This script makes a copy of relevant files from /sys and /proc.
+# The files are usefull for lscpu(1) regression tests.
+#
+# For exmaple:
+#
+# # mk-lscpu-input ts-lscpu-i386-coolhw
+# # lscpu --sysroot input/ts-lscpu-i386-coolhw
+#
+
+progname=$(basename $0)
+
+if [ -z "$1" ]; then
+ echo -e "\nusage: $progname <testname>\n"
+ exit 1
+fi
+
+TS_NAME="$1"
+TS_INPUT="input/$TS_NAME"
+CP="cp -r --parents"
+
+mkdir -p $TS_INPUT/{proc,sys}
+
+$CP /proc/cpuinfo $TS_INPUT
+
+mkdir -p $TS_INPUT/proc/bus/pci
+$CP /proc/bus/pci/devices $TS_INPUT
+
+if [ -d "/proc/xen" ]; then
+ mkdir -p $TS_INPUT/proc/xen
+ if [ -f "/proc/xen/capabilities" ]; then
+ $CP /proc/xen/capabilities $TS_INPUT
+ fi
+fi
+
+for c in $(ls -d /sys/devices/system/cpu/cpu[0-9]*); do
+ mkdir -p $TS_INPUT/$c
+done
+
+$CP /sys/devices/system/cpu/cpu0/topology/{thread_siblings,core_siblings} $TS_INPUT
+$CP /sys/devices/system/cpu/cpu0/cache/*/{type,level,size,shared_cpu_map} $TS_INPUT
+
+$CP /sys/devices/system/node/*/cpumap $TS_INPUT
+
+