1
0
Fork 0
mirror of https://github.com/JasonN3/build-container-installer.git synced 2025-12-25 10:57:55 +01:00

add test for flatpaks installed

This commit is contained in:
Jason N. 2024-03-14 21:59:17 -04:00
parent 3dc05c0efc
commit 9277acf58a
3 changed files with 65 additions and 13 deletions

View file

@ -32,6 +32,11 @@ PACKAGE_MANAGER = dnf
get_templates = $(shell ls lorax_templates/$(1)_*.tmpl) \
$(foreach file,$(notdir $(shell ls lorax_templates/scripts/post/$(1)_*)),lorax_templates/post_$(file).tmpl)
# Get a list of tests for the feature
# $1 = test type
# $2 = feature
get_tests = $(shell ls tests/$(1)/$(2)_*)
# Converts a post script to a template
# $1 = script to convert
# $2 = file on ISO to write
@ -218,7 +223,6 @@ install-test-deps:
test: test-iso test-vm
test-iso:
$(eval _TESTS = $(filter-out README.md,$(shell ls tests/iso)))
$(eval _VARS = VERSION FLATPAK_REMOTE_NAME _FLATPAK_REPO_URL)
sudo modprobe loop
@ -227,20 +231,20 @@ test-iso:
sudo mount -t squashfs -o loop /mnt/iso/images/install.img /mnt/install
# install tests
chmod +x $(foreach test,$(filter install_%,$(_TESTS)),tests/iso/$(test))
for test in $(_TESTS); \
chmod +x $(call get_tests,iso,install)
for test in $(call get_tests,iso,install); \
do \
$(foreach var,$(_VARS),$(var)=$($(var))) ./tests/iso/$${test}; \
$(foreach var,$(_VARS),$(var)=$($(var))) ./$${test}; \
done
# flapak tests
if [ -n "$(FLATPAK_REMOTE_REFS)" ]; \
then \
chmod +x $(foreach test,$(filter flatpak_%,$(_TESTS)),tests/iso/$(test)); \
for test in $(_TESTS); \
do \
$(foreach var,$(_VARS),$(var)=$($(var))) ./tests/iso/$${test}; \
done; \
chmod +x $(call get_tests,iso,flatpak); \
for test in $(call get_tests,iso,flatpak); \
do \
$(foreach var,$(_VARS),$(var)=$($(var))) ./$${test}; \
done; \
fi
# Cleanup
@ -260,8 +264,22 @@ ansible_inventory:
test-vm: ansible_inventory
ansible -i ansible_inventory -m ansible.builtin.wait_for_connection vm
$(eval _TESTS = $(filter-out README.md,$(shell ls tests/vm)))
chmod +x $(foreach test,$(_TESTS),tests/vm/$(test))
for test in $(_TESTS); do ./tests/vm/$${test}; done
# install tests
chmod +x $(call get_tests,vm,install)
for test in $(call get_tests,vm,install); \
do \
./$${test}; \
done
# flapak tests
if [ -n "$(FLATPAK_REMOTE_REFS)" ]; \
then \
chmod +x $(call get_tests,iso,flatpak); \
for test in $(call get_tests,iso,flatpak); \
do \
$(foreach var,$(_VARS),$(var)=$($(var))) ./$${test}; \
done; \
fi
.PHONY: clean install-deps install-test-deps test test-iso test-vm