From 6c8a073fb2e3ed90843cc2cd67c3a38edfa77812 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Tue, 6 May 2014 11:16:00 +0200 Subject: [PATCH] tests: new test for xbps-query(8) -Rf when binpkg is not available. --- tests/xbps/Makefile | 2 +- tests/xbps/common/Kyuafile | 1 + tests/xbps/xbps-query/Kyuafile | 4 ++++ tests/xbps/xbps-query/Makefile | 8 ++++++++ tests/xbps/xbps-query/remote_test.sh | 28 ++++++++++++++++++++++++++++ 5 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 tests/xbps/xbps-query/Kyuafile create mode 100644 tests/xbps/xbps-query/Makefile create mode 100644 tests/xbps/xbps-query/remote_test.sh diff --git a/tests/xbps/Makefile b/tests/xbps/Makefile index 7446b80a..cfecace2 100644 --- a/tests/xbps/Makefile +++ b/tests/xbps/Makefile @@ -1,5 +1,5 @@ -include ../../config.mk -SUBDIRS = common libxbps xbps-rindex +SUBDIRS = common libxbps xbps-query xbps-rindex include ../../mk/subdir.mk diff --git a/tests/xbps/common/Kyuafile b/tests/xbps/common/Kyuafile index f23f4332..2108b192 100644 --- a/tests/xbps/common/Kyuafile +++ b/tests/xbps/common/Kyuafile @@ -3,4 +3,5 @@ syntax("kyuafile", 1) test_suite("xbps") include('libxbps/Kyuafile') +include('xbps-query/Kyuafile') include('xbps-rindex/Kyuafile') diff --git a/tests/xbps/xbps-query/Kyuafile b/tests/xbps/xbps-query/Kyuafile new file mode 100644 index 00000000..5ef044ed --- /dev/null +++ b/tests/xbps/xbps-query/Kyuafile @@ -0,0 +1,4 @@ +syntax("kyuafile", 1) + +test_suite("xbps-query") +atf_test_program{name="remote_test"} diff --git a/tests/xbps/xbps-query/Makefile b/tests/xbps/xbps-query/Makefile new file mode 100644 index 00000000..0886a4b9 --- /dev/null +++ b/tests/xbps/xbps-query/Makefile @@ -0,0 +1,8 @@ +TOPDIR = ../../.. +-include $(TOPDIR)/config.mk + +TESTSHELL = remote_test +TESTSSUBDIR = xbps/xbps-query +EXTRA_FILES = Kyuafile + +include $(TOPDIR)/mk/test.mk diff --git a/tests/xbps/xbps-query/remote_test.sh b/tests/xbps/xbps-query/remote_test.sh new file mode 100644 index 00000000..f12f119b --- /dev/null +++ b/tests/xbps/xbps-query/remote_test.sh @@ -0,0 +1,28 @@ +#! /usr/bin/env atf-sh +# Test that xbps-query(8) remote modes work as expected + +# 1st test: test that -Rf does not segfault when binpkg is not available +atf_test_case remote_files + +remote_files_head() { + atf_set "descr" "xbps-query(8) -Rf: binpkg files test" +} + +remote_files_body() { + mkdir -p some_repo pkg_A/bin + touch pkg_A/bin/file + cd some_repo + xbps-create -A noarch -n foo-1.0_1 -s "foo pkg" ../pkg_A + atf_check_equal $? 0 + xbps-rindex -a *.xbps + atf_check_equal $? 0 + rm -f *.xbps + cd .. + xbps-query -C empty.conf --repository=some_repo -f foo-1.0_1 + # ENOENT is ok because binpkg does not exist + atf_check_equal $? 2 +} + +atf_init_test_cases() { + atf_add_test_case remote_files +}