summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2022-05-12 09:05:25 +0200
committerNatanael Copa <ncopa@alpinelinux.org>2022-05-12 09:25:13 +0200
commit3a283f2fa4c2e95ad7ca75db7fde522347e17fd1 (patch)
tree3a090473fa4d6cefeffdfe5adba2e45bb15cc7d7
parent1a7ccfcaa23df7709f9b0e55c3751cb4a77712ed (diff)
downloadalpine-conf-3a283f2fa4c2e95ad7ca75db7fde522347e17fd1.zip
Generate the Kyuafiles from makefile
-rw-r--r--.gitignore7
-rw-r--r--Kyuafile5
-rw-r--r--Makefile19
-rw-r--r--tests/Kyuafile6
-rwxr-xr-xtests/setup_keymap_test23
5 files changed, 43 insertions, 17 deletions
diff --git a/.gitignore b/.gitignore
index d2aef61..8725479 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,7 +1,8 @@
-*.tar.gz
-lbu
*.sh
+*.tar.gz
+Kyuafile
copy-modloop
+lbu
setup-acf
setup-ads
setup-alpine
@@ -26,6 +27,6 @@ setup-sshd
setup-timezone
setup-xen-dom0
setup-xorg-base
+uniso
update-conf
update-kernel
-uniso
diff --git a/Kyuafile b/Kyuafile
deleted file mode 100644
index bb1c24a..0000000
--- a/Kyuafile
+++ /dev/null
@@ -1,5 +0,0 @@
-syntax(2)
-
-test_suite('alpine-conf')
-
-include('tests/Kyuafile')
diff --git a/Makefile b/Makefile
index 9fdec11..a88af45 100644
--- a/Makefile
+++ b/Makefile
@@ -62,7 +62,7 @@ SED_REPLACE := -e 's:@VERSION@:$(FULL_VERSION):g' \
${SED} ${SED_REPLACE} ${SED_EXTRA} $< > $@ && chmod +x $@
.PHONY: all apk clean install uninstall iso
-all: $(SCRIPTS) $(BIN_FILES)
+all: $(SCRIPTS) $(BIN_FILES) Kyuafile tests/Kyuafile
uniso: uniso.c
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^
@@ -94,7 +94,7 @@ uninstall:
done
clean:
- rm -rf $(SCRIPTS) $(BIN_FILES) alpine-conf.iso
+ rm -rf $(SCRIPTS) $(BIN_FILES) alpine-conf.iso tests/Kyuafile Kyuafile
alpine-conf.iso: $(SCRIPTS) $(BIN_FILES)
$(MAKE) install PREFIX=/ DESTDIR=tmp/
@@ -102,5 +102,18 @@ alpine-conf.iso: $(SCRIPTS) $(BIN_FILES)
iso: alpine-conf.iso
-test: $(SCRIPTS) $(BIN_FILES)
+tests/Kyuafile: $(wildcard tests/*_test)
+ echo "syntax(2)" > $@
+ echo 'test_suite("alpine-conf")' >> $@
+ for i in $(notdir $(wildcard tests/*_test)); do \
+ echo "atf_test_program{name='$$i',timeout=1}" >> $@ ; \
+ done
+
+Kyuafile:
+ echo "syntax(2)" > $@
+ echo "test_suite('alpine-conf')" >> $@
+ echo "include('tests/Kyuafile')" >> $@
+
+test: $(SCRIPTS) $(BIN_FILES) tests/Kyuafile Kyuafile
kyua test || (kyua report --verbose && exit 1)
+
diff --git a/tests/Kyuafile b/tests/Kyuafile
deleted file mode 100644
index 784f1ab..0000000
--- a/tests/Kyuafile
+++ /dev/null
@@ -1,6 +0,0 @@
-syntax(2)
-
-test_suite('alpine-conf')
-
-atf_test_program{name='setup_sshd_test', timeout=1}
-atf_test_program{name='setup_hostname_test', timeout=1}
diff --git a/tests/setup_keymap_test b/tests/setup_keymap_test
new file mode 100755
index 0000000..641baf2
--- /dev/null
+++ b/tests/setup_keymap_test
@@ -0,0 +1,23 @@
+#!/usr/bin/env atf-sh
+
+init_env() {
+ PATH=$(atf_get_srcdir)/..:$PATH
+ export ROOT=$PWD LIBDIR=$(atf_get_srcdir)/.. MOCK=echo
+}
+
+# docs:
+# - https://github.com/jmmv/kyua/wiki/Quickstart-atf-sh-test
+# - https://manned.org/atf-sh-api
+
+atf_test_case setup_keymap_usage
+setup_keymap_usage_body() {
+ init_env
+ atf_check -s exit:0 \
+ -o match:'^usage: setup-keymap' \
+ -e empty \
+ setup-keymap -h
+}
+
+atf_init_test_cases() {
+ atf_add_test_case setup_keymap_usage
+}