diff mbox series

[kvm-unit-tests,2/3] arm/arm64: Add a way to specify an external directory with tests

Message ID 20210324171402.371744-3-nikos.nikoleris@arm.com (mailing list archive)
State New, archived
Headers show
Series Add support for external tests and litmus7 documentation | expand

Commit Message

Nikos Nikoleris March 24, 2021, 5:14 p.m. UTC
This change adds an argument to the configure script which allows a
user to specify an external directory with extra tests. When
specified, the build system will include the Makefile in that
directory allowing a user to add extra tests. For example:

For example, DIR contains a test in test.c which depends on symbols
defined in obj.c and the Makefile:

tests += $(EXT_DIR)/test.flat

cflatobjs += $(EXT_DIR)/obj.o

With this change, we can add DIR to the build process and generate the
test using

$> ./configure --ext-dir=DIR
$> make

Signed-off-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
---
 configure           | 7 +++++++
 arm/Makefile.common | 4 ++++
 2 files changed, 11 insertions(+)
diff mbox series

Patch

diff --git a/configure b/configure
index cdcd34e..e734b9d 100755
--- a/configure
+++ b/configure
@@ -26,6 +26,7 @@  errata_force=0
 erratatxt="$srcdir/errata.txt"
 host_key_document=
 page_size=
+ext_dir=
 
 usage() {
     cat <<-EOF
@@ -54,6 +55,8 @@  usage() {
 	    --page-size=PAGE_SIZE
 	                           Specify the page size (translation granule) (4k, 16k or
 	                           64k, default is 64k, arm64 only)
+	    --ext-dir=DIR	   specify an additional location with more tests; when enabled
+	                           DIR/Makefile is included to the build system (arm/arm64 only)
 EOF
     exit 1
 }
@@ -112,6 +115,9 @@  while [[ "$1" = -* ]]; do
 	--page-size)
 	    page_size="$arg"
 	    ;;
+	--ext-dir)
+	    ext_dir="$arg"
+	    ;;
 	--help)
 	    usage
 	    ;;
@@ -264,6 +270,7 @@  U32_LONG_FMT=$u32_long
 WA_DIVIDE=$wa_divide
 GENPROTIMG=${GENPROTIMG-genprotimg}
 HOST_KEY_DOCUMENT=$host_key_document
+EXT_DIR=$ext_dir
 EOF
 
 cat <<EOF > lib/config.h
diff --git a/arm/Makefile.common b/arm/Makefile.common
index 19db50d..ffe1a49 100644
--- a/arm/Makefile.common
+++ b/arm/Makefile.common
@@ -13,6 +13,10 @@  tests-common += $(TEST_DIR)/psci.flat
 tests-common += $(TEST_DIR)/sieve.flat
 tests-common += $(TEST_DIR)/pl031.flat
 
+ifdef EXT_DIR
+include $(EXT_DIR)/Makefile
+endif
+
 tests-all = $(tests-common) $(tests)
 all: directories $(tests-all)