From d16c646d1585b20ad4a4bc8b496c0788458c33e3 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Mon, 16 Jan 2012 20:04:03 +0000 Subject: add more tests --- eclass/tests/flag-o-matic.sh | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) (limited to 'eclass/tests') 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 -- cgit v1.2.3-65-gdbad