public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [RFA 7/8] validate_failures.py: New options --manifest_subdir, --manifest_name
@ 2012-11-24 22:59 Doug Evans
  2012-11-25 15:43 ` Diego Novillo
  0 siblings, 1 reply; 4+ messages in thread
From: Doug Evans @ 2012-11-24 22:59 UTC (permalink / raw)
  To: dnovillo, gcc-patches

Hi.
This seventh patch adds new options --manifest_subdir, --manifest_name.
Useful when using validate_failures.py with a different tool, instead of gcc.

Ok to check in?

2012-11-24  Doug Evans  <dje@google.com>

	* testsuite-management/validate_failures.py: New options --manifest_subdir,
	--manifest_name.

--- validate_failures.py.with-first-6-patches	2012-11-24 13:47:44.410137689 -0800
+++ validate_failures.py	2012-11-24 13:53:40.253541475 -0800
@@ -37,7 +37,7 @@ executed it will:
 1- Determine the target built: TARGET
 2- Determine the source directory: SRCDIR
 3- Look for a failure manifest file in
-   <SRCDIR>/contrib/testsuite-management/<TARGET>.xfail
+   <SRCDIR>/<MANIFEST_SUBDIR>/<MANIFEST_NAME>.xfail
 4- Collect all the <tool>.sum files from the build tree.
 5- Produce a report stating:
    a- Failures expected in the manifest but not present in the build.
@@ -55,10 +55,15 @@ import sys
 # Handled test results.
 _VALID_TEST_RESULTS = [ 'FAIL', 'UNRESOLVED', 'XPASS', 'ERROR' ]
 
-# Pattern for naming manifest files.  The first argument should be
-# the toplevel GCC source directory.  The second argument is the
-# target triple used during the build.
-_MANIFEST_PATH_PATTERN = '%s/contrib/testsuite-management/%s.xfail'
+# Default subdirectory of srcdir in which to find the manifest file.
+_MANIFEST_DEFAULT_SUBDIR = 'contrib/testsuite-management'
+
+# Pattern for naming manifest files.
+# The first argument should be the toplevel GCC(/GNU tool) source directory.
+# The second argument is the manifest subdir.
+# The third argument is the manifest target, which defaults to the target
+# triplet used during the build.
+_MANIFEST_PATH_PATTERN = '%s/%s/%s.xfail'
 
 # The options passed to the program.
 options = None
@@ -284,6 +289,22 @@ def CompareResults(manifest, actual):
   return actual_vs_manifest, manifest_vs_actual
 
 
+def GetManifestPath(srcdir, target, user_provided_must_exist):
+  """Return the full path to the manifest file."""
+  manifest_path = None
+  if options.manifest_path:
+    manifest_path = options.manifest_path
+  elif options.manifest_name:
+    manifest_path = _MANIFEST_PATH_PATTERN % (
+      srcdir, options.manifest_subdir, options.manifest_name)
+  if manifest_path:
+    if user_provided_must_exist and not os.path.exists(manifest_path):
+      Error('Manifest does not exist: %s' % manifest_path)
+    return manifest_path
+  else:
+    return _MANIFEST_PATH_PATTERN % (srcdir, options.manifest_subdir, target)
+
+
 def GetBuildData():
   target = GetMakefileValue('%s/Makefile' % options.build_dir, 'target_alias=')
   srcdir = GetMakefileValue('%s/Makefile' % options.build_dir, 'srcdir =')
@@ -333,14 +354,8 @@ def PerformComparison(expected, actual, 
 
 
 def CheckExpectedResults():
-  if not options.manifest:
-    (srcdir, target) = GetBuildData()
-    manifest_path = _MANIFEST_PATH_PATTERN % (srcdir, target)
-  else:
-    manifest_path = options.manifest
-    if not os.path.exists(manifest_path):
-      Error('Manifest file %s does not exist.' % manifest_path)
-
+  (srcdir, target) = GetBuildData()
+  manifest_path = GetManifestPath(srcdir, target, True)
   print 'Manifest:         %s' % manifest_path
   manifest = GetManifest(manifest_path)
   sum_files = GetSumFiles(options.results, options.build_dir)
@@ -355,7 +370,8 @@ def CheckExpectedResults():
 
 def ProduceManifest():
   (srcdir, target) = GetBuildData()
-  manifest_path = _MANIFEST_PATH_PATTERN % (srcdir, target)
+  manifest_path = GetManifestPath(srcdir, target, False)
+  print 'Manifest:         %s' % manifest_path
   if os.path.exists(manifest_path) and not options.force:
     Error('Manifest file %s already exists.\nUse --force to overwrite.' %
           manifest_path)
@@ -418,6 +434,16 @@ def Main(argv):
                     dest='produce_manifest', default=False,
                     help='Produce the manifest for the current '
                     'build (default = False)')
+  parser.add_option('--manifest_subdir', action='store', type='string',
+                    dest='manifest_subdir',
+                    default=_MANIFEST_DEFAULT_SUBDIR,
+                    help=('Subdirectory of srcdir to find manifest file in\n'
+                          '(default = %s)' % _MANIFEST_DEFAULT_SUBDIR))
+  parser.add_option('--manifest_name', action='store', type='string',
+                    dest='manifest_name',
+                    default=None,
+                    help=('Name of manifest file, sans .xfail suffix'
+                          ' (default = target_alias)'))
   parser.add_option('--results', action='store', type='string',
                     dest='results', default=None, help='Space-separated list '
                     'of .sum files with the testing results to check. The '

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFA 7/8] validate_failures.py: New options --manifest_subdir, --manifest_name
  2012-11-24 22:59 [RFA 7/8] validate_failures.py: New options --manifest_subdir, --manifest_name Doug Evans
@ 2012-11-25 15:43 ` Diego Novillo
  2012-11-30  0:32   ` Doug Evans
  0 siblings, 1 reply; 4+ messages in thread
From: Diego Novillo @ 2012-11-25 15:43 UTC (permalink / raw)
  To: Doug Evans; +Cc: gcc-patches

On Sat, Nov 24, 2012 at 5:58 PM, Doug Evans <dje@google.com> wrote:
> Hi.
> This seventh patch adds new options --manifest_subdir, --manifest_name.
> Useful when using validate_failures.py with a different tool, instead of gcc.
>
> Ok to check in?
>
> 2012-11-24  Doug Evans  <dje@google.com>
>
>         * testsuite-management/validate_failures.py: New options --manifest_subdir,
>         --manifest_name.

OK.


Diego.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFA 7/8] validate_failures.py: New options --manifest_subdir, --manifest_name
  2012-11-25 15:43 ` Diego Novillo
@ 2012-11-30  0:32   ` Doug Evans
  2012-11-30 14:46     ` Diego Novillo
  0 siblings, 1 reply; 4+ messages in thread
From: Doug Evans @ 2012-11-30  0:32 UTC (permalink / raw)
  To: Diego Novillo; +Cc: gcc-patches

Diego Novillo writes:
 > On Sat, Nov 24, 2012 at 5:58 PM, Doug Evans <dje@google.com> wrote:
 > > Hi.
 > > This seventh patch adds new options --manifest_subdir, --manifest_name.
 > > Useful when using validate_failures.py with a different tool, instead of gcc.
 > >
 > > Ok to check in?
 > >
 > > 2012-11-24  Doug Evans  <dje@google.com>
 > >
 > >         * testsuite-management/validate_failures.py: New options --manifest_subdir,
 > >         --manifest_name.
 > 
 > OK.

This is another baby-steps kinda patch.
Instead of adding --manifest_{subdir,name},
this patch just parameterizes the gcc-specific manifest subdir,
and provides a utility to compute the manifest path.

Ok to check in?

2012-11-29  Doug Evans  <dje@google.com>

	* testsuite-management/validate_failures.py: Add function
	GetManifestPath.  New global _MANIFEST_SUBDIR.

Index: validate_failures.py
===================================================================
--- validate_failures.py	(revision 193968)
+++ validate_failures.py	(working copy)
@@ -37,7 +37,7 @@
 1- Determine the target built: TARGET
 2- Determine the source directory: SRCDIR
 3- Look for a failure manifest file in
-   <SRCDIR>/contrib/testsuite-management/<TARGET>.xfail
+   <SRCDIR>/<MANIFEST_SUBDIR>/<MANIFEST_NAME>.xfail
 4- Collect all the <tool>.sum files from the build tree.
 5- Produce a report stating:
    a- Failures expected in the manifest but not present in the build.
@@ -55,11 +55,16 @@
 # Handled test results.
 _VALID_TEST_RESULTS = [ 'FAIL', 'UNRESOLVED', 'XPASS', 'ERROR' ]
 
-# Pattern for naming manifest files.  The first argument should be
-# the toplevel GCC source directory.  The second argument is the
-# target triple used during the build.
-_MANIFEST_PATH_PATTERN = '%s/contrib/testsuite-management/%s.xfail'
+# Subdirectory of srcdir in which to find the manifest file.
+_MANIFEST_SUBDIR = 'contrib/testsuite-management'
 
+# Pattern for naming manifest files.
+# The first argument should be the toplevel GCC(/GNU tool) source directory.
+# The second argument is the manifest subdir.
+# The third argument is the manifest target, which defaults to the target
+# triplet used during the build.
+_MANIFEST_PATH_PATTERN = '%s/%s/%s.xfail'
+
 # The options passed to the program.
 _OPTIONS = None
 
@@ -284,6 +289,17 @@
   return actual_vs_manifest, manifest_vs_actual
 
 
+def GetManifestPath(srcdir, target, user_provided_must_exist):
+  """Return the full path to the manifest file."""
+  manifest_path = _OPTIONS.manifest
+  if manifest_path:
+    if user_provided_must_exist and not os.path.exists(manifest_path):
+      Error('Manifest does not exist: %s' % manifest_path)
+    return manifest_path
+  else:
+    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 =')
@@ -333,14 +349,8 @@
 
 
 def CheckExpectedResults():
-  if not _OPTIONS.manifest:
-    (srcdir, target) = GetBuildData()
-    manifest_path = _MANIFEST_PATH_PATTERN % (srcdir, target)
-  else:
-    manifest_path = _OPTIONS.manifest
-    if not os.path.exists(manifest_path):
-      Error('Manifest file %s does not exist.' % manifest_path)
-
+  (srcdir, target) = GetBuildData()
+  manifest_path = GetManifestPath(srcdir, target, True)
   print 'Manifest:         %s' % manifest_path
   manifest = GetManifest(manifest_path)
   sum_files = GetSumFiles(_OPTIONS.results, _OPTIONS.build_dir)
@@ -355,7 +365,8 @@
 
 def ProduceManifest():
   (srcdir, target) = GetBuildData()
-  manifest_path = _MANIFEST_PATH_PATTERN % (srcdir, target)
+  manifest_path = GetManifestPath(srcdir, target, False)
+  print 'Manifest:         %s' % manifest_path
   if os.path.exists(manifest_path) and not _OPTIONS.force:
     Error('Manifest file %s already exists.\nUse --force to overwrite.' %
           manifest_path)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFA 7/8] validate_failures.py: New options --manifest_subdir, --manifest_name
  2012-11-30  0:32   ` Doug Evans
@ 2012-11-30 14:46     ` Diego Novillo
  0 siblings, 0 replies; 4+ messages in thread
From: Diego Novillo @ 2012-11-30 14:46 UTC (permalink / raw)
  To: Doug Evans; +Cc: gcc-patches

On Thu, Nov 29, 2012 at 6:12 PM, Doug Evans <dje@google.com> wrote:
> Diego Novillo writes:
>  > On Sat, Nov 24, 2012 at 5:58 PM, Doug Evans <dje@google.com> wrote:
>  > > Hi.
>  > > This seventh patch adds new options --manifest_subdir, --manifest_name.
>  > > Useful when using validate_failures.py with a different tool, instead of gcc.
>  > >
>  > > Ok to check in?
>  > >
>  > > 2012-11-24  Doug Evans  <dje@google.com>
>  > >
>  > >         * testsuite-management/validate_failures.py: New options --manifest_subdir,
>  > >         --manifest_name.
>  >
>  > OK.
>
> This is another baby-steps kinda patch.
> Instead of adding --manifest_{subdir,name},
> this patch just parameterizes the gcc-specific manifest subdir,
> and provides a utility to compute the manifest path.
>
> Ok to check in?
>
> 2012-11-29  Doug Evans  <dje@google.com>
>
>         * testsuite-management/validate_failures.py: Add function
>         GetManifestPath.  New global _MANIFEST_SUBDIR.

OK.


Diego.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-11-30 14:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-24 22:59 [RFA 7/8] validate_failures.py: New options --manifest_subdir, --manifest_name Doug Evans
2012-11-25 15:43 ` Diego Novillo
2012-11-30  0:32   ` Doug Evans
2012-11-30 14:46     ` Diego Novillo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).