aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2011-12-22 20:13:01 +0000
committerMike Frysinger <vapier@gentoo.org>2011-12-22 20:13:01 +0000
commit8554baf7ac033902b04bb63facf2f0718a1b4f8b (patch)
tree562c9680f3cb4276f9b2a1e3ba4e4037b3defde4
parentredo test output to get info on a per-test basis (diff)
downloadportage-utils-8554baf7ac033902b04bb63facf2f0718a1b4f8b.tar.gz
portage-utils-8554baf7ac033902b04bb63facf2f0718a1b4f8b.tar.bz2
portage-utils-8554baf7ac033902b04bb63facf2f0718a1b4f8b.zip
start a testsuite for profile/config parsing
-rw-r--r--tests/Makefile2
-rwxr-xr-xtests/profile/dotest50
-rw-r--r--tests/profile/profile1/etc/parent.conf1
-rw-r--r--tests/profile/profile1/etc/portage/make.conf12
-rw-r--r--tests/profile/profile1/etc/portage/subdir/file.conf1
-rw-r--r--tests/profile/profile1/etc/portage/this.level.conf1
6 files changed, 66 insertions, 1 deletions
diff --git a/tests/Makefile b/tests/Makefile
index 9a2ac37..4972bb6 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -1,7 +1,7 @@
TESTS = \
reinitialize atom_compare atom_explode mkdir \
qfile qlist qtbz2 quse qxpak \
- install source
+ install profilesource
all: check
diff --git a/tests/profile/dotest b/tests/profile/dotest
new file mode 100755
index 0000000..6514928
--- /dev/null
+++ b/tests/profile/dotest
@@ -0,0 +1,50 @@
+#!/bin/bash
+
+. ../init.sh
+
+qenv() {
+ # get q to dump its processed env so we can check
+ DEBUG= q 2>&1 >/dev/null
+}
+
+tenv() {
+ local profile=$1 var=$2 exp=$3
+
+ export PORTAGE_CONFIGROOT=${as}/profile${profile}
+ local e=$(qenv)
+
+ res=$(echo "${e}" | sed -n "/^${var} = /{s:^${var} = ::;p}")
+
+ [[ ${res} == "${exp}" ]]
+ if ! tend $? "(${profile}) ${var} = ${exp}" ; then
+ echo "we got: {${res}}"
+ echo "full env:"
+ echo "${e}" | while read line ; do
+ printf '\t{%s}\n' "${line}"
+ done
+ fi
+}
+
+# clear out env vars that would affect our tests
+unset $(qenv | awk '{print $1}')
+
+# test vars that should default to known values.
+# cannot test too many more as portage's default
+# make.globals will kick in.
+tenv inv ROOT /
+tenv inv ARCH
+tenv inv PORTAGE_BINHOST
+
+# this validates simple stuff
+tenv 1 ARCH x86
+tenv 1 INSTALL_MASK imask
+
+# this validates -* behavior
+tenv 1 CONFIG_PROTECT
+
+# this indirectly validates relative sourcing
+tenv 1 FEATURES feat
+tenv 1 CONFIG_PROTECT_MASK asdf
+tenv 1 ACCEPT_LICENSE lic
+
+end
diff --git a/tests/profile/profile1/etc/parent.conf b/tests/profile/profile1/etc/parent.conf
new file mode 100644
index 0000000..3cd1b46
--- /dev/null
+++ b/tests/profile/profile1/etc/parent.conf
@@ -0,0 +1 @@
+CONFIG_PROTECT_MASK="-* asdf"
diff --git a/tests/profile/profile1/etc/portage/make.conf b/tests/profile/profile1/etc/portage/make.conf
new file mode 100644
index 0000000..247a4ef
--- /dev/null
+++ b/tests/profile/profile1/etc/portage/make.conf
@@ -0,0 +1,12 @@
+ARCH=x86
+
+#395629
+CONFIG_PROTECT=-*
+
+source this.level.conf
+
+source ../parent.conf
+
+source subdir/file.conf
+
+INSTALL_MASK=" imask "
diff --git a/tests/profile/profile1/etc/portage/subdir/file.conf b/tests/profile/profile1/etc/portage/subdir/file.conf
new file mode 100644
index 0000000..fb25c8d
--- /dev/null
+++ b/tests/profile/profile1/etc/portage/subdir/file.conf
@@ -0,0 +1 @@
+ACCEPT_LICENSE='lic'
diff --git a/tests/profile/profile1/etc/portage/this.level.conf b/tests/profile/profile1/etc/portage/this.level.conf
new file mode 100644
index 0000000..d45d6a7
--- /dev/null
+++ b/tests/profile/profile1/etc/portage/this.level.conf
@@ -0,0 +1 @@
+FEATURES="-* feat"