<div dir="ltr">I was hoping to get my change in first, what do you think?</div><br><div class="gmail_quote"><div dir="ltr">On Fri, Aug 7, 2015 at 12:54 PM Chaoren Lin <<a href="mailto:chaorenl@google.com">chaorenl@google.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">chaoren created this revision.<br>
chaoren added a reviewer: zturner.<br>
chaoren added a subscriber: lldb-commits.<br>
<br>
Update to D11816.<br>
<br>
<a href="http://reviews.llvm.org/D11843" rel="noreferrer" target="_blank">http://reviews.llvm.org/D11843</a><br>
<br>
Files:<br>
test/dosep.py<br>
<br>
Index: test/dosep.py<br>
===================================================================<br>
--- test/dosep.py<br>
+++ test/dosep.py<br>
@@ -66,41 +66,47 @@<br>
output_lock = None<br>
test_counter = None<br>
total_tests = None<br>
+test_name_len = None<br>
dotest_options = None<br>
output_on_success = False<br>
<br>
-def setup_global_variables(lock, counter, total, options):<br>
- global output_lock, test_counter, total_tests, dotest_options<br>
+def setup_global_variables(lock, counter, total, name_len, options):<br>
+ global output_lock, test_counter, total_tests, test_name_len<br>
+ global dotest_options<br>
output_lock = lock<br>
test_counter = counter<br>
total_tests = total<br>
+ test_name_len = name_len<br>
dotest_options = options<br>
<br>
def report_test_failure(name, command, output):<br>
global output_lock<br>
with output_lock:<br>
- print >> sys.stderr, "\n"<br>
+ print >> sys.stderr<br>
print >> sys.stderr, output<br>
+ print >> sys.stderr, "[%s FAILED]" % name<br>
print >> sys.stderr, "Command invoked: %s" % ' '.join(command)<br>
- update_progress("FAILED", name)<br>
+ update_progress(name)<br>
<br>
def report_test_pass(name, output):<br>
global output_lock, output_on_success<br>
with output_lock:<br>
if output_on_success:<br>
- print >> sys.stderr, "\n"<br>
+ print >> sys.stderr<br>
print >> sys.stderr, output<br>
- update_progress("PASSED", name)<br>
+ print >> sys.stderr, "[%s PASSED]" % name<br>
+ update_progress(name)<br>
<br>
-def update_progress(test_name, result):<br>
- global output_lock, test_counter, total_tests<br>
+def update_progress(test_name=""):<br>
+ global output_lock, test_counter, total_tests, test_name_len<br>
with output_lock:<br>
- if test_name != None:<br>
- sys.stderr.write("\n[%s %s] - %d out of %d test suites processed" %<br>
- (result, test_name, test_counter.value, total_tests))<br>
- else:<br>
- sys.stderr.write("\n%d out of %d test suites processed" %<br>
- (test_counter.value, total_tests))<br>
+ counter_len = len(str(total_tests))<br>
+ sys.stderr.write(<br>
+ "\r%*d test suites out of %d directories processed - %-*s" %<br>
+ (counter_len, test_counter.value, total_tests,<br>
+ test_name_len.value, test_name))<br>
+ if len(test_name) > test_name_len.value:<br>
+ test_name_len.value = len(test_name)<br>
test_counter.value += 1<br>
sys.stdout.flush()<br>
sys.stderr.flush()<br>
@@ -213,19 +219,23 @@<br>
for root, dirs, files in os.walk(test_subdir, topdown=False):<br>
test_work_items.append((root, files, test_directory, dotest_argv))<br>
<br>
- global output_lock, test_counter, total_tests<br>
+ global output_lock, test_counter, total_tests, test_name_len<br>
output_lock = multiprocessing.RLock()<br>
total_tests = len(test_work_items)<br>
test_counter = multiprocessing.Value('i', 0)<br>
- print >> sys.stderr, "Testing: %d tests, %d threads" % (total_tests, num_threads)<br>
- update_progress(None, None)<br>
+ test_name_len = multiprocessing.Value('i', 0)<br>
+ print >> sys.stderr, "Testing: %d directories, %d threads" % (<br>
+ total_tests, num_threads)<br>
+ update_progress()<br>
<br>
# Run the items, either in a pool (for multicore speedup) or<br>
# calling each individually.<br>
if num_threads > 1:<br>
- pool = multiprocessing.Pool(num_threads,<br>
- initializer = setup_global_variables,<br>
- initargs = (output_lock, test_counter, total_tests, dotest_options))<br>
+ pool = multiprocessing.Pool(<br>
+ num_threads,<br>
+ initializer=setup_global_variables,<br>
+ initargs=(output_lock, test_counter, total_tests, test_name_len,<br>
+ dotest_options))<br>
test_results = pool.map(process_dir_worker, test_work_items)<br>
else:<br>
test_results = []<br>
<br>
<br>
</blockquote></div>