Skip to content

Commit 527e0ee

Browse files
committed
Add simple test using kyua
1 parent 367581e commit 527e0ee

File tree

3 files changed

+45
-0
lines changed

3 files changed

+45
-0
lines changed

Makefile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
2+
check: lddtree.sh tests/Kyuafile Kyuafile
3+
kyua test || (kyua report --verbose && exit 1)
4+
5+
tests/Kyuafile: $(wildcard tests/*_test)
6+
echo "syntax(2)" > $@.tmp
7+
echo 'test_suite("lddtree")' >> $@.tmp
8+
for i in $(notdir $(wildcard tests/*_test)); do \
9+
echo "atf_test_program{name='$$i',timeout=5}" >> $@.tmp ; \
10+
done
11+
mv $@.tmp $@
12+
13+
Kyuafile:
14+
echo "syntax(2)" > $@.tmp
15+
echo "test_suite('alpine-conf')" >> $@.tmp
16+
echo "include('tests/Kyuafile')" >> $@.tmp
17+
mv $@.tmp $@
18+

tests/lddtree_test

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env atf-sh
2+
3+
. $(atf_get_srcdir)/test_env.sh
4+
5+
init_tests \
6+
lddtree_usage
7+
8+
lddtree_usage_body() {
9+
atf_check -o match:"Usage:" lddtree.sh -h
10+
atf_check -s exit:1 -e match:"Usage:" lddtree.sh
11+
}
12+

tests/test_env.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
PATH=$(atf_get_srcdir)/..:$PATH
2+
3+
init_tests() {
4+
TESTS="$@"
5+
export TESTS
6+
for t; do
7+
atf_test_case $t
8+
done
9+
}
10+
11+
atf_init_test_cases() {
12+
for t in $TESTS; do
13+
atf_add_test_case $t
14+
done
15+
}

0 commit comments

Comments
 (0)