OSDN Git Service

Fix validate_failures.py in standalone testing.
authordnovillo <dnovillo@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 6 Feb 2013 20:22:56 +0000 (20:22 +0000)
committerdnovillo <dnovillo@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 6 Feb 2013 20:22:56 +0000 (20:22 +0000)
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@195817 138bc75d-0d04-0410-961f-82ee72b054a4

contrib/ChangeLog
contrib/testsuite-management/validate_failures.py

index 0ace63e..2e4db76 100644 (file)
@@ -1,3 +1,12 @@
+2013-02-06  Diego Novillo  <dnovillo@google.com>
+
+       * 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  <aldot@gcc.gnu.org>
 
        * testsuite-management/validate_failures.py
index 5c80ca3..76f9aab 100755 (executable)
@@ -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 <dnovillo@google.com>
 #
-# 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 @@ _MANIFEST_PATH_PATTERN = '%s/%s/%s.xfail'
 _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/<target_alias>.xfail)')
+                    'taken from '
+                    'contrib/testsuite-managment/<target_alias>.xfail)')
   parser.add_option('--produce_manifest', action='store_true',
                     dest='produce_manifest', default=False,
                     help='Produce the manifest for the current '