Added an ATF test-case for issue #19.

This commit is contained in:
Juan RP 2013-11-02 11:44:54 +01:00
parent 616d4420d2
commit 4e4e4a49d0
8 changed files with 72 additions and 1 deletions

View File

@ -5,6 +5,7 @@ all: $(TEST)
.PHONY: clean
clean:
-rm -f $(TEST)
.PHONY: install
install: all

View File

@ -1,5 +1,5 @@
-include ../config.mk
SUBDIRS = libxbps
SUBDIRS = libxbps xbps-rindex
include ../mk/subdir.mk

View File

@ -0,0 +1,5 @@
-include ../../config.mk
SUBDIRS = common issue19
include ../../mk/subdir.mk

View File

@ -0,0 +1 @@
TESTSSUBDIR = xbps-rindex

View File

@ -0,0 +1,4 @@
syntax("kyuafile", 1)
test_suite("xbps-rindex")
atf_test_program{name="issue19_test"}

View File

@ -0,0 +1,15 @@
TOPDIR = ../../..
-include $(TOPDIR)/config.mk
include ../Makefile.inc
all:
install:
install -d $(DESTDIR)$(TESTSDIR)/$(TESTSSUBDIR)
install -m644 Kyuafile $(DESTDIR)$(TESTSDIR)/$(TESTSSUBDIR)
uninstall:
-rm -f $(DESTDIR)$(TESTSDIR)/$(TESTSSUBDIR)/Kyuafile
clean:

View File

@ -0,0 +1,7 @@
TOPDIR = ../../..
-include $(TOPDIR)/config.mk
TEST = issue19_test
include ../Makefile.inc
include $(TOPDIR)/mk/test-shell.mk

View File

@ -0,0 +1,38 @@
#! /usr/bin/env atf-sh
# xbps issue #19.
# How to reproduce it:
# Generate pkg foo-1.0_1.
# Add it to the index of a local repo.
# Remove the pkg file from the repo.
# Run xbps-rindex -c on the repo.
atf_test_case issue19
issue19_head() {
atf_set "descr" "xbps issue #19 (https://github.com/xtraeme/xbps/issues/19)"
}
issue19_body() {
mkdir -p some_repo
cd some_repo
xbps-create -A noarch -n foo-1.0_1 -s "foo pkg" .
atf_check_equal $? 0
xbps-rindex -a *.xbps
atf_check_equal $? 0
cd ..
rm some_repo/*.xbps
xbps-rindex -c some_repo
atf_check_equal $? 0
result=$(xbps-query --repository=some_repo -s foo)
test -z "${result}"
atf_check_equal $? 0
}
issue19_cleanup() {
rm -rf some_repo
}
atf_init_test_cases() {
atf_add_test_case issue19
}