From b9ce711848221a511e68aae9b656710df641ae51 Mon Sep 17 00:00:00 2001 From: Enno Boland Date: Mon, 21 Mar 2016 11:22:42 +0100 Subject: [PATCH] tests: add tests to ensure that packages in stage are not removed --- tests/xbps/xbps-rindex/Kyuafile | 1 + tests/xbps/xbps-rindex/Makefile | 2 +- tests/xbps/xbps-rindex/remove_test.sh | 39 +++++++++++++++++++++++++++ 3 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 tests/xbps/xbps-rindex/remove_test.sh diff --git a/tests/xbps/xbps-rindex/Kyuafile b/tests/xbps/xbps-rindex/Kyuafile index f5061b05..149df6f4 100644 --- a/tests/xbps/xbps-rindex/Kyuafile +++ b/tests/xbps/xbps-rindex/Kyuafile @@ -3,3 +3,4 @@ syntax("kyuafile", 1) test_suite("xbps-rindex") atf_test_program{name="add_test"} atf_test_program{name="clean_test"} +atf_test_program{name="remove_test"} diff --git a/tests/xbps/xbps-rindex/Makefile b/tests/xbps/xbps-rindex/Makefile index 6456ed9b..ca28e3ad 100644 --- a/tests/xbps/xbps-rindex/Makefile +++ b/tests/xbps/xbps-rindex/Makefile @@ -1,7 +1,7 @@ TOPDIR = ../../.. -include $(TOPDIR)/config.mk -TESTSHELL = add_test clean_test +TESTSHELL = add_test clean_test remove_test TESTSSUBDIR = xbps/xbps-rindex EXTRA_FILES = Kyuafile diff --git a/tests/xbps/xbps-rindex/remove_test.sh b/tests/xbps/xbps-rindex/remove_test.sh new file mode 100644 index 00000000..af6f6244 --- /dev/null +++ b/tests/xbps/xbps-rindex/remove_test.sh @@ -0,0 +1,39 @@ +#! /usr/bin/env atf-sh +# Test that xbps-rindex(8) -c (clean mode) works as expected. + +# 1st test: make sure that nothing is removed if there are no changes. +atf_test_case noremove_stage + +noremove_stage_head() { + atf_set "descr" "xbps-rindex(8) -r: don't removing if there's staging test" +} + +noremove_stage_body() { + mkdir -p some_repo pkg_A pkg_B + cd some_repo + xbps-create -A noarch -n foo-1.0_1 -s "foo pkg" --shlib-provides "foo.so.1" ../pkg_A + atf_check_equal $? 0 + xbps-create -A noarch -n bar-1.0_1 -s "foo pkg" --shlib-requires "foo.so.1" ../pkg_B + atf_check_equal $? 0 + xbps-rindex -d -a $PWD/*.xbps + atf_check_equal $? 0 + xbps-create -A noarch -n foo-1.1_1 -s "foo pkg" --shlib-provides "foo.so.2" ../pkg_A + atf_check_equal $? 0 + xbps-rindex -d -a $PWD/*.xbps + atf_check_equal $? 0 + [ -f *-stagedata ] + atf_check_equal $? 0 + xbps-rindex -r some_repo + atf_check_equal $? 0 + cd some_repo + [ -f foo-1.0_1* ] + atf_check_equal $? 0 + [ -f foo-1.1_1* ] + atf_check_equal $? 0 + [ -f bar-1.0_1* ] + atf_check_equal $? 0 +} + +atf_init_test_cases() { + atf_add_test_case noremove_stage +}