From f50a5df3c2a405934f4dc8822e6e898e8c76a436 Mon Sep 17 00:00:00 2001 From: Enno Boland Date: Sun, 28 Sep 2014 22:18:49 +0200 Subject: [PATCH] tests: add test case for reverts which simulates a full workflow. --- tests/xbps/xbps-install/Kyuafile | 1 + tests/xbps/xbps-install/Makefile | 2 +- tests/xbps/xbps-install/revert_tests.sh | 50 +++++++++++++++++++++++++ 3 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 tests/xbps/xbps-install/revert_tests.sh diff --git a/tests/xbps/xbps-install/Kyuafile b/tests/xbps/xbps-install/Kyuafile index e15dd06c..b50c3d88 100644 --- a/tests/xbps/xbps-install/Kyuafile +++ b/tests/xbps/xbps-install/Kyuafile @@ -2,3 +2,4 @@ syntax("kyuafile", 1) test_suite("xbps-install") atf_test_program{name="behaviour_tests"} +atf_test_program{name="revert_tests"} diff --git a/tests/xbps/xbps-install/Makefile b/tests/xbps/xbps-install/Makefile index c465c561..6bb41725 100644 --- a/tests/xbps/xbps-install/Makefile +++ b/tests/xbps/xbps-install/Makefile @@ -1,7 +1,7 @@ TOPDIR = ../../.. -include $(TOPDIR)/config.mk -TESTSHELL = behaviour_tests +TESTSHELL = behaviour_tests revert_tests TESTSSUBDIR = xbps/xbps-install EXTRA_FILES = Kyuafile diff --git a/tests/xbps/xbps-install/revert_tests.sh b/tests/xbps/xbps-install/revert_tests.sh new file mode 100644 index 00000000..e120a54c --- /dev/null +++ b/tests/xbps/xbps-install/revert_tests.sh @@ -0,0 +1,50 @@ +#! /usr/bin/env atf-sh + +atf_test_case revert_package + +revert_package_head() { + atf_set "descr" "xbps-install(8): install multiple existent pkgs (issue #53)" +} + +revert_package_body() { + mkdir -p some_repo pkg_A + touch pkg_A/file00 + # create package and install it + cd some_repo + echo first V1.0 > ../pkg_A/file00 + xbps-create -A noarch -n A-1.0_1 -s "A pkg" ../pkg_A + atf_check_equal $? 0 + xbps-rindex -a *.xbps + atf_check_equal $? 0 + cd .. + xbps-install -r root -C empty.conf --repository=$PWD/some_repo -y A + atf_check_equal $? 0 + + # make an update to the package + cd some_repo + echo V1.1 > ../pkg_A/file00 + xbps-create -A noarch -n A-1.1_1 -s "A pkg" ../pkg_A + atf_check_equal $? 0 + xbps-rindex -a *.xbps + atf_check_equal $? 0 + cd .. + xbps-install -r root -C empty.conf --repository=$PWD/some_repo -y -u + atf_check_equal $? 0 + + # whoops, we made a mistake, rollback to 1.0_1 + cd some_repo + echo second V1.0 > ../pkg_A/file00 + xbps-create -A noarch -n A-1.0_1 -r "1.1_1" -s "A pkg" ../pkg_A + atf_check_equal $? 0 + xbps-rindex -a *.xbps + atf_check_equal $? 0 + cd .. + LD_PRELOAD=/home/tox/dev/src/xbps/lib/libxbps.so.2.0.0 xbps-install -d -r root -C empty.conf --repository=$PWD/some_repo -y -u + atf_check_equal $? 0 + + atf_check_equal "`cat root/file00`" "second V1.0" +} + +atf_init_test_cases() { + atf_add_test_case revert_package +}