Gentoo Archives: gentoo-commits

From: "Mike Frysinger (vapier)" <vapier@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-projects commit in portage-utils/tests/profile: dotest
Date: Thu, 22 Dec 2011 20:13:20
Message-Id: 20111222201301.3E8AB2004C@flycatcher.gentoo.org
1 vapier 11/12/22 20:13:01
2
3 Added: dotest
4 Log:
5 start a testsuite for profile/config parsing
6
7 Revision Changes Path
8 1.1 portage-utils/tests/profile/dotest
9
10 file : http://sources.gentoo.org/viewvc.cgi/gentoo-projects/portage-utils/tests/profile/dotest?rev=1.1&view=markup
11 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-projects/portage-utils/tests/profile/dotest?rev=1.1&content-type=text/plain
12
13 Index: dotest
14 ===================================================================
15 #!/bin/bash
16
17 . ../init.sh
18
19 qenv() {
20 # get q to dump its processed env so we can check
21 DEBUG= q 2>&1 >/dev/null
22 }
23
24 tenv() {
25 local profile=$1 var=$2 exp=$3
26
27 export PORTAGE_CONFIGROOT=${as}/profile${profile}
28 local e=$(qenv)
29
30 res=$(echo "${e}" | sed -n "/^${var} = /{s:^${var} = ::;p}")
31
32 [[ ${res} == "${exp}" ]]
33 if ! tend $? "(${profile}) ${var} = ${exp}" ; then
34 echo "we got: {${res}}"
35 echo "full env:"
36 echo "${e}" | while read line ; do
37 printf '\t{%s}\n' "${line}"
38 done
39 fi
40 }
41
42 # clear out env vars that would affect our tests
43 unset $(qenv | awk '{print $1}')
44
45 # test vars that should default to known values.
46 # cannot test too many more as portage's default
47 # make.globals will kick in.
48 tenv inv ROOT /
49 tenv inv ARCH
50 tenv inv PORTAGE_BINHOST
51
52 # this validates simple stuff
53 tenv 1 ARCH x86
54 tenv 1 INSTALL_MASK imask
55
56 # this validates -* behavior
57 tenv 1 CONFIG_PROTECT
58
59 # this indirectly validates relative sourcing
60 tenv 1 FEATURES feat
61 tenv 1 CONFIG_PROTECT_MASK asdf
62 tenv 1 ACCEPT_LICENSE lic
63
64 end