]> git.proxmox.com Git - pve-installer.git/blobdiff - Makefile
build: run shellcheck as part of `test` step
[pve-installer.git] / Makefile
index e792e0e142666dc69d1794947ee467ce533ce387..af33e909494567a08f75394186bd050b4f51bedf 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -23,6 +23,13 @@ USR_BIN := proxmox-tui-installer
 COMPILED_BINS := \
        $(addprefix $(CARGO_COMPILEDIR)/,$(USR_BIN))
 
+SHELL_SCRIPTS := \
+       fake-start-stop-daemon \
+       policy-disable-rc.d \
+       spice-vdagent.sh \
+       unconfigured.sh \
+       xinitrc
+
 all:
 
 $(BUILDDIR):
@@ -36,17 +43,14 @@ $(BUILDDIR):
          banner/ \
          checktime \
          country.pl \
-         fake-start-stop-daemon \
          html/ \
          interfaces \
-         policy-disable-rc.d \
          proxinstall \
          proxmox-low-level-installer \
          proxmox-tui-installer/ \
          proxmox-installer-common/ \
-         spice-vdagent.sh \
-         unconfigured.sh \
-         xinitrc \
+         test/ \
+         $(SHELL_SCRIPTS) \
          $@.tmp
        cp -a debian $@.tmp/
        mv $@.tmp $@
@@ -76,7 +80,17 @@ $(DSC): $(BUILDDIR)
 sbuild: $(DSC)
        sbuild $(DSC)
 
-test:
+.PHONY: prepare-test-env
+prepare-test-env: cd-info.test country.dat test.img
+       rm -rf testdir
+       mkdir -p testdir/var/lib/proxmox-installer/
+       cp -v country.dat testdir/var/lib/proxmox-installer/
+       ./proxmox-low-level-installer -t test.img dump-env
+
+.PHONY: test
+test: prepare-test-env
+       shellcheck $(SHELL_SCRIPTS)
+       $(MAKE) -C test check
        $(CARGO) test --workspace $(CARGO_BUILD_ARGS)
 
 DESTDIR=
@@ -94,7 +108,7 @@ install: $(INSTALLER_SOURCES) $(CARGO_COMPILEDIR)/proxmox-tui-installer
        install -D -m 755 unconfigured.sh $(DESTDIR)/sbin/unconfigured.sh
        install -D -m 755 proxinstall $(DESTDIR)/usr/bin/proxinstall
        install -D -m 755 proxmox-low-level-installer $(DESTDIR)/$(BINDIR)/proxmox-low-level-installer
-       $(foreach i,$(USR_BIN), install -m755 $(CARGO_COMPILEDIR)/$(i) $(DESTDIR)$(BINDIR)/)
+       $(foreach i,$(USR_BIN), install -m755 $(CARGO_COMPILEDIR)/$(i) $(DESTDIR)$(BINDIR)/ ;)
        install -D -m 755 checktime $(DESTDIR)/usr/bin/checktime
        install -D -m 644 xinitrc $(DESTDIR)/.xinitrc
        install -D -m 755 spice-vdagent.sh $(DESTDIR)/.spice-vdagent.sh
@@ -136,26 +150,31 @@ cd-info.test:
 
 check-pve: prepare-check-env test.img
        rm -f cd-info.test; $(MAKE) cd-info.test
-       ./proxmox-low-level-installer dump-env -t
+       ./proxmox-low-level-installer dump-env -t test.img
        G_SLICE=always-malloc perl -I testdir/usr/share/perl5 testdir/usr/bin/proxinstall -t test.img
 
 check-pve-multidisks: prepare-check-env test.img test2.img test3.img test4.img test5.big.img
        rm -f cd-info.test; $(MAKE) cd-info.test
-       ./proxmox-low-level-installer dump-env -t
+       ./proxmox-low-level-installer dump-env -t test.img,test2.img,test3.img,test4.img,test5.big.img
        G_SLICE=always-malloc perl -I testdir/usr/share/perl5 testdir/usr/bin/proxinstall -t test.img,test2.img,test3.img,test4.img,test5.big.img
 
 check-pve-tui: prepare-check-env test.img
        rm -f cd-info.test; $(MAKE) cd-info.test
-       ./proxmox-low-level-installer dump-env -t
+       ./proxmox-low-level-installer dump-env -t test.img
        testdir/usr/bin/proxmox-tui-installer -t test.img 2>testdir/run/stderr
 
+check-pve-tui-multidisks: prepare-check-env test.img test2.img test3.img test4.img test5.big.img
+       rm -f cd-info.test; $(MAKE) cd-info.test
+       ./proxmox-low-level-installer dump-env -t test.img,test2.img,test3.img,test4.img,test5.big.img
+       testdir/usr/bin/proxmox-tui-installer -t test.img,test2.img,test3.img,test4.img,test5.big.img
+
 prepare-check-pmg: prepare-check-env test.img
        rm -f cd-info.test; $(MAKE) \
            PRODUCT=pmg \
            PRODUCTLONG="Proxmox Mail Gateway" \
            ISONAME='proxmox-mail-gateway' \
            cd-info.test
-       ./proxmox-low-level-installer dump-env -t
+       ./proxmox-low-level-installer dump-env -t test.img
 
 check-pmg: prepare-check-pmg
        G_SLICE=always-malloc perl -I testdir/usr/share/perl5 testdir/usr/bin/proxinstall -t test.img
@@ -169,7 +188,7 @@ prepare-check-pbs: prepare-check-env test.img
            PRODUCTLONG='Proxmox Backup Server' \
            ISONAME='proxmox-backup-server' \
            cd-info.test
-       ./proxmox-low-level-installer dump-env -t
+       ./proxmox-low-level-installer dump-env -t test.img
 
 check-pbs: prepare-check-pbs
        G_SLICE=always-malloc perl -I testdir/usr/share/perl5 testdir/usr/bin/proxinstall -t test.img