From e9887d2a856a963c93ddbfdf1f8d40910555b78b Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Sun, 3 Feb 2013 11:13:53 -0500 Subject: warningtester: Sort the list of warnings This means that we can simply put all warnings at the bottom, unrelated to the order that they're emitted in the code, keeping line numbers more stable. https://bugzilla.gnome.org/show_bug.cgi?id=693098 --- tests/warn/warningtester.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'tests/warn/warningtester.py') diff --git a/tests/warn/warningtester.py b/tests/warn/warningtester.py index ee6b3c16..27e0a5e6 100644 --- a/tests/warn/warningtester.py +++ b/tests/warn/warningtester.py @@ -128,6 +128,9 @@ def check(args): expected_warnings = _extract_expected(filename) + expected_warnings.sort() + emitted_warnings.sort() + if len(expected_warnings) != len(emitted_warnings): raise SystemExit('ERROR in %r: %d warnings were emitted, ' 'expected %d:\n%s' %(os.path.basename(filename), -- cgit v1.2.1 From 95b03cf87efbd4fea4b7d55601c9752cefd29bfc Mon Sep 17 00:00:00 2001 From: Tim Lunn Date: Sun, 24 Feb 2013 17:34:56 +1100 Subject: gi-r-scanner: add support for raw CFLAGS flags option gi-r-scanner chokes when gir_CFLAGS have an '-include
' since this is not a recognised option. This commit adds a new --cflags option that passes cflags directly to the spawned gcc. https://bugzilla.gnome.org/show_bug.cgi?id=695182 --- tests/warn/warningtester.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tests/warn/warningtester.py') diff --git a/tests/warn/warningtester.py b/tests/warn/warningtester.py index 27e0a5e6..fba8f0ce 100644 --- a/tests/warn/warningtester.py +++ b/tests/warn/warningtester.py @@ -40,6 +40,7 @@ class ChunkedIO(object): class Options: def __init__(self): + self.cpp_cflags = "" self.cpp_includes = [] self.cpp_defines = [] self.cpp_undefines = [] @@ -110,7 +111,7 @@ def check(args): exit_code = process_packages(options, ['gobject-2.0']) if exit_code: sys.exit(exit_code) - ss.set_cpp_options(options.cpp_includes, options.cpp_defines, options.cpp_undefines) + ss.set_cpp_options(options.cpp_cflags, options.cpp_includes, options.cpp_defines, options.cpp_undefines) ss.parse_files([filename]) ss.parse_macros([filename]) transformer.parse(ss.get_symbols()) -- cgit v1.2.1 From b051c92cdfbe8255de27bba658a5a95d626accb9 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Tue, 5 Mar 2013 18:23:25 -0500 Subject: Revert "gi-r-scanner: add support for raw CFLAGS flags option" Doesn't work with arguments that have shell quotes. This reverts commit 95b03cf87efbd4fea4b7d55601c9752cefd29bfc. --- tests/warn/warningtester.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'tests/warn/warningtester.py') diff --git a/tests/warn/warningtester.py b/tests/warn/warningtester.py index fba8f0ce..27e0a5e6 100644 --- a/tests/warn/warningtester.py +++ b/tests/warn/warningtester.py @@ -40,7 +40,6 @@ class ChunkedIO(object): class Options: def __init__(self): - self.cpp_cflags = "" self.cpp_includes = [] self.cpp_defines = [] self.cpp_undefines = [] @@ -111,7 +110,7 @@ def check(args): exit_code = process_packages(options, ['gobject-2.0']) if exit_code: sys.exit(exit_code) - ss.set_cpp_options(options.cpp_cflags, options.cpp_includes, options.cpp_defines, options.cpp_undefines) + ss.set_cpp_options(options.cpp_includes, options.cpp_defines, options.cpp_undefines) ss.parse_files([filename]) ss.parse_macros([filename]) transformer.parse(ss.get_symbols()) -- cgit v1.2.1 From c9e2d880011c530ff1454fe31a2d40d189860be5 Mon Sep 17 00:00:00 2001 From: Dieter Verfaillie Date: Wed, 24 Apr 2013 14:06:18 +0200 Subject: tests: Update misc/pep8.py to 1.4.5 Version in our tree is a wee bit outdated. For example, later work will introduce an utf8 encoded python source file which our old pep8.py does not yet understand (yeah, it really was *that* ancient)... Updated from: https://raw.github.com/jcrocholl/pep8/1.4.5/pep8.py Takes 552c1f1525e37a30376790151c1ba437776682c5, f941537d1c0a40f0906490ed160db6c79af572d3, 5a4afe2a77d0ff7d9fea13dd93c3304a6ca993de and a17f157e19bd6792c00321c8020dca5e5a281f45 into account... https://bugzilla.gnome.org/show_bug.cgi?id=699535 --- tests/warn/warningtester.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'tests/warn/warningtester.py') diff --git a/tests/warn/warningtester.py b/tests/warn/warningtester.py index 27e0a5e6..fc3c3d2d 100644 --- a/tests/warn/warningtester.py +++ b/tests/warn/warningtester.py @@ -61,23 +61,24 @@ def _diff(a, b): for line in a[i1:i2]: for l in line.split('\n'): if l != '': - retval += ' ' + l + '\n' + retval += ' ' + l + '\n' continue if tag in ('replace', 'delete'): for line in a[i1:i2]: for l in line.split('\n'): if l != '': - retval += '-' + l + '\n' + retval += '-' + l + '\n' if tag in ('replace', 'insert'): for line in b[j1:j2]: for l in line.split('\n'): if l != '': - retval += '+' + l + '\n' + retval += '+' + l + '\n' return retval + def _extract_expected(filename): fd = open(filename, 'rU') data = fd.read() @@ -92,6 +93,7 @@ def _extract_expected(filename): return retval + def check(args): filename = args[0] @@ -133,10 +135,10 @@ def check(args): if len(expected_warnings) != len(emitted_warnings): raise SystemExit('ERROR in %r: %d warnings were emitted, ' - 'expected %d:\n%s' %(os.path.basename(filename), - len(emitted_warnings), - len(expected_warnings), - _diff(expected_warnings, emitted_warnings))) + 'expected %d:\n%s' % (os.path.basename(filename), + len(emitted_warnings), + len(expected_warnings), + _diff(expected_warnings, emitted_warnings))) for emitted_warning, expected_warning in zip(emitted_warnings, expected_warnings): if expected_warning != emitted_warning: -- cgit v1.2.1 From 30b32be1aba7277077fa82b9ac28d07a41c60e50 Mon Sep 17 00:00:00 2001 From: Dieter Verfaillie Date: Tue, 28 May 2013 17:28:20 +0200 Subject: tests: fix warning tests message sorting... ... by using the actual line numbers instead of sorting the whole expected/emitted string. The latter is wrong as for example tests/warn/annotationparser.h line 109 got sorted before line 120 which got sorted before line 12. --- tests/warn/warningtester.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'tests/warn/warningtester.py') diff --git a/tests/warn/warningtester.py b/tests/warn/warningtester.py index fc3c3d2d..63a1e646 100644 --- a/tests/warn/warningtester.py +++ b/tests/warn/warningtester.py @@ -130,8 +130,9 @@ def check(args): expected_warnings = _extract_expected(filename) - expected_warnings.sort() - emitted_warnings.sort() + sortkey = lambda x: int(x.split(':')[0]) + expected_warnings.sort(key=sortkey) + emitted_warnings.sort(key=sortkey) if len(expected_warnings) != len(emitted_warnings): raise SystemExit('ERROR in %r: %d warnings were emitted, ' -- cgit v1.2.1 From e4907187dd57c1a0e572fd8bd1eb39d07842ef1d Mon Sep 17 00:00:00 2001 From: Dieter Verfaillie Date: Wed, 31 Jul 2013 07:18:03 +0200 Subject: tests: fix diff output Empty lines do get removed or added sometimes, so make sure we see those in our diff output. --- tests/warn/warningtester.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'tests/warn/warningtester.py') diff --git a/tests/warn/warningtester.py b/tests/warn/warningtester.py index 63a1e646..2192a954 100644 --- a/tests/warn/warningtester.py +++ b/tests/warn/warningtester.py @@ -60,21 +60,18 @@ def _diff(a, b): if tag == 'equal': for line in a[i1:i2]: for l in line.split('\n'): - if l != '': - retval += ' ' + l + '\n' + retval += ' ' + l + '\n' continue if tag in ('replace', 'delete'): for line in a[i1:i2]: for l in line.split('\n'): - if l != '': - retval += '-' + l + '\n' + retval += '-' + l + '\n' if tag in ('replace', 'insert'): for line in b[j1:j2]: for l in line.split('\n'): - if l != '': - retval += '+' + l + '\n' + retval += '+' + l + '\n' return retval -- cgit v1.2.1 From 30b17d39adc7a7284b926cac6ada566eb1b62292 Mon Sep 17 00:00:00 2001 From: Dieter Verfaillie Date: Tue, 14 May 2013 17:06:24 +0200 Subject: giscanner: rename AnnotationParser() to GtkDocCommentBlockParser() Clarify the purpose of what up until now was know as the AnnotationParser() class, as it does more than just extracting annotations, it parses the complete GTK-Doc comment block. --- tests/warn/warningtester.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tests/warn/warningtester.py') diff --git a/tests/warn/warningtester.py b/tests/warn/warningtester.py index 2192a954..15822cfe 100644 --- a/tests/warn/warningtester.py +++ b/tests/warn/warningtester.py @@ -10,7 +10,7 @@ sys.path.insert(0, path) # Not correct, but enough to get the tests going uninstalled __builtin__.__dict__['DATADIR'] = path -from giscanner.annotationparser import AnnotationParser +from giscanner.annotationparser import GtkDocCommentBlockParser from giscanner.ast import Include, Namespace from giscanner.introspectablepass import IntrospectablePass from giscanner.maintransformer import MainTransformer @@ -114,8 +114,8 @@ def check(args): ss.parse_macros([filename]) transformer.parse(ss.get_symbols()) - ap = AnnotationParser() - blocks = ap.parse(ss.get_comments()) + cbp = GtkDocCommentBlockParser() + blocks = cbp.parse(ss.get_comments()) main = MainTransformer(transformer, blocks) main.transform() -- cgit v1.2.1 From e88a99496cf4091ec16670a2fe656878fc055692 Mon Sep 17 00:00:00 2001 From: Dieter Verfaillie Date: Wed, 15 May 2013 22:38:28 +0200 Subject: giscanner: rename the parse() method to parse_comment_blocks() We already have a parse_comment_block() method parsing a single GTK-Doc comment block so it only seems natural to have a plural parse_comment_blocks() to go along with that. --- tests/warn/warningtester.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/warn/warningtester.py') diff --git a/tests/warn/warningtester.py b/tests/warn/warningtester.py index 15822cfe..c78f92a7 100644 --- a/tests/warn/warningtester.py +++ b/tests/warn/warningtester.py @@ -115,7 +115,7 @@ def check(args): transformer.parse(ss.get_symbols()) cbp = GtkDocCommentBlockParser() - blocks = cbp.parse(ss.get_comments()) + blocks = cbp.parse_comment_blocks(ss.get_comments()) main = MainTransformer(transformer, blocks) main.transform() -- cgit v1.2.1 From 6d9022311b5d3bfb48895466880c2a15235b63a6 Mon Sep 17 00:00:00 2001 From: Dieter Verfaillie Date: Wed, 24 Jul 2013 16:56:20 +0200 Subject: giscanner: give message.ERROR a purpose It's not yet being used but will be in the future by annotationparser.py to signal the difference between message.WARNING: something is wrong but the comment block can still be parsed and serialized back into a comment block without information being lost message.ERROR: something is wrong and the comment block can *not* be parsed and serialized back into a comment block without information being lost Different tools can then act accordingly. Nothing will change for g-ir-scanner but this will be important for the GTK-Doc comment block rewriting tool to prevent extremely broken input leading to even more broken output... --- tests/warn/warningtester.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests/warn/warningtester.py') diff --git a/tests/warn/warningtester.py b/tests/warn/warningtester.py index c78f92a7..b2117910 100644 --- a/tests/warn/warningtester.py +++ b/tests/warn/warningtester.py @@ -14,7 +14,7 @@ from giscanner.annotationparser import GtkDocCommentBlockParser from giscanner.ast import Include, Namespace from giscanner.introspectablepass import IntrospectablePass from giscanner.maintransformer import MainTransformer -from giscanner.message import MessageLogger +from giscanner.message import MessageLogger, WARNING, ERROR, FATAL from giscanner.sourcescanner import SourceScanner from giscanner.transformer import Transformer from giscanner.scannermain import process_packages @@ -97,7 +97,7 @@ def check(args): output = ChunkedIO() namespace = Namespace('Test', '1.0') logger = MessageLogger.get(namespace=namespace, output=output) - logger.enable_warnings(True) + logger.enable_warnings((WARNING, ERROR, FATAL)) transformer = Transformer(namespace) transformer.set_include_paths([os.path.join(top_srcdir, 'gir'), top_builddir]) -- cgit v1.2.1