|
|
f83e65 |
From 89765910064584ebaea7a9899838a2cb66740d26 Mon Sep 17 00:00:00 2001
|
|
|
b6cf65 |
From: Charles Nguyen <chuckleb@gmail.com>
|
|
|
b6cf65 |
Date: Sat, 21 Jun 2014 22:27:51 -0500
|
|
|
201bb7 |
Subject: [PATCH 06/27] Added check and test routines for Docker
|
|
|
b6cf65 |
|
|
|
b6cf65 |
---
|
|
|
b6cf65 |
Makefile.am | 7 +++++++
|
|
|
b6cf65 |
tests/docker/.dockerinit | 0
|
|
|
b6cf65 |
tests/docker/proc/cpuinfo | 0
|
|
|
b6cf65 |
tests/docker/proc/self/status | 0
|
|
|
b6cf65 |
tests/docker/sbin/dmidecode | 6 ++++++
|
|
|
b6cf65 |
tests/docker/sbin/uname | 2 ++
|
|
|
b6cf65 |
tests/docker/sbin/virt-what-cpuid-helper | 2 ++
|
|
|
b6cf65 |
tests/test-docker.sh | 34 ++++++++++++++++++++++++++++++++
|
|
|
b6cf65 |
virt-what.in | 5 +++++
|
|
|
b6cf65 |
9 files changed, 56 insertions(+)
|
|
|
b6cf65 |
create mode 100644 tests/docker/.dockerinit
|
|
|
b6cf65 |
create mode 100644 tests/docker/proc/cpuinfo
|
|
|
b6cf65 |
create mode 100644 tests/docker/proc/self/status
|
|
|
b6cf65 |
create mode 100755 tests/docker/sbin/dmidecode
|
|
|
b6cf65 |
create mode 100755 tests/docker/sbin/uname
|
|
|
b6cf65 |
create mode 100755 tests/docker/sbin/virt-what-cpuid-helper
|
|
|
b6cf65 |
create mode 100755 tests/test-docker.sh
|
|
|
b6cf65 |
|
|
|
b6cf65 |
diff --git a/Makefile.am b/Makefile.am
|
|
|
b6cf65 |
index 784d6db..24d1730 100644
|
|
|
b6cf65 |
--- a/Makefile.am
|
|
|
b6cf65 |
+++ b/Makefile.am
|
|
|
b6cf65 |
@@ -40,6 +40,7 @@ endif
|
|
|
b6cf65 |
|
|
|
b6cf65 |
TESTS = \
|
|
|
b6cf65 |
tests/test-baremetal.sh \
|
|
|
b6cf65 |
+ tests/test-docker.sh \
|
|
|
b6cf65 |
tests/test-esx4.1.sh \
|
|
|
b6cf65 |
tests/test-hyperv.sh \
|
|
|
b6cf65 |
tests/test-kvm.sh \
|
|
|
b6cf65 |
@@ -63,6 +64,12 @@ EXTRA_DIST = \
|
|
|
b6cf65 |
tests/baremetal/sbin/dmidecode \
|
|
|
b6cf65 |
tests/baremetal/sbin/uname \
|
|
|
b6cf65 |
tests/baremetal/sbin/virt-what-cpuid-helper \
|
|
|
b6cf65 |
+ tests/docker/.dockerinit \
|
|
|
b6cf65 |
+ tests/docker/proc/cpuinfo \
|
|
|
b6cf65 |
+ tests/docker/proc/self/status \
|
|
|
b6cf65 |
+ tests/docker/sbin/dmidecode \
|
|
|
b6cf65 |
+ tests/docker/sbin/uname \
|
|
|
b6cf65 |
+ tests/docker/sbin/virt-what-cpuid-helper \
|
|
|
b6cf65 |
tests/esx4.1/proc/cpuinfo \
|
|
|
b6cf65 |
tests/esx4.1/proc/self/status \
|
|
|
b6cf65 |
tests/esx4.1/sbin/dmidecode \
|
|
|
b6cf65 |
diff --git a/tests/docker/.dockerinit b/tests/docker/.dockerinit
|
|
|
b6cf65 |
new file mode 100644
|
|
|
b6cf65 |
index 0000000..e69de29
|
|
|
b6cf65 |
diff --git a/tests/docker/proc/cpuinfo b/tests/docker/proc/cpuinfo
|
|
|
b6cf65 |
new file mode 100644
|
|
|
b6cf65 |
index 0000000..e69de29
|
|
|
b6cf65 |
diff --git a/tests/docker/proc/self/status b/tests/docker/proc/self/status
|
|
|
b6cf65 |
new file mode 100644
|
|
|
b6cf65 |
index 0000000..e69de29
|
|
|
b6cf65 |
diff --git a/tests/docker/sbin/dmidecode b/tests/docker/sbin/dmidecode
|
|
|
b6cf65 |
new file mode 100755
|
|
|
b6cf65 |
index 0000000..d9992ad
|
|
|
b6cf65 |
--- /dev/null
|
|
|
b6cf65 |
+++ b/tests/docker/sbin/dmidecode
|
|
|
b6cf65 |
@@ -0,0 +1,6 @@
|
|
|
b6cf65 |
+#!/bin/sh -
|
|
|
b6cf65 |
+cat <<'EOF'
|
|
|
b6cf65 |
+# dmidecode 2.11
|
|
|
b6cf65 |
+/dev/mem: Operation not permitted
|
|
|
b6cf65 |
+EOF
|
|
|
b6cf65 |
+exit 1
|
|
|
b6cf65 |
diff --git a/tests/docker/sbin/uname b/tests/docker/sbin/uname
|
|
|
b6cf65 |
new file mode 100755
|
|
|
b6cf65 |
index 0000000..ab0ec89
|
|
|
b6cf65 |
--- /dev/null
|
|
|
b6cf65 |
+++ b/tests/docker/sbin/uname
|
|
|
b6cf65 |
@@ -0,0 +1,2 @@
|
|
|
b6cf65 |
+#!/bin/sh -
|
|
|
b6cf65 |
+echo x86_64
|
|
|
b6cf65 |
diff --git a/tests/docker/sbin/virt-what-cpuid-helper b/tests/docker/sbin/virt-what-cpuid-helper
|
|
|
b6cf65 |
new file mode 100755
|
|
|
b6cf65 |
index 0000000..ad82504
|
|
|
b6cf65 |
--- /dev/null
|
|
|
b6cf65 |
+++ b/tests/docker/sbin/virt-what-cpuid-helper
|
|
|
b6cf65 |
@@ -0,0 +1,2 @@
|
|
|
b6cf65 |
+#!/bin/sh -
|
|
|
b6cf65 |
+echo @
|
|
|
b6cf65 |
diff --git a/tests/test-docker.sh b/tests/test-docker.sh
|
|
|
b6cf65 |
new file mode 100755
|
|
|
b6cf65 |
index 0000000..4187f61
|
|
|
b6cf65 |
--- /dev/null
|
|
|
b6cf65 |
+++ b/tests/test-docker.sh
|
|
|
b6cf65 |
@@ -0,0 +1,34 @@
|
|
|
b6cf65 |
+# Test for Docker
|
|
|
b6cf65 |
+# Copyright (C) 2008-2011 Red Hat Inc.
|
|
|
b6cf65 |
+#
|
|
|
b6cf65 |
+# This program is free software; you can redistribute it and/or modify
|
|
|
b6cf65 |
+# it under the terms of the GNU General Public License as published by
|
|
|
b6cf65 |
+# the Free Software Foundation; either version 2 of the License, or
|
|
|
b6cf65 |
+# (at your option) any later version.
|
|
|
b6cf65 |
+#
|
|
|
b6cf65 |
+# This program is distributed in the hope that it will be useful,
|
|
|
b6cf65 |
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
b6cf65 |
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
b6cf65 |
+# GNU General Public License for more details.
|
|
|
b6cf65 |
+#
|
|
|
b6cf65 |
+# You should have received a copy of the GNU General Public License
|
|
|
b6cf65 |
+# along with this program; if not, write to the Free Software
|
|
|
b6cf65 |
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
b6cf65 |
+
|
|
|
b6cf65 |
+root=tests/docker
|
|
|
b6cf65 |
+
|
|
|
b6cf65 |
+output="$(./virt-what --test-root=$root 2>&1)"
|
|
|
b6cf65 |
+expected="docker"
|
|
|
b6cf65 |
+
|
|
|
b6cf65 |
+if [ "$output" != "$expected" ]; then
|
|
|
b6cf65 |
+ echo "$0: test failed because output did not match expected"
|
|
|
b6cf65 |
+ echo "Expected output was:"
|
|
|
b6cf65 |
+ echo "----------------------------------------"
|
|
|
b6cf65 |
+ echo "$expected"
|
|
|
b6cf65 |
+ echo "----------------------------------------"
|
|
|
b6cf65 |
+ echo "But the actual output of the program was:"
|
|
|
b6cf65 |
+ echo "----------------------------------------"
|
|
|
b6cf65 |
+ echo "$output"
|
|
|
b6cf65 |
+ echo "----------------------------------------"
|
|
|
b6cf65 |
+ exit 1
|
|
|
b6cf65 |
+fi
|
|
|
b6cf65 |
diff --git a/virt-what.in b/virt-what.in
|
|
|
b6cf65 |
index fb399be..c04203e 100644
|
|
|
b6cf65 |
--- a/virt-what.in
|
|
|
b6cf65 |
+++ b/virt-what.in
|
|
|
b6cf65 |
@@ -248,3 +248,8 @@ if ! "$skip_qemu_kvm"; then
|
|
|
b6cf65 |
fi
|
|
|
b6cf65 |
fi
|
|
|
b6cf65 |
fi
|
|
|
b6cf65 |
+
|
|
|
b6cf65 |
+# Check for Docker.
|
|
|
b6cf65 |
+if [ -f "${root}/.dockerinit" ]; then
|
|
|
b6cf65 |
+ echo docker
|
|
|
b6cf65 |
+fi
|
|
|
b6cf65 |
--
|
|
|
201bb7 |
2.10.2
|
|
|
b6cf65 |
|