summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2012-01-04 06:18:51 +0000
committerMike Frysinger <vapier@gentoo.org>2012-01-04 06:18:51 +0000
commit50fcc9f435cb9b49474d75ef2185bc0871b2b044 (patch)
treea45d6f1886c413447df176b37cf2770e3e55a844 /eclass
parentmedia-libs/gegl: Remove dependency on GTK+ (diff)
downloadgentoo-2-50fcc9f435cb9b49474d75ef2185bc0871b2b044.tar.gz
gentoo-2-50fcc9f435cb9b49474d75ef2185bc0871b2b044.tar.bz2
gentoo-2-50fcc9f435cb9b49474d75ef2185bc0871b2b044.zip
add tests for savedconfig.eclass:save_config()
Diffstat (limited to 'eclass')
-rwxr-xr-xeclass/tests/savedconfig.sh31
-rw-r--r--eclass/tests/tests-common.sh18
2 files changed, 49 insertions, 0 deletions
diff --git a/eclass/tests/savedconfig.sh b/eclass/tests/savedconfig.sh
new file mode 100755
index 000000000000..997255150ca9
--- /dev/null
+++ b/eclass/tests/savedconfig.sh
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+source tests-common.sh
+
+inherit savedconfig
+
+sc() { EBUILD_PHASE=install save_config "$@" ; }
+rc() { EBUILD_PHASE=prepare restore_config "$@" ; }
+
+tbegin "simple save_config"
+sc $0 >/dev/null
+ret=$?
+[[ -f ${ED}/etc/portage/savedconfig/${CATEGORY}/${PF} ]]
+tend $(( ret + $? ))
+rm -rf "${ED}/etc"
+
+tbegin "multi save_config"
+sc *.sh >/dev/null
+ret=$?
+[[ -d ${ED}/etc/portage/savedconfig/${CATEGORY}/${PF} ]]
+tend $(( ret + $? ))
+rm -rf "${ED}/etc"
+
+tbegin "dir save_config"
+sc CVS >/dev/null
+ret=$?
+[[ -d ${ED}/etc/portage/savedconfig/${CATEGORY}/${PF} ]]
+tend $(( ret + $? ))
+rm -rf "${ED}/etc"
+
+texit
diff --git a/eclass/tests/tests-common.sh b/eclass/tests/tests-common.sh
index c976e29aee56..f26b56aa8ef9 100644
--- a/eclass/tests/tests-common.sh
+++ b/eclass/tests/tests-common.sh
@@ -93,6 +93,7 @@ tbegin() {
ebegin "Testing $*"
}
texit() {
+ rm -rf "${tmpdir}"
exit ${tret}
}
tend() {
@@ -104,3 +105,20 @@ t() {
: $(( tret |= ${ret} ))
return ${ret}
}
+
+tmpdir="${PWD}/tmp"
+D="${tmpdir}/$0/${RANDOM}"
+ED=${D}
+mkdir -p "${D}"
+
+dodir() {
+ mkdir -p "${@/#/${ED}/}"
+}
+
+elog() { einfo "$@" ; }
+
+CATEGORY="dev-eclass"
+PN="tests"
+PV="0"
+P="${PN}-${PV}"
+PF=${P}