public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] gentoo-x86 commit in eclass/tests: flag-o-matic.sh
@ 2011-12-15  5:23 Mike Frysinger (vapier)
  0 siblings, 0 replies; 8+ messages in thread
From: Mike Frysinger (vapier) @ 2011-12-15  5:23 UTC (permalink / raw
  To: gentoo-commits

vapier      11/12/15 05:23:15

  Added:                flag-o-matic.sh
  Log:
  relocate tests to tests/ subdir

Revision  Changes    Path
1.1                  eclass/tests/flag-o-matic.sh

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/tests/flag-o-matic.sh?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/tests/flag-o-matic.sh?rev=1.1&content-type=text/plain

Index: flag-o-matic.sh
===================================================================
#!/bin/bash

source tests-common.sh

inherit flag-o-matic

CFLAGS="-a -b -c=1"
CXXFLAGS="-x -y -z=2"
LDFLAGS="-l -m -n=3"

tbegin "is-flag"
! (is-flag 1 2 3) 2>/dev/null
tend $?

tbegin "is-ldflag"
! (is-ldflag 1 2 3) 2>/dev/null
tend $?

while read exp flag ; do
	[[ -z ${exp}${flag} ]] && continue

	tbegin "is-flagq ${flag}"
	is-flagq ${flag}
	[[ ${exp} -eq $? ]]
	tend $? "CFLAGS=${CFLAGS}"
done <<<"
	1	-l
	0	-a
	0	-x
"

while read exp flag ; do
	[[ -z ${exp}${flag} ]] && continue

	tbegin "is-ldflagq ${flag}"
	is-ldflagq "${flag}"
	[[ ${exp} -eq $? ]]
	tend $? "LDFLAGS=${LDFLAGS}"
done <<<"
	1	-a
	0	-n=*
	1	-n
"

tbegin "strip-unsupported-flags"
strip-unsupported-flags
[[ ${CFLAGS} == "" ]] && [[ ${CXXFLAGS} == "-z=2" ]]
tend $? "CFLAGS=${CFLAGS} CXXFLAGS=${CXXFLAGS}"

texit






^ permalink raw reply	[flat|nested] 8+ messages in thread

* [gentoo-commits] gentoo-x86 commit in eclass/tests: flag-o-matic.sh
@ 2012-01-13 22:40 Mike Frysinger (vapier)
  0 siblings, 0 replies; 8+ messages in thread
From: Mike Frysinger (vapier) @ 2012-01-13 22:40 UTC (permalink / raw
  To: gentoo-commits

vapier      12/01/13 22:40:50

  Modified:             flag-o-matic.sh
  Log:
  add tests for filter-flags

Revision  Changes    Path
1.2                  eclass/tests/flag-o-matic.sh

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/tests/flag-o-matic.sh?rev=1.2&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/tests/flag-o-matic.sh?rev=1.2&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/tests/flag-o-matic.sh?r1=1.1&r2=1.2

Index: flag-o-matic.sh
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/tests/flag-o-matic.sh,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- flag-o-matic.sh	15 Dec 2011 05:23:15 -0000	1.1
+++ flag-o-matic.sh	13 Jan 2012 22:40:50 -0000	1.2
@@ -7,14 +7,17 @@
 CFLAGS="-a -b -c=1"
 CXXFLAGS="-x -y -z=2"
 LDFLAGS="-l -m -n=3"
+ftend() {
+	tend $? "CFLAGS=${CFLAGS} CXXFLAGS=${CXXFLAGS} LDFLAGS=${LDFLAGS}"
+}
 
 tbegin "is-flag"
 ! (is-flag 1 2 3) 2>/dev/null
-tend $?
+ftend
 
 tbegin "is-ldflag"
 ! (is-ldflag 1 2 3) 2>/dev/null
-tend $?
+ftend
 
 while read exp flag ; do
 	[[ -z ${exp}${flag} ]] && continue
@@ -22,7 +25,7 @@
 	tbegin "is-flagq ${flag}"
 	is-flagq ${flag}
 	[[ ${exp} -eq $? ]]
-	tend $? "CFLAGS=${CFLAGS}"
+	ftend
 done <<<"
 	1	-l
 	0	-a
@@ -35,7 +38,7 @@
 	tbegin "is-ldflagq ${flag}"
 	is-ldflagq "${flag}"
 	[[ ${exp} -eq $? ]]
-	tend $? "LDFLAGS=${LDFLAGS}"
+	ftend
 done <<<"
 	1	-a
 	0	-n=*
@@ -45,6 +48,33 @@
 tbegin "strip-unsupported-flags"
 strip-unsupported-flags
 [[ ${CFLAGS} == "" ]] && [[ ${CXXFLAGS} == "-z=2" ]]
-tend $? "CFLAGS=${CFLAGS} CXXFLAGS=${CXXFLAGS}"
+ftend
+
+for v in C CPP CXX F FC LD ; do
+	var="${v}FLAGS"
+	eval ${var}=\"-filter -filter-glob -${v}\"
+done
+
+tbegin "filter-flags basic"
+filter-flags -filter
+(
+for v in C CPP CXX F FC LD ; do
+	var="${v}FLAGS"
+	val=${!var}
+	[[ ${val} == "-filter-glob -${v}" ]] || exit 1
+done
+)
+ftend
+
+tbegin "filter-flags glob"
+filter-flags '-filter-*'
+(
+for v in C CPP CXX F FC LD ; do
+	var="${v}FLAGS"
+	val=${!var}
+	[[ ${val} == "-${v}" ]] || exit 1
+done
+)
+ftend
 
 texit






^ permalink raw reply	[flat|nested] 8+ messages in thread

* [gentoo-commits] gentoo-x86 commit in eclass/tests: flag-o-matic.sh
@ 2012-01-14  9:11 Mike Frysinger (vapier)
  0 siblings, 0 replies; 8+ messages in thread
From: Mike Frysinger (vapier) @ 2012-01-14  9:11 UTC (permalink / raw
  To: gentoo-commits

vapier      12/01/14 09:11:09

  Modified:             flag-o-matic.sh
  Log:
  test more flag funcs

Revision  Changes    Path
1.3                  eclass/tests/flag-o-matic.sh

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/tests/flag-o-matic.sh?rev=1.3&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/tests/flag-o-matic.sh?rev=1.3&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/tests/flag-o-matic.sh?r1=1.2&r2=1.3

Index: flag-o-matic.sh
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/tests/flag-o-matic.sh,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- flag-o-matic.sh	13 Jan 2012 22:40:50 -0000	1.2
+++ flag-o-matic.sh	14 Jan 2012 09:11:08 -0000	1.3
@@ -27,7 +27,7 @@
 	[[ ${exp} -eq $? ]]
 	ftend
 done <<<"
-	1	-l
+	1	-L
 	0	-a
 	0	-x
 "
@@ -77,4 +77,22 @@
 )
 ftend
 
+tbegin "strip-flags basic"
+CXXFLAGS+=" -O999 "
+strip-flags
+[[ -z ${CFLAGS}${LDFLAGS}${CPPFLAGS} && ${CXXFLAGS} == "-O2" ]]
+ftend
+
+tbegin "replace-flags basic"
+CFLAGS="-O0 -foo"
+replace-flags -O0 -O1
+[[ ${CFLAGS} == "-O1 -foo" ]]
+ftend
+
+tbegin "replace-flags glob"
+CXXFLAGS="-O0 -mcpu=bad -cow"
+replace-flags '-mcpu=*' -mcpu=good
+[[ ${CXXFLAGS} == "-O0 -mcpu=good -cow" ]]
+ftend
+
 texit






^ permalink raw reply	[flat|nested] 8+ messages in thread

* [gentoo-commits] gentoo-x86 commit in eclass/tests: flag-o-matic.sh
@ 2012-01-16 20:04 Mike Frysinger (vapier)
  0 siblings, 0 replies; 8+ messages in thread
From: Mike Frysinger (vapier) @ 2012-01-16 20:04 UTC (permalink / raw
  To: gentoo-commits

vapier      12/01/16 20:04:03

  Modified:             flag-o-matic.sh
  Log:
  add more tests

Revision  Changes    Path
1.4                  eclass/tests/flag-o-matic.sh

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/tests/flag-o-matic.sh?rev=1.4&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/tests/flag-o-matic.sh?rev=1.4&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/tests/flag-o-matic.sh?r1=1.3&r2=1.4

Index: flag-o-matic.sh
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/tests/flag-o-matic.sh,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- flag-o-matic.sh	14 Jan 2012 09:11:08 -0000	1.3
+++ flag-o-matic.sh	16 Jan 2012 20:04:03 -0000	1.4
@@ -8,7 +8,13 @@
 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 @@
 [[ ${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 @@
 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 @@
 [[ ${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






^ permalink raw reply	[flat|nested] 8+ messages in thread

* [gentoo-commits] gentoo-x86 commit in eclass/tests: flag-o-matic.sh
@ 2012-11-11  7:03 Mike Frysinger (vapier)
  0 siblings, 0 replies; 8+ messages in thread
From: Mike Frysinger (vapier) @ 2012-11-11  7:03 UTC (permalink / raw
  To: gentoo-commits

vapier      12/11/11 07:03:57

  Modified:             flag-o-matic.sh
  Log:
  fix test failure after letting -L flags stay in LDFLAGS when stripping

Revision  Changes    Path
1.5                  eclass/tests/flag-o-matic.sh

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/tests/flag-o-matic.sh?rev=1.5&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/tests/flag-o-matic.sh?rev=1.5&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/tests/flag-o-matic.sh?r1=1.4&r2=1.5

Index: flag-o-matic.sh
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/tests/flag-o-matic.sh,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- flag-o-matic.sh	16 Jan 2012 20:04:03 -0000	1.4
+++ flag-o-matic.sh	11 Nov 2012 07:03:57 -0000	1.5
@@ -57,7 +57,7 @@
 ftend
 
 for var in $(all-flag-vars) ; do
-	eval ${var}=\"-filter -filter-glob -${var%FLAGS}\"
+	eval ${var}=\"-filter -filter-glob -foo-${var%FLAGS}\"
 done
 
 tbegin "filter-flags basic"
@@ -65,7 +65,7 @@
 (
 for var in $(all-flag-vars) ; do
 	val=${!var}
-	[[ ${val} == "-filter-glob -${var%FLAGS}" ]] || exit 1
+	[[ ${val} == "-filter-glob -foo-${var%FLAGS}" ]] || exit 1
 done
 )
 ftend
@@ -75,7 +75,7 @@
 (
 for var in $(all-flag-vars) ; do
 	val=${!var}
-	[[ ${val} == "-${var%FLAGS}" ]] || exit 1
+	[[ ${val} == "-foo-${var%FLAGS}" ]] || exit 1
 done
 )
 ftend





^ permalink raw reply	[flat|nested] 8+ messages in thread

* [gentoo-commits] gentoo-x86 commit in eclass/tests: flag-o-matic.sh
@ 2012-11-11 20:00 Mike Frysinger (vapier)
  0 siblings, 0 replies; 8+ messages in thread
From: Mike Frysinger (vapier) @ 2012-11-11 20:00 UTC (permalink / raw
  To: gentoo-commits

vapier      12/11/11 20:00:57

  Modified:             flag-o-matic.sh
  Log:
  raw-ldflags: fix typo in previous commit #441808#10

Revision  Changes    Path
1.6                  eclass/tests/flag-o-matic.sh

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/tests/flag-o-matic.sh?rev=1.6&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/tests/flag-o-matic.sh?rev=1.6&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/tests/flag-o-matic.sh?r1=1.5&r2=1.6

Index: flag-o-matic.sh
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/tests/flag-o-matic.sh,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- flag-o-matic.sh	11 Nov 2012 07:03:57 -0000	1.5
+++ flag-o-matic.sh	11 Nov 2012 20:00:57 -0000	1.6
@@ -110,4 +110,10 @@
 [[ ${CFLAGS} == '-DFOO="a b c"' ]]
 ftend
 
+tbegin "raw-ldflags"
+LDFLAGS='-Wl,-O1 -Wl,--as-needed -Wl,-z,now -flto'
+LDFLAGS=$(raw-ldflags)
+[[ ${LDFLAGS} == '-O1 --as-needed -z now' ]]
+ftend
+
 texit





^ permalink raw reply	[flat|nested] 8+ messages in thread

* [gentoo-commits] gentoo-x86 commit in eclass/tests: flag-o-matic.sh
@ 2013-11-02  3:17 Ryan Hill (dirtyepic)
  0 siblings, 0 replies; 8+ messages in thread
From: Ryan Hill (dirtyepic) @ 2013-11-02  3:17 UTC (permalink / raw
  To: gentoo-commits

dirtyepic    13/11/02 03:17:58

  Modified:             flag-o-matic.sh
  Log:
  Account for leading whitespace in append-cflags tests.

Revision  Changes    Path
1.7                  eclass/tests/flag-o-matic.sh

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/tests/flag-o-matic.sh?rev=1.7&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/tests/flag-o-matic.sh?rev=1.7&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/tests/flag-o-matic.sh?r1=1.6&r2=1.7

Index: flag-o-matic.sh
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/tests/flag-o-matic.sh,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- flag-o-matic.sh	11 Nov 2012 20:00:57 -0000	1.6
+++ flag-o-matic.sh	2 Nov 2013 03:17:58 -0000	1.7
@@ -101,13 +101,13 @@
 tbegin "append-cflags basic"
 CFLAGS=
 append-cflags -O0
-[[ ${CFLAGS} == "-O0" ]]
+[[ ${CFLAGS} == " -O0" ]]
 ftend
 
 tbegin "append-cflags -DFOO='a b c'"
 CFLAGS=
 append-cflags '-DFOO="a b c"'
-[[ ${CFLAGS} == '-DFOO="a b c"' ]]
+[[ ${CFLAGS} == ' -DFOO="a b c"' ]]
 ftend
 
 tbegin "raw-ldflags"





^ permalink raw reply	[flat|nested] 8+ messages in thread

* [gentoo-commits] gentoo-x86 commit in eclass/tests: flag-o-matic.sh
@ 2015-05-06  7:04 Mike Frysinger (vapier)
  0 siblings, 0 replies; 8+ messages in thread
From: Mike Frysinger (vapier) @ 2015-05-06  7:04 UTC (permalink / raw
  To: gentoo-commits

vapier      15/05/06 07:04:53

  Modified:             flag-o-matic.sh
  Log:
  make flag testing work for clang too crbug.com/474652

Revision  Changes    Path
1.8                  eclass/tests/flag-o-matic.sh

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/tests/flag-o-matic.sh?rev=1.8&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/tests/flag-o-matic.sh?rev=1.8&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/tests/flag-o-matic.sh?r1=1.7&r2=1.8

Index: flag-o-matic.sh
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/tests/flag-o-matic.sh,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- flag-o-matic.sh	2 Nov 2013 03:17:58 -0000	1.7
+++ flag-o-matic.sh	6 May 2015 07:04:53 -0000	1.8
@@ -116,4 +116,31 @@
 [[ ${LDFLAGS} == '-O1 --as-needed -z now' ]]
 ftend
 
+tbegin "test-flags-CC (valid flags)"
+out=$(test-flags-CC -O3)
+[[ $? -eq 0 && ${out} == "-O3" ]]
+ftend
+
+tbegin "test-flags-CC (invalid flags)"
+out=$(test-flags-CC -finvalid-flag)
+[[ $? -ne 0 && -z ${out} ]]
+ftend
+
+if type -P clang >/dev/null ; then
+tbegin "test-flags-CC (valid flags w/clang)"
+out=$(CC=clang test-flags-CC -O3)
+[[ $? -eq 0 && ${out} == "-O3" ]]
+ftend
+
+tbegin "test-flags-CC (invalid flags w/clang)"
+out=$(CC=clang test-flags-CC -finvalid-flag)
+[[ $? -ne 0 && -z ${out} ]]
+ftend
+
+tbegin "test-flags-CC (gcc-valid but clang-invalid flags)"
+out=$(CC=clang test-flags-CC -finline-limit=1200)
+[[ $? -ne 0 && -z ${out} ]]
+ftend
+fi
+
 texit





^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-05-06  7:04 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-15  5:23 [gentoo-commits] gentoo-x86 commit in eclass/tests: flag-o-matic.sh Mike Frysinger (vapier)
  -- strict thread matches above, loose matches on Subject: below --
2012-01-13 22:40 Mike Frysinger (vapier)
2012-01-14  9:11 Mike Frysinger (vapier)
2012-01-16 20:04 Mike Frysinger (vapier)
2012-11-11  7:03 Mike Frysinger (vapier)
2012-11-11 20:00 Mike Frysinger (vapier)
2013-11-02  3:17 Ryan Hill (dirtyepic)
2015-05-06  7:04 Mike Frysinger (vapier)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox