From 2909605f962292069aa2fc04c2f7be8f1309da28 Mon Sep 17 00:00:00 2001 From: Marius Hein Date: Tue, 11 Jun 2013 16:05:29 +0200 Subject: [PATCH] Unify test runners options, args and output Fix runtests and checkswag refs #4244 --- test/php/checkswag | 11 ++++------- test/php/runtests | 16 +++++----------- 2 files changed, 9 insertions(+), 18 deletions(-) diff --git a/test/php/checkswag b/test/php/checkswag index db1113fc6..b5211a2b0 100755 --- a/test/php/checkswag +++ b/test/php/checkswag @@ -7,8 +7,8 @@ from optparse import OptionParser, BadOptionError, AmbiguousOptionError APPLICATION = 'phpcs' -DEFAULT_ARGS = ['-p', '--standard', 'PSR2', '--extensions', - 'php', '--encoding', 'utf-8'] +DEFAULT_ARGS = ['-p', '--standard=PSR2', '--extensions=php', + '--encoding=utf-8'] REPORT_DIRECTORY = '../../build/log' @@ -89,12 +89,9 @@ def main(): if options.verbose: command_options.append('-v') if options.build: - command_options.append('--report-checkstyle') - command_options.append(os.path.join(get_report_directory(), - 'phpcs_results.xml')) + command_options.append('--report-checkstyle=' + os.path.join(get_report_directory(), 'phpcs_results.xml')) if options.exclude: - command_options.extend(['--ignore-patterns', - ','.join(options.exclude)]) + command_options.extend(['--ignore=' + ','.join(options.exclude)]) if options.include: arguments.extend(options.include) else: diff --git a/test/php/runtests b/test/php/runtests index bb5d95c03..58f74a980 100755 --- a/test/php/runtests +++ b/test/php/runtests @@ -3,6 +3,7 @@ import os import sys import subprocess +from fnmatch import fnmatch from optparse import OptionParser, BadOptionError, AmbiguousOptionError @@ -63,12 +64,8 @@ def parse_commandline(): help='Enable reporting.') parser.add_option('-v', '--verbose', action='store_true', help='Be more verbose.') - parser.add_option('-i', '--include', metavar='PATTERN', action='append', - help='Include only specific files/test cases.' - ' (Can be supplied multiple times.)') - parser.add_option('-e', '--exclude', metavar='PATTERN', action='append', - help='Exclude specific files/test cases. ' - '(Can be supplied multiple times.)') + parser.add_option('-i', '--include', metavar='PATTERN', action='store', + help='Include only specific files/test cases.') return parser.parse_args() @@ -98,16 +95,13 @@ def main(): command_options.append(os.path.join(report_directory, 'phpunit_coverage.xml')) if options.include: - command_options.extend(['--group', ','.join(options.include)]) - if options.exclude: - command_options.extend(['--exclude-group', - ','.join(options.exclude)]) + command_options.append('--filter') + command_options.append(options.include) # Application invocation.. execute_command([application_path] + DEFAULT_ARGS + command_options + arguments) return 0 - if __name__ == '__main__': sys.exit(main())