aboutsummaryrefslogtreecommitdiff
path: root/automation/clients/report/validate_failures.py
diff options
context:
space:
mode:
Diffstat (limited to 'automation/clients/report/validate_failures.py')
-rwxr-xr-xautomation/clients/report/validate_failures.py48
1 files changed, 28 insertions, 20 deletions
diff --git a/automation/clients/report/validate_failures.py b/automation/clients/report/validate_failures.py
index e99c9054..5db356d1 100755
--- a/automation/clients/report/validate_failures.py
+++ b/automation/clients/report/validate_failures.py
@@ -24,7 +24,6 @@
# along with GCC; see the file COPYING. If not, write to
# the Free Software Foundation, 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.
-
"""This script provides a coarser XFAILing mechanism that requires no
detailed DejaGNU markings. This is useful in a variety of scenarios:
@@ -78,15 +77,13 @@ def GetSumFiles(build_dir):
for root, _, filenames in os.walk(build_dir):
summaries.extend([os.path.join(root, filename)
- for filename in filenames
- if filename.endswith('.sum')])
+ for filename in filenames if filename.endswith('.sum')])
return map(os.path.normpath, summaries)
def ValidBuildDirectory(build_dir, target):
- mandatory_paths = [build_dir,
- os.path.join(build_dir, 'Makefile')]
+ mandatory_paths = [build_dir, os.path.join(build_dir, 'Makefile')]
extra_paths = [os.path.join(build_dir, target),
os.path.join(build_dir, 'build-%s' % target)]
@@ -104,8 +101,7 @@ def GetManifestPath(build_dir):
target = makefile['target_alias']
if not ValidBuildDirectory(build_dir, target):
- logging.error(
- '%s is not a valid GCC top level build directory.', build_dir)
+ logging.error('%s is not a valid GCC top level build directory.', build_dir)
sys.exit(1)
logging.info('Discovered source directory: "%s"', srcdir)
@@ -123,8 +119,8 @@ def CompareResults(manifest, actual):
actual_vs_manifest = actual - manifest
# Filter out tests marked flaky.
- manifest_without_flaky_tests = set(
- filter(lambda result: not result.flaky, manifest))
+ manifest_without_flaky_tests = set(filter(lambda result: not result.flaky,
+ manifest))
# Simlarly for all the tests in the manifest.
manifest_vs_actual = manifest_without_flaky_tests - actual
@@ -136,7 +132,7 @@ def LogResults(level, results):
log_fun = getattr(logging, level)
for num, result in enumerate(sorted(results), start=1):
- log_fun(" %d) %s", num, result)
+ log_fun(' %d) %s', num, result)
def CheckExpectedResults(manifest_path, build_dir):
@@ -194,26 +190,37 @@ def ProduceManifest(manifest_path, build_dir, overwrite):
with open(manifest_path, 'w') as manifest_file:
manifest_strings = [manifest.Generate() for manifest in manifests]
- logging.info('Writing manifest to "%s".' % manifest_path)
+ logging.info('Writing manifest to "%s".', manifest_path)
manifest_file.write('\n'.join(manifest_strings))
def Main(argv):
parser = optparse.OptionParser(usage=__doc__)
parser.add_option(
- '-b', '--build_dir',
- dest='build_dir', action='store',metavar='PATH', default=os.getcwd(),
+ '-b',
+ '--build_dir',
+ dest='build_dir',
+ action='store',
+ metavar='PATH',
+ default=os.getcwd(),
help='Build directory to check. (default: current directory)')
+ parser.add_option('-m',
+ '--manifest',
+ dest='manifest',
+ action='store_true',
+ help='Produce the manifest for the current build.')
parser.add_option(
- '-m', '--manifest', dest='manifest', action='store_true',
- help='Produce the manifest for the current build.')
- parser.add_option(
- '-f', '--force', dest='force', action='store_true',
+ '-f',
+ '--force',
+ dest='force',
+ action='store_true',
help=('Overwrite an existing manifest file, if user requested creating '
'new one. (default: False)'))
- parser.add_option(
- '-v', '--verbose', dest='verbose', action='store_true',
- help='Increase verbosity.')
+ parser.add_option('-v',
+ '--verbose',
+ dest='verbose',
+ action='store_true',
+ help='Increase verbosity.')
options, _ = parser.parse_args(argv[1:])
if options.verbose:
@@ -226,6 +233,7 @@ def Main(argv):
else:
CheckExpectedResults(manifest_path, options.build_dir)
+
if __name__ == '__main__':
logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.INFO)
Main(sys.argv)