aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Albert <danalbert@google.com>2017-05-08 14:35:08 -0700
committerDan Albert <danalbert@google.com>2017-05-08 14:35:08 -0700
commit08f4b13a97b1594d2da897f21fa6476143a7dfc4 (patch)
tree18c7637acb3713187834f4d81c31cd52a52cc7ce
parent66dcc9fca28d2c0d3ab1b56721287f0778a28865 (diff)
downloadndk-08f4b13a97b1594d2da897f21fa6476143a7dfc4.tar.gz
Get rid of the test logs directory for validate.py.
The test logs aren't particularly useful as-is. These were necessary back when we didn't have good test summary printing, but that was fixed ages ago. These are not just overly verbose versions of what we already have, and it's not obvious which logs actually contain failures anyway. Just use a less verbose StdoutPrinter instead of logging to a file. Only errors will be printed to stdout. Keep the argument for the moment since CI expects it to exist. Test: ./validate.py Bug: None Change-Id: I3986a8e19698a58795492dd0f6e8bfb2fb75e92d
-rw-r--r--tests/printers.py10
-rw-r--r--tests/runners.py41
-rwxr-xr-xvalidate.py5
3 files changed, 28 insertions, 28 deletions
diff --git a/tests/printers.py b/tests/printers.py
index 29f4a0b1a..3726ce95b 100644
--- a/tests/printers.py
+++ b/tests/printers.py
@@ -40,12 +40,15 @@ class Printer(object):
class FilePrinter(Printer):
- def __init__(self, to_file, use_color=False, show_all=False):
+ def __init__(self, to_file, use_color=False, show_all=False, quiet=False):
self.file = to_file
self.use_color = use_color
self.show_all = show_all
+ self.quiet = quiet
def print_result(self, result):
+ if self.quiet and not result.failed():
+ return
print(result.to_string(colored=self.use_color), file=self.file)
def print_summary(self, report):
@@ -63,5 +66,6 @@ class FilePrinter(Printer):
class StdoutPrinter(FilePrinter):
- def __init__(self, use_color=False, show_all=False):
- super(StdoutPrinter, self).__init__(sys.stdout, use_color, show_all)
+ def __init__(self, use_color=False, show_all=False, quiet=False):
+ super(StdoutPrinter, self).__init__(
+ sys.stdout, use_color, show_all, quiet)
diff --git a/tests/runners.py b/tests/runners.py
index 52957c546..c763e7b88 100644
--- a/tests/runners.py
+++ b/tests/runners.py
@@ -244,28 +244,25 @@ def get_headers_text(deprecated_headers):
return 'deprecated' if deprecated_headers else 'unified'
-def run_tests(ndk_path, device, abi, toolchain, out_dir, log_dir, test_filter,
- force_deprecated_headers, suites):
- print('Running {} {} tests with {} headers for {}... '.format(
- toolchain, abi, get_headers_text(force_deprecated_headers), device),
- end='')
+def run_tests(ndk_path, device, abi, toolchain, out_dir, test_filter,
+ force_deprecated_headers, suites, use_color):
+ test_desc = '{} {} tests with {} headers for {}'.format(
+ toolchain, abi, get_headers_text(force_deprecated_headers), device)
+ print('Running {}... '.format(test_desc))
sys.stdout.flush()
- toolchain_name = 'gcc' if toolchain == '4.9' else toolchain
- log_file_name = '{}-{}-{}.log'.format(toolchain_name, abi, device.version)
- with open(os.path.join(log_dir, log_file_name), 'w') as log_file:
- printer = tests.printers.FilePrinter(log_file)
- report = run_single_configuration(
- ndk_path, out_dir, printer, abi, toolchain,
- device_serial=device.serial, test_filter=test_filter,
- force_deprecated_headers=force_deprecated_headers, suites=suites)
- print('PASS' if report.successful else 'FAIL')
- return report
-
-
-def run_for_fleet(ndk_path, fleet, out_dir, log_dir, test_filter,
- versions, abis, toolchains, headers_configs, suites,
- use_color=False):
+ printer = tests.printers.StdoutPrinter(use_color=use_color, quiet=True)
+ report = run_single_configuration(
+ ndk_path, out_dir, printer, abi, toolchain,
+ device_serial=device.serial, test_filter=test_filter,
+ force_deprecated_headers=force_deprecated_headers, suites=suites)
+ print('{} {}'.format(
+ 'PASS' if report.successful else 'FAIL', test_desc))
+ return report
+
+
+def run_for_fleet(ndk_path, fleet, out_dir, test_filter, versions, abis,
+ toolchains, headers_configs, suites, use_color=False):
# Note that we are duplicating some testing here.
#
# * The build tests only vary per-device by the PIE configuration, so we
@@ -308,8 +305,8 @@ def run_for_fleet(ndk_path, fleet, out_dir, log_dir, test_filter,
details[config_name] = None
report = run_tests(
- ndk_path, device, abi, toolchain, out_dir, log_dir,
- test_filter, deprecated_headers, suites)
+ ndk_path, device, abi, toolchain, out_dir, test_filter,
+ deprecated_headers, suites, use_color)
pass_label = tests.util.maybe_color('PASS', 'green', use_color)
fail_label = tests.util.maybe_color('FAIL', 'red', use_color)
results.append('{}: {}'.format(
diff --git a/validate.py b/validate.py
index c96f5c166..bdda35273 100755
--- a/validate.py
+++ b/validate.py
@@ -307,9 +307,8 @@ def main():
with ndk.paths.temp_dir_in_out('validate-out') as out_dir:
import tests.runners
good, details = tests.runners.run_for_fleet(
- args.ndk, fleet, out_dir, args.log_dir, args.filter,
- args.platforms, args.abis, args.toolchains, headers_configs,
- args.suites, use_color)
+ args.ndk, fleet, out_dir, args.filter, args.platforms, args.abis,
+ args.toolchains, headers_configs, args.suites, use_color)
print_aggregate_details(details, use_color)