summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2012-01-16 20:04:03 +0000
committerMike Frysinger <vapier@gentoo.org>2012-01-16 20:04:03 +0000
commit90ba1389ea96cbc4bcef79ca8ab35a9a9b85e27c (patch)
tree7a2ca000c4f59b2593d7813d8bbe3dce77514280 /eclass
parentquote single flag arg to test-flag-PROG since we are only testing one flag, a... (diff)
downloadgentoo-2-90ba1389ea96cbc4bcef79ca8ab35a9a9b85e27c.tar.gz
gentoo-2-90ba1389ea96cbc4bcef79ca8ab35a9a9b85e27c.tar.bz2
gentoo-2-90ba1389ea96cbc4bcef79ca8ab35a9a9b85e27c.zip
add more tests
Diffstat (limited to 'eclass')
-rwxr-xr-xeclass/tests/flag-o-matic.sh35
1 files changed, 25 insertions, 10 deletions
diff --git a/eclass/tests/flag-o-matic.sh b/eclass/tests/flag-o-matic.sh
index f4f5952a4e58..7b4e2acb2224 100755
--- a/eclass/tests/flag-o-matic.sh
+++ b/eclass/tests/flag-o-matic.sh
@@ -8,7 +8,13 @@ CFLAGS="-a -b -c=1"
CXXFLAGS="-x -y -z=2"
LDFLAGS="-l -m -n=3"
ftend() {
- tend $? "CFLAGS=${CFLAGS} CXXFLAGS=${CXXFLAGS} LDFLAGS=${LDFLAGS}"
+ local ret=$?
+ local msg="Failed; flags are:"
+ local flag
+ for flag in $(all-flag-vars) ; do
+ msg+=$'\n\t'"${flag}=${!flag}"
+ done
+ tend ${ret} "${msg}"
}
tbegin "is-flag"
@@ -50,18 +56,16 @@ strip-unsupported-flags
[[ ${CFLAGS} == "" ]] && [[ ${CXXFLAGS} == "-z=2" ]]
ftend
-for v in C CPP CXX F FC LD ; do
- var="${v}FLAGS"
- eval ${var}=\"-filter -filter-glob -${v}\"
+for var in $(all-flag-vars) ; do
+ eval ${var}=\"-filter -filter-glob -${var%FLAGS}\"
done
tbegin "filter-flags basic"
filter-flags -filter
(
-for v in C CPP CXX F FC LD ; do
- var="${v}FLAGS"
+for var in $(all-flag-vars) ; do
val=${!var}
- [[ ${val} == "-filter-glob -${v}" ]] || exit 1
+ [[ ${val} == "-filter-glob -${var%FLAGS}" ]] || exit 1
done
)
ftend
@@ -69,10 +73,9 @@ ftend
tbegin "filter-flags glob"
filter-flags '-filter-*'
(
-for v in C CPP CXX F FC LD ; do
- var="${v}FLAGS"
+for var in $(all-flag-vars) ; do
val=${!var}
- [[ ${val} == "-${v}" ]] || exit 1
+ [[ ${val} == "-${var%FLAGS}" ]] || exit 1
done
)
ftend
@@ -95,4 +98,16 @@ replace-flags '-mcpu=*' -mcpu=good
[[ ${CXXFLAGS} == "-O0 -mcpu=good -cow" ]]
ftend
+tbegin "append-cflags basic"
+CFLAGS=
+append-cflags -O0
+[[ ${CFLAGS} == "-O0" ]]
+ftend
+
+tbegin "append-cflags -DFOO='a b c'"
+CFLAGS=
+append-cflags '-DFOO="a b c"'
+[[ ${CFLAGS} == '-DFOO="a b c"' ]]
+ftend
+
texit