From patchwork Tue Jun 5 01:38:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tremer X-Patchwork-Id: 1800 Return-Path: Received: from mail01.ipfire.org (mail01.ipfire.org [IPv6:2001:470:7183:25::1]) by web02.i.ipfire.org (Postfix) with ESMTP id 45D0E60B60 for ; Mon, 4 Jun 2018 17:38:43 +0200 (CEST) Received: from mail01.i.ipfire.org (localhost [IPv6:::1]) by mail01.ipfire.org (Postfix) with ESMTP id 2927D10F8B83; Mon, 4 Jun 2018 16:38:43 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=201801; t=1528126723; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references:list-id:list-unsubscribe:list-subscribe:list-post; bh=qkHG24MDpAc4dAzQHmOdfvRNH5Yx/pd7Wn6GkoJeoOw=; b=u7+qer8G14Z+rirk1oGLciU34+UmsEl/IQQ4q6aoUi5Ja+knuX7hoCcB5zro2D+2LIXsWN YQdEoPYTo8+bxjPB8VA5yHsFsz31m/VjbYCZP7G+NwwF2uoXuHbyq9SR/ExyDpoJw77K+4 xN/aom5d9YnuxmSDQ0UI5DDFE9hm8QRTKUqxyr6OKkbBz5S7oEuzoCSxYz36Ly7z2n++KN xOMqt5+8WWYjycCKZkas4eOogv8fZ2wEVHB8sdtDJpLVMrCuCPIReu45OFXAgJM0gWO1au RS/bv1axrc1fHbT6jiUZmpvEErtE8jwwJbhyFd9Gx+FCBrzaRSATjOExI0aInQ== Authentication-Results: mail01.i.ipfire.org; auth=pass smtp.auth=ms smtp.mailfrom=michael.tremer@ipfire.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=201801; t=1528126719; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=qkHG24MDpAc4dAzQHmOdfvRNH5Yx/pd7Wn6GkoJeoOw=; b=M01ZCZFwzhw63ZdrXchVlFhG+7hABp0UHMeUxc3zBrJoPr26y4Wk2XMp0EM6yIVm6kTUnE JlD/QBS96vuOcVwOzlOgubzXOZwR9hYx2gGvCGpnaAappafO24KrRdqLr/6Up5Y4J+lGl4 NT+cjLvb3Drb+MipYcAur+jqPSL0NvkmhOpVjqPZY8f1iSE7THiDNY8leDubv8gZL/42W7 1murVzwqFpCgLx1F7brqooP4bfWHEaPhkIEw2Z14mrj6Shx8NyocLLknudrhpoi9hlilQk epLH8HKsy5GLW/wPdLOEr4iHrQr2jtjV7MXLdTwy7tqT1xUBzxhcDfjkXIfe8w== Received: from rice-oxley.tremer.co.uk (unknown [88.98.219.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mail01.ipfire.org (Postfix) with ESMTPSA id C049910D19E3; Mon, 4 Jun 2018 16:38:39 +0100 (BST) From: Michael Tremer To: network@lists.ipfire.org Subject: [PATCH 6/7] NITSI: Automatically download required images Date: Mon, 4 Jun 2018 16:38:31 +0100 Message-Id: <20180604153832.331239-6-michael.tremer@ipfire.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180604153832.331239-1-michael.tremer@ipfire.org> References: <20180604153832.331239-1-michael.tremer@ipfire.org> X-Spamd-Result: default: False [-7.07 / 11.00]; ASN(0.00)[asn:56478, ipnet:88.98.216.0/22, country:GB]; DKIM_SIGNED(0.00)[]; TO_DN_SOME(0.00)[]; FROM_HAS_DN(0.00)[]; RCVD_TLS_ALL(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; ARC_NA(0.00)[]; BAYES_HAM(-3.00)[100.00%]; FROM_EQ_ENVFROM(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MID_CONTAINS_FROM(1.00)[]; RCVD_COUNT_ZERO(0.00)[0]; MIME_GOOD(-0.10)[text/plain]; NEURAL_HAM(-2.97)[-0.991,0]; REPLY(-2.00)[] X-Spam-Status: No, score=-7.07 X-Rspamd-Server: mail01.i.ipfire.org Cc: Michael Tremer X-BeenThere: network@lists.ipfire.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List for the network package List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: network-bounces@lists.ipfire.org Sender: "network" This patch lets make automatically download all required images and extracts them. Signed-off-by: Michael Tremer Signed-off-by: Michael Tremer <michael.tremer@ipfire.org> --- Makefile.am | 40 +++++++++++++++++-- configure.ac | 1 + test/nitsi/virtual-environment/.gitignore | 1 + .../basic/machines/.gitignore | 1 + .../alice/{machine.xml => machine.xml.in} | 2 +- .../snapshot.xml => alice/snapshot.xml.in} | 2 +- .../bob/{machine.xml => machine.xml.in} | 2 +- .../snapshot.xml => bob/snapshot.xml.in} | 2 +- 8 files changed, 44 insertions(+), 7 deletions(-) create mode 100644 test/nitsi/virtual-environment/.gitignore create mode 100644 test/nitsi/virtual-environment/basic/machines/.gitignore rename test/nitsi/virtual-environment/basic/machines/alice/{machine.xml => machine.xml.in} (98%) rename test/nitsi/virtual-environment/basic/machines/{bob/snapshot.xml => alice/snapshot.xml.in} (69%) rename test/nitsi/virtual-environment/basic/machines/bob/{machine.xml => machine.xml.in} (98%) rename test/nitsi/virtual-environment/basic/machines/{alice/snapshot.xml => bob/snapshot.xml.in} (70%) diff --git a/Makefile.am b/Makefile.am index 06b6cddd2b74..f4b8ba13dbea 100644 --- a/Makefile.am +++ b/Makefile.am @@ -89,6 +89,10 @@ INSTALL_EXEC_HOOKS += \ # ------------------------------------------------------------------------------ +AM_V_DOWNLOAD = $(AM_V_DOWNLOAD_$(V)) +AM_V_DOWNLOAD_ = $(AM_V_DOWNLOAD_$(AM_DEFAULT_VERBOSITY)) +AM_V_DOWNLOAD_0 = @echo " LOAD " $@; + AM_V_NITSI = $(AM_V_NITSI_$(V)) AM_V_NITSI_ = $(AM_V_NITSI_$(AM_DEFAULT_VERBOSITY)) AM_V_NITSI_0 = @echo " NITSI " $@; @@ -496,7 +500,8 @@ substitutions = \ '|sbindir=$(sbindir)|' \ '|networkdir=$(networkdir)|' \ '|helpersdir=$(helpersdir)|' \ - '|utildir=$(utildir)|' + '|utildir=$(utildir)|' \ + '|VIRTUAL_ENVIRONMENT_IMAGES_DIR=$(VIRTUAL_ENVIRONMENT_IMAGES_DIR)|' SED_PROCESS = \ $(AM_V_GEN)$(MKDIR_P) $(dir $@) && \ @@ -543,7 +548,7 @@ TESTS = \ # - NITSI tests ---------------------------------------------------------------- # Files for the virtual environment -EXTRA_DIST += \ +VIRTUAL_ENVIRONMENT_FILES = \ test/nitsi/virtual-environment/basic/machines/alice/machine.xml \ test/nitsi/virtual-environment/basic/machines/alice/snapshot.xml \ test/nitsi/virtual-environment/basic/machines/bob/machine.xml \ @@ -555,6 +560,30 @@ EXTRA_DIST += \ test/nitsi/virtual-environment/basic/README \ test/nitsi/virtual-environment/basic/settings +EXTRA_DIST += \ + test/nitsi/virtual-environment/basic/machines/alice/machine.xml.in \ + test/nitsi/virtual-environment/basic/machines/alice/snapshot.xml.in \ + test/nitsi/virtual-environment/basic/machines/bob/machine.xml.in \ + test/nitsi/virtual-environment/basic/machines/bob/snapshot.xml.in + +CLEANFILES += \ + test/nitsi/virtual-environment/basic/machines/alice/machine.xml \ + test/nitsi/virtual-environment/basic/machines/alice/snapshot.xml \ + test/nitsi/virtual-environment/basic/machines/bob/machine.xml \ + test/nitsi/virtual-environment/basic/machines/bob/snapshot.xml + +# Virtual Machine Images +VIRTUAL_ENVIRONMENT_IMAGES = \ + $(VIRTUAL_ENVIRONMENT_IMAGES_DIR)/ipfire-alice-2.qcow2 \ + $(VIRTUAL_ENVIRONMENT_IMAGES_DIR)/ipfire-bob.qcow2 + +DISTCLEANFILES += \ + $(VIRTUAL_ENVIRONMENT_IMAGES) + +VIRTUAL_ENVIRONMENT_IMAGES_DIR = $(abs_builddir)/test/nitsi/virtual-environment/.images +VIRTUAL_ENVIRONMENT_IMAGES_DOWNLOAD_URL = \ + https://people.ipfire.org/~jschlag/nitsi-ipfire/virtual-environment/basic/ + NITSI_TESTS = \ test/nitsi/test/hello-world \ test/nitsi/test/make-check @@ -572,8 +601,13 @@ CLEANFILES += \ NITSI_ENVIRONMENT = .PHONY: $(NITSI_TESTS) -$(NITSI_TESTS): % : %/recipe %/settings +$(NITSI_TESTS): % : %/recipe %/settings $(VIRTUAL_ENVIRONMENT_FILES) $(VIRTUAL_ENVIRONMENT_IMAGES) $(AM_V_NITSI) $(NITSI_ENVIRONMENT) $(NITSI) --log-level error -d $@ .PHONY: nitsi nitsi: dist $(NITSI_TESTS) + +# Downloads a virtual image file and extracts it +$(VIRTUAL_ENVIRONMENT_IMAGES): + $(AM_V_DOWNLOAD)$(MKDIR_P) $(dir $@) && \ + $(WGET) -qO - $(VIRTUAL_ENVIRONMENT_IMAGES_DOWNLOAD_URL)/$(notdir $@).xz | xz -qd > $@ diff --git a/configure.ac b/configure.ac index 515941451aba..e84bec7d284a 100644 --- a/configure.ac +++ b/configure.ac @@ -51,6 +51,7 @@ AC_PROG_MKDIR_P AC_PROG_SED AC_PATH_PROG([NITSI], [nitsi]) +AC_PATH_PROG([WGET], [wget]) AC_PATH_PROG([XSLTPROC], [xsltproc]) # pkg-config diff --git a/test/nitsi/virtual-environment/.gitignore b/test/nitsi/virtual-environment/.gitignore new file mode 100644 index 000000000000..5a345eca37b4 --- /dev/null +++ b/test/nitsi/virtual-environment/.gitignore @@ -0,0 +1 @@ +/.images diff --git a/test/nitsi/virtual-environment/basic/machines/.gitignore b/test/nitsi/virtual-environment/basic/machines/.gitignore new file mode 100644 index 000000000000..89b260551efd --- /dev/null +++ b/test/nitsi/virtual-environment/basic/machines/.gitignore @@ -0,0 +1 @@ +*/*.xml diff --git a/test/nitsi/virtual-environment/basic/machines/alice/machine.xml b/test/nitsi/virtual-environment/basic/machines/alice/machine.xml.in similarity index 98% rename from test/nitsi/virtual-environment/basic/machines/alice/machine.xml rename to test/nitsi/virtual-environment/basic/machines/alice/machine.xml.in index 5f5b4aca5017..be8da3886021 100644 --- a/test/nitsi/virtual-environment/basic/machines/alice/machine.xml +++ b/test/nitsi/virtual-environment/basic/machines/alice/machine.xml.in @@ -28,7 +28,7 @@ - +
diff --git a/test/nitsi/virtual-environment/basic/machines/bob/snapshot.xml b/test/nitsi/virtual-environment/basic/machines/alice/snapshot.xml.in similarity index 69% rename from test/nitsi/virtual-environment/basic/machines/bob/snapshot.xml rename to test/nitsi/virtual-environment/basic/machines/alice/snapshot.xml.in index a8311a261fea..8d2d1c05f5ad 100644 --- a/test/nitsi/virtual-environment/basic/machines/bob/snapshot.xml +++ b/test/nitsi/virtual-environment/basic/machines/alice/snapshot.xml.in @@ -2,7 +2,7 @@ Snapshot to undo all changes from this test no - + diff --git a/test/nitsi/virtual-environment/basic/machines/bob/machine.xml b/test/nitsi/virtual-environment/basic/machines/bob/machine.xml.in similarity index 98% rename from test/nitsi/virtual-environment/basic/machines/bob/machine.xml rename to test/nitsi/virtual-environment/basic/machines/bob/machine.xml.in index 60682112db17..f314e8edc5aa 100644 --- a/test/nitsi/virtual-environment/basic/machines/bob/machine.xml +++ b/test/nitsi/virtual-environment/basic/machines/bob/machine.xml.in @@ -28,7 +28,7 @@ - +
diff --git a/test/nitsi/virtual-environment/basic/machines/alice/snapshot.xml b/test/nitsi/virtual-environment/basic/machines/bob/snapshot.xml.in similarity index 70% rename from test/nitsi/virtual-environment/basic/machines/alice/snapshot.xml rename to test/nitsi/virtual-environment/basic/machines/bob/snapshot.xml.in index fff9b97752e0..f15d19adc5d2 100644 --- a/test/nitsi/virtual-environment/basic/machines/alice/snapshot.xml +++ b/test/nitsi/virtual-environment/basic/machines/bob/snapshot.xml.in @@ -2,7 +2,7 @@ Snapshot to undo all changes from this test no - +