From 828e50c53cc7d1d4e30ba32e2a7c7343d7f5fe46 Mon Sep 17 00:00:00 2001 From: Diego Novillo Date: Wed, 6 Feb 2013 15:22:56 -0500 Subject: [PATCH] Fix validate_failures.py in standalone testing. When using validate_failures.py with --manifest and --results, we don't need a GCC build directory. This is useful when using the validator outside of the build tree. We were insisting on finding a valid build tree regardless of those options. Tested on x86_64. Committed to trunk. * testsuite-management/validate_failures.py: Update Copyright years. Request contributions not to use Python features newer than 2.4. (GetBuildData): If this is not a build directory, emit an error only if --results or --manifest are missing. From-SVN: r195817 --- contrib/ChangeLog | 9 ++++++ .../testsuite-management/validate_failures.py | 28 ++++++++++++++----- 2 files changed, 30 insertions(+), 7 deletions(-) diff --git a/contrib/ChangeLog b/contrib/ChangeLog index 0ace63edcf0b..2e4db76d18e1 100644 --- a/contrib/ChangeLog +++ b/contrib/ChangeLog @@ -1,3 +1,12 @@ +2013-02-06 Diego Novillo + + * testsuite-management/validate_failures.py: Update + Copyright years. + Request contributions not to use Python features newer + than 2.4. + (GetBuildData): If this is not a build directory, + emit an error only if --results or --manifest are missing. + 2013-02-06 Bernhard Reutner-Fischer * testsuite-management/validate_failures.py diff --git a/contrib/testsuite-management/validate_failures.py b/contrib/testsuite-management/validate_failures.py index 5c80ca30be85..76f9aab1087b 100755 --- a/contrib/testsuite-management/validate_failures.py +++ b/contrib/testsuite-management/validate_failures.py @@ -2,10 +2,14 @@ # Script to compare testsuite failures against a list of known-to-fail # tests. +# +# NOTE: This script is used in installations that are running Python 2.4. +# Please stick to syntax features available in 2.4 and earlier +# versions. # Contributed by Diego Novillo # -# Copyright (C) 2011, 2012 Free Software Foundation, Inc. +# Copyright (C) 2011-2013 Free Software Foundation, Inc. # # This file is part of GCC. # @@ -78,7 +82,7 @@ _OPTIONS = None def Error(msg): - print >>sys.stderr, '\nerror: %s' % msg + print >>sys.stderr, 'error: %s' % msg sys.exit(1) @@ -358,15 +362,24 @@ def GetManifestPath(srcdir, target, user_provided_must_exist): Error('Manifest does not exist: %s' % manifest_path) return manifest_path else: + assert srdir and target return _MANIFEST_PATH_PATTERN % (srcdir, _MANIFEST_SUBDIR, target) def GetBuildData(): - target = GetMakefileValue('%s/Makefile' % _OPTIONS.build_dir, 'target_alias=') srcdir = GetMakefileValue('%s/Makefile' % _OPTIONS.build_dir, 'srcdir =') + target = GetMakefileValue('%s/Makefile' % _OPTIONS.build_dir, 'target_alias=') if not ValidBuildDirectory(_OPTIONS.build_dir, target): - Error('%s is not a valid GCC top level build directory.' % - _OPTIONS.build_dir) + # If we have been given a set of results to use, we may + # not be inside a valid GCC build directory. In that case, + # the user must provide both a manifest file and a set + # of results to check against it. + if not _OPTIONS.results or not _OPTIONS.manifest: + Error('%s is not a valid GCC top level build directory. ' + 'You must use --manifest and --results to do the validation.' % + _OPTIONS.build_dir) + else: + return None, None print 'Source directory: %s' % srcdir print 'Build target: %s' % target return srcdir, target @@ -410,7 +423,7 @@ def PerformComparison(expected, actual, ignore_missing_failures): def CheckExpectedResults(): - (srcdir, target) = GetBuildData() + srcdir, target = GetBuildData() manifest_path = GetManifestPath(srcdir, target, True) print 'Manifest: %s' % manifest_path manifest = GetManifest(manifest_path) @@ -485,7 +498,8 @@ def Main(argv): parser.add_option('--manifest', action='store', type='string', dest='manifest', default=None, help='Name of the manifest file to use (default = ' - 'taken from contrib/testsuite-managment/.xfail)') + 'taken from ' + 'contrib/testsuite-managment/.xfail)') parser.add_option('--produce_manifest', action='store_true', dest='produce_manifest', default=False, help='Produce the manifest for the current '