From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Tremer To: network@lists.ipfire.org Subject: [PATCH 6/7] NITSI: Automatically download required images Date: Mon, 04 Jun 2018 16:38:31 +0100 Message-ID: <20180604153832.331239-6-michael.tremer@ipfire.org> In-Reply-To: <20180604153832.331239-1-michael.tremer@ipfire.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============9106848205992195712==" List-Id: --===============9106848205992195712== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable This patch lets make automatically download all required images and extracts them. Signed-off-by: Michael Tremer --- Makefile.am | 40 +++++++++++++++++-- configure.ac | 1 + test/nitsi/virtual-environment/.gitignore | 1 + .../basic/machines/.gitignore | 1 + .../alice/{machine.xml =3D> machine.xml.in} | 2 +- .../snapshot.xml =3D> alice/snapshot.xml.in} | 2 +- .../bob/{machine.xml =3D> machine.xml.in} | 2 +- .../snapshot.xml =3D> 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 =3D>= machine.xml.in} (98%) rename test/nitsi/virtual-environment/basic/machines/{bob/snapshot.xml =3D> = alice/snapshot.xml.in} (69%) rename test/nitsi/virtual-environment/basic/machines/bob/{machine.xml =3D> m= achine.xml.in} (98%) rename test/nitsi/virtual-environment/basic/machines/{alice/snapshot.xml =3D= > 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 +=3D \ =20 # --------------------------------------------------------------------------= ---- =20 +AM_V_DOWNLOAD =3D $(AM_V_DOWNLOAD_$(V)) +AM_V_DOWNLOAD_ =3D $(AM_V_DOWNLOAD_$(AM_DEFAULT_VERBOSITY)) +AM_V_DOWNLOAD_0 =3D @echo " LOAD " $@; + AM_V_NITSI =3D $(AM_V_NITSI_$(V)) AM_V_NITSI_ =3D $(AM_V_NITSI_$(AM_DEFAULT_VERBOSITY)) AM_V_NITSI_0 =3D @echo " NITSI " $@; @@ -496,7 +500,8 @@ substitutions =3D \ '|sbindir=3D$(sbindir)|' \ '|networkdir=3D$(networkdir)|' \ '|helpersdir=3D$(helpersdir)|' \ - '|utildir=3D$(utildir)|' + '|utildir=3D$(utildir)|' \ + '|VIRTUAL_ENVIRONMENT_IMAGES_DIR=3D$(VIRTUAL_ENVIRONMENT_IMAGES_DIR)|' =20 SED_PROCESS =3D \ $(AM_V_GEN)$(MKDIR_P) $(dir $@) && \ @@ -543,7 +548,7 @@ TESTS =3D \ # - NITSI tests ------------------------------------------------------------= ---- =20 # Files for the virtual environment -EXTRA_DIST +=3D \ +VIRTUAL_ENVIRONMENT_FILES =3D \ 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 +=3D \ test/nitsi/virtual-environment/basic/README \ test/nitsi/virtual-environment/basic/settings =20 +EXTRA_DIST +=3D \ + 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 +=3D \ + 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 =3D \ + $(VIRTUAL_ENVIRONMENT_IMAGES_DIR)/ipfire-alice-2.qcow2 \ + $(VIRTUAL_ENVIRONMENT_IMAGES_DIR)/ipfire-bob.qcow2 + +DISTCLEANFILES +=3D \ + $(VIRTUAL_ENVIRONMENT_IMAGES) + +VIRTUAL_ENVIRONMENT_IMAGES_DIR =3D $(abs_builddir)/test/nitsi/virtual-enviro= nment/.images +VIRTUAL_ENVIRONMENT_IMAGES_DOWNLOAD_URL =3D \ + https://people.ipfire.org/~jschlag/nitsi-ipfire/virtual-environment/basic/ + NITSI_TESTS =3D \ test/nitsi/test/hello-world \ test/nitsi/test/make-check @@ -572,8 +601,13 @@ CLEANFILES +=3D \ NITSI_ENVIRONMENT =3D =20 .PHONY: $(NITSI_TESTS) -$(NITSI_TESTS): % : %/recipe %/settings +$(NITSI_TESTS): % : %/recipe %/settings $(VIRTUAL_ENVIRONMENT_FILES) $(VIRTU= AL_ENVIRONMENT_IMAGES) $(AM_V_NITSI) $(NITSI_ENVIRONMENT) $(NITSI) --log-level error -d $@ =20 .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 =20 AC_PATH_PROG([NITSI], [nitsi]) +AC_PATH_PROG([WGET], [wget]) AC_PATH_PROG([XSLTPROC], [xsltproc]) =20 # pkg-config diff --git a/test/nitsi/virtual-environment/.gitignore b/test/nitsi/virtual-e= nvironment/.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 - + --=20 2.17.0 --===============9106848205992195712==--