[lit] Rename lit.{TestFormats,Util} to their aliased names {formats,util}.

- With compatibility hack in lit.__init__, so this hopefully shouldn't break
   anything.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188040 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Daniel Dunbar 2013-08-09 00:37:15 +00:00
parent 38649827c3
commit 128ce319ec
7 changed files with 24 additions and 20 deletions

View File

@ -4,9 +4,9 @@ import os
import sys
import lit.Test
import lit.TestFormats
import lit.formats
import lit.TestingConfig
import lit.Util
import lit.util
class LitConfig:
"""LitConfig - Configuration data for a 'lit' test runner instance, shared
@ -22,10 +22,10 @@ class LitConfig:
Test = lit.Test
# Provide access to built-in formats.
formats = lit.TestFormats
formats = lit.formats
# Provide access to built-in utility functions.
util = lit.Util
util = lit.util
def __init__(self, progname, path, quiet,
useValgrind, valgrindLeakCheck, valgrindArgs,
@ -80,7 +80,7 @@ class LitConfig:
if self.bashPath is not None:
return self.bashPath
self.bashPath = lit.Util.which('bash', os.pathsep.join(self.path))
self.bashPath = lit.util.which('bash', os.pathsep.join(self.path))
if self.bashPath is None:
# Check some known paths.
for path in ('/bin/bash', '/usr/bin/bash', '/usr/local/bin/bash'):
@ -96,13 +96,13 @@ class LitConfig:
def getToolsPath(self, dir, paths, tools):
if dir is not None and os.path.isabs(dir) and os.path.isdir(dir):
if not lit.Util.checkToolsPath(dir, tools):
if not lit.util.checkToolsPath(dir, tools):
return None
else:
dir = lit.Util.whichTools(tools, paths)
dir = lit.util.whichTools(tools, paths)
# bash
self.bashPath = lit.Util.which('bash', dir)
self.bashPath = lit.util.which('bash', dir)
if self.bashPath is None:
self.note("Unable to find 'bash.exe'.")
self.bashPath = ''

View File

@ -1,7 +1,7 @@
from __future__ import absolute_import
import itertools
import lit.Util
import lit.util
from lit.ShCommands import Command, Pipeline, Seq
class ShLexer:
@ -75,7 +75,7 @@ class ShLexer:
# Outside of a string, '\\' escapes everything.
self.eat()
if self.pos == self.end:
lit.Util.warning(
lit.util.warning(
"escape at end of quoted argument in: %r" % self.data)
return str
str += self.eat()
@ -93,7 +93,7 @@ class ShLexer:
# Inside a '"' quoted string, '\\' only escapes the quote
# character and backslash, otherwise it is preserved.
if self.pos == self.end:
lit.Util.warning(
lit.util.warning(
"escape at end of quoted argument in: %r" % self.data)
return str
c = self.eat()
@ -105,7 +105,7 @@ class ShLexer:
str += '\\' + c
else:
str += c
lit.Util.warning("missing quote character in %r" % self.data)
lit.util.warning("missing quote character in %r" % self.data)
return str
def lex_arg_checked(self, c):

View File

@ -10,7 +10,7 @@ except ImportError:
import lit.ShUtil as ShUtil
import lit.Test as Test
import lit.Util as Util
import lit.util
class InternalShellError(Exception):
def __init__(self, command, message):
@ -154,7 +154,7 @@ def executeShCmd(cmd, cfg, cwd, results):
# Resolve the executable path ourselves.
args = list(j.args)
args[0] = Util.which(args[0], cfg.environment['PATH'])
args[0] = lit.util.which(args[0], cfg.environment['PATH'])
if not args[0]:
raise InternalShellError(j, '%r: command not found' % j.args[0])
@ -472,7 +472,7 @@ def executeShTest(test, litConfig, useExternalSh,
return (Test.PASS, '')
# Create the output directory if it does not already exist.
Util.mkdir_p(os.path.dirname(tmpBase))
lit.util.mkdir_p(os.path.dirname(tmpBase))
if useExternalSh:
res = executeScript(test, litConfig, tmpBase, script, execdir)

View File

@ -9,3 +9,7 @@ __versioninfo__ = (0, 3, 0)
__version__ = '.'.join(str(v) for v in __versioninfo__) + 'dev'
__all__ = []
# Compatibility hacks for old names.
from . import util as Util
from . import formats as TestFormats

View File

@ -4,7 +4,7 @@ import sys
import lit.Test
import lit.TestRunner
import lit.Util
import lit.util
kIsWindows = sys.platform in ['win32', 'cygwin']
@ -28,7 +28,7 @@ class GoogleTest(object):
localConfig: TestingConfig instance"""
try:
lines = lit.Util.capture([path, '--gtest_list_tests'],
lines = lit.util.capture([path, '--gtest_list_tests'],
env=localConfig.environment)
lines = lines.decode('ascii')
if kIsWindows:

View File

@ -12,7 +12,7 @@ import math, os, platform, random, re, sys, time, threading, traceback
import lit.ProgressBar
import lit.LitConfig
import lit.Test
import lit.Util
import lit.util
import lit.discovery
@ -255,7 +255,7 @@ def main(builtinParameters = {}):
# I haven't seen this bug occur with 2.5.2 and later, so only enable multiple
# threads by default there.
if sys.hexversion >= 0x2050200:
opts.numThreads = lit.Util.detectCPUs()
opts.numThreads = lit.util.detectCPUs()
else:
opts.numThreads = 1
@ -417,7 +417,7 @@ def main(builtinParameters = {}):
byTime = list(times.items())
byTime.sort(key = lambda item: item[1])
if byTime:
lit.Util.printHistogram(byTime, title='Tests')
lit.util.printHistogram(byTime, title='Tests')
for name,code in (('Expected Passes ', lit.Test.PASS),
('Expected Failures ', lit.Test.XFAIL),