diff options
author | Stephen Hines <srhines@google.com> | 2015-03-23 12:10:34 -0700 |
---|---|---|
committer | Stephen Hines <srhines@google.com> | 2015-03-23 12:10:34 -0700 |
commit | ebe69fe11e48d322045d5949c83283927a0d790b (patch) | |
tree | c92f1907a6b8006628a4b01615f38264d29834ea /utils/lit | |
parent | b7d2e72b02a4cb8034f32f8247a2558d2434e121 (diff) | |
download | external_llvm-ebe69fe11e48d322045d5949c83283927a0d790b.zip external_llvm-ebe69fe11e48d322045d5949c83283927a0d790b.tar.gz external_llvm-ebe69fe11e48d322045d5949c83283927a0d790b.tar.bz2 |
Update aosp/master LLVM for rebase to r230699.
Change-Id: I2b5be30509658cb8266be782de0ab24f9099f9b9
Diffstat (limited to 'utils/lit')
-rw-r--r-- | utils/lit/lit/LitConfig.py | 2 | ||||
-rw-r--r-- | utils/lit/lit/Test.py | 5 | ||||
-rw-r--r-- | utils/lit/lit/TestingConfig.py | 6 | ||||
-rw-r--r-- | utils/lit/lit/formats/googletest.py | 1 | ||||
-rw-r--r-- | utils/lit/lit/util.py | 18 | ||||
-rwxr-xr-x | utils/lit/utils/check-coverage | 2 |
6 files changed, 18 insertions, 16 deletions
diff --git a/utils/lit/lit/LitConfig.py b/utils/lit/lit/LitConfig.py index b0dde5d..b818380 100644 --- a/utils/lit/lit/LitConfig.py +++ b/utils/lit/lit/LitConfig.py @@ -76,7 +76,6 @@ class LitConfig: self.bashPath = lit.util.which('bash') if self.bashPath is None: - self.warning("Unable to find 'bash'.") self.bashPath = '' return self.bashPath @@ -91,7 +90,6 @@ class LitConfig: # bash self.bashPath = lit.util.which('bash', dir) if self.bashPath is None: - self.note("Unable to find 'bash.exe'.") self.bashPath = '' return dir diff --git a/utils/lit/lit/Test.py b/utils/lit/lit/Test.py index b810230..682d04f 100644 --- a/utils/lit/lit/Test.py +++ b/utils/lit/lit/Test.py @@ -91,7 +91,8 @@ class JSONMetricValue(MetricValue): self.value = value def format(self): - return str(self.value) + e = JSONEncoder(indent=2, sort_keys=True) + return e.encode(self.value) def todata(self): return self.value @@ -252,4 +253,4 @@ class Test: xml += "\n\t</failure>\n</testcase>" else: xml += "/>" - return xml
\ No newline at end of file + return xml diff --git a/utils/lit/lit/TestingConfig.py b/utils/lit/lit/TestingConfig.py index 52cebbf..c7ef94d 100644 --- a/utils/lit/lit/TestingConfig.py +++ b/utils/lit/lit/TestingConfig.py @@ -26,7 +26,11 @@ class TestingConfig: 'LD_PRELOAD', 'ASAN_OPTIONS', 'UBSAN_OPTIONS', 'LSAN_OPTIONS'] for var in pass_vars: - environment[var] = os.environ.get(var, '') + val = os.environ.get(var, '') + # Check for empty string as some variables such as LD_PRELOAD cannot be empty + # ('') for OS's such as OpenBSD. + if val: + environment[var] = val if sys.platform == 'win32': environment.update({ diff --git a/utils/lit/lit/formats/googletest.py b/utils/lit/lit/formats/googletest.py index 1b5b785..59ac3c5 100644 --- a/utils/lit/lit/formats/googletest.py +++ b/utils/lit/lit/formats/googletest.py @@ -31,7 +31,6 @@ class GoogleTest(TestFormat): try: lines = lit.util.capture([path, '--gtest_list_tests'], env=localConfig.environment) - lines = lines.decode('utf-8') if kIsWindows: lines = lines.replace('\r', '') lines = lines.split('\n') diff --git a/utils/lit/lit/util.py b/utils/lit/lit/util.py index ca1aeb6..08f7b71 100644 --- a/utils/lit/lit/util.py +++ b/utils/lit/lit/util.py @@ -16,6 +16,12 @@ def to_string(bytes): return bytes return to_bytes(bytes) +def convert_string(bytes): + try: + return to_string(bytes.decode('utf-8')) + except UnicodeError: + return str(bytes) + def detectCPUs(): """ Detects the number of CPUs on a system. Cribbed from pp. @@ -60,7 +66,7 @@ def capture(args, env=None): p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env) out,_ = p.communicate() - return out + return convert_string(out) def which(command, paths = None): """which(command, [paths]) - Look up the given command in the paths string @@ -166,14 +172,8 @@ def executeCommand(command, cwd=None, env=None): raise KeyboardInterrupt # Ensure the resulting output is always of string type. - try: - out = to_string(out.decode('utf-8')) - except: - out = str(out) - try: - err = to_string(err.decode('utf-8')) - except: - err = str(err) + out = convert_string(out) + err = convert_string(err) return out, err, exitCode diff --git a/utils/lit/utils/check-coverage b/utils/lit/utils/check-coverage index 128e827..cded7a2 100755 --- a/utils/lit/utils/check-coverage +++ b/utils/lit/utils/check-coverage @@ -23,7 +23,7 @@ fi # sitecustomize. if ! python -c \ 'import sitecustomize, sys; sys.exit("coverage" not in dir(sitecustomize))' \ - &> /dev/null; then + >/dev/null 2>&1; then printf 1>&2 "error: active python does not appear to enable coverage in its 'sitecustomize.py'\n" exit 1 fi |