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
commitd16c646d1585b20ad4a4bc8b496c0788458c33e3 (patch)
tree984150b3892933777b2d77437f7f0ecefa8486f9 /eclass
parentquote single flag arg to test-flag-PROG since we are only testing one flag, a... (diff)
downloadhistorical-d16c646d1585b20ad4a4bc8b496c0788458c33e3.tar.gz
historical-d16c646d1585b20ad4a4bc8b496c0788458c33e3.tar.bz2
historical-d16c646d1585b20ad4a4bc8b496c0788458c33e3.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