public inbox for linux-integrity@vger.kernel.org
 help / color / mirror / Atom feed
From: djacobs7@binghamton.edu
To: linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: zohar@linux.ibm.com, pvorel@suse.cz, vt@altlinux.org,
	David Jacobson <djacobs7@binghamton.edu>
Subject: [PATCH v2 8/8] evmtest: virtual machine compatibility
Date: Fri, 22 Mar 2019 04:34:41 -0400	[thread overview]
Message-ID: <20190322083441.31084-8-djacobs7@binghamton.edu> (raw)
In-Reply-To: <20190322083441.31084-1-djacobs7@binghamton.edu>

From: David Jacobson <djacobs7@binghamton.edu>

Regression testing kernels is a task that is often virtualized. This
patch adds functionality to evmtest that enables a developer to
determine if their kernel build is suitable for running in a virtual
machine.

Signed-off-by: David Jacobson <djacobs7@binghamton.edu>

changelog:
* shellcheck compliant
* updated patch to work with function restructure
---
 evmtest/tests/env_validate.sh | 23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/evmtest/tests/env_validate.sh b/evmtest/tests/env_validate.sh
index c630a23..09b1a87 100755
--- a/evmtest/tests/env_validate.sh
+++ b/evmtest/tests/env_validate.sh
@@ -4,12 +4,13 @@
 TEST="env_validate"
 ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )/.."
 source "$ROOT"/files/common.sh
+VM_VALIDATE=0
 VERBOSE=0
 CONFIG_FILE=""
 
 usage () {
 	echo ""
-	echo "env_validate [-c <config>]|-r] [-vh]"
+	echo "env_validate [-c <config>]|-r] [--vm] [-vh]"
 	echo ""
 	echo "	This test validates that a kernel is properly configured, "
 	echo "	based on either the provided config file or the builtin"
@@ -18,12 +19,13 @@ usage () {
 	echo "	-c	Kernel config file"
 	echo "	-r	Will attempt to pull running config"
 	echo "	-v	Verbose testing"
+	echo "	--vm	Will validate that the build is VM compatible"
 	echo "	-h	Displays this help message"
 	echo ""
 }
 
 parse_args () {
-	TEMP=$(getopt -o 'hc:rv' -n 'env_validate' -- "$@")
+	TEMP=$(getopt -o 'hc:rv' -l "vm" -n 'env_validate' -- "$@")
 	eval set -- "$TEMP"
 
 	while true ; do
@@ -32,6 +34,7 @@ parse_args () {
 		-c) CONFIG="$2"; shift 2;;
 		-r) RUNNING=1; shift;;
 		-v) VERBOSE=1; shift;;
+		--vm) VM_VALIDATE=1; shift;;
 		--) shift; break;;
 		*) echo "[*] Unrecognized option $1"; exit 1 ;;
 		esac
@@ -154,6 +157,22 @@ check_config () {
 	validate_defined "CONFIG_MODULE_SIG_KEY"
 	validate "CONFIG_MODULE_SIG" "y"
 
+
+	if [ $VM_VALIDATE == 1 ]; then
+		v_out "Validating VM configuration"
+
+		validate "CONFIG_BLK_MQ_VIRTIO" "y"
+		validate "CONFIG_MEMORY_BALLOON" "y"
+		validate "CONFIG_VIRTIO_BLK" "y"
+		validate "CONFIG_SCSI_VIRTIO" "y"
+		validate "CONFIG_HW_RANDOM_VIRTIO" "y"
+		validate "CONFIG_VIRTIO" "y"
+		validate "CONFIG_VIRTIO_MENU" "y"
+		validate "CONFIG_VIRTIO_PCI" "y"
+		validate "CONFIG_VIRTIO_PCI_LEGACY" "y"
+		validate "CONFIG_VIRTIO_BALLOON" "y"
+	fi
+
 	if [ ${#INVALID_DEFINITION[@]} != 0 ]; then
 		v_out "The following Kconfig variables are incorrectly defined:"
 		for var in "${INVALID_DEFINITION[@]}"; do
-- 
2.20.1


  parent reply	other threads:[~2019-03-22  8:35 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-22  8:34 [PATCH v2 1/8] evmtest: Regression testing integrity subsystem djacobs7
2019-03-22  8:34 ` [PATCH v2 2/8] evmtest: test loading IMA policies djacobs7
2019-03-22  8:34 ` [PATCH v2 3/8] evmtest: test kernel module loading djacobs7
2019-03-22  8:34 ` [PATCH v2 4/8] evmtest: test kexec signature policy djacobs7
2019-03-22  8:34 ` [PATCH v2 5/8] evmtest: validate boot record djacobs7
2019-03-22  8:34 ` [PATCH v2 6/8] evmtest: test the preservation of extended attributes djacobs7
2019-03-22  8:34 ` [PATCH v2 7/8] emvtest: Add ability to run all tests djacobs7
2019-03-22  8:34 ` djacobs7 [this message]
2019-03-22 12:18 ` [PATCH v2 1/8] evmtest: Regression testing integrity subsystem Petr Vorel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190322083441.31084-8-djacobs7@binghamton.edu \
    --to=djacobs7@binghamton.edu \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pvorel@suse.cz \
    --cc=vt@altlinux.org \
    --cc=zohar@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox