Merge "Improve output of test.py"
This commit is contained in:
commit
86e3575c53
39
test.py
39
test.py
|
@ -308,10 +308,11 @@ def check_deleted_files(rootdir, file_exceptions, verbose):
|
||||||
|
|
||||||
|
|
||||||
def validate_one_file(schema, rootdir, path, verbose,
|
def validate_one_file(schema, rootdir, path, verbose,
|
||||||
any_failures, check_syntax, check_niceness):
|
check_syntax, check_niceness):
|
||||||
"""Validate a single file"""
|
"""Validate a single file"""
|
||||||
# We pass schema in as a way of caching it, generating it is expensive
|
# We pass schema in as a way of caching it, generating it is expensive
|
||||||
|
|
||||||
|
any_failures = False
|
||||||
if verbose:
|
if verbose:
|
||||||
print(" Validating %s" % os.path.relpath(path, rootdir))
|
print(" Validating %s" % os.path.relpath(path, rootdir))
|
||||||
try:
|
try:
|
||||||
|
@ -347,6 +348,7 @@ def validate_individual_files(rootdir, exceptions, verbose,
|
||||||
schema = get_schema()
|
schema = get_schema()
|
||||||
any_failures = False
|
any_failures = False
|
||||||
no_validated = 0
|
no_validated = 0
|
||||||
|
no_failed = 0
|
||||||
|
|
||||||
# Do not select delete files, just Added, Copied, Modified, Renamed,
|
# Do not select delete files, just Added, Copied, Modified, Renamed,
|
||||||
# or Type changed
|
# or Type changed
|
||||||
|
@ -366,15 +368,17 @@ def validate_individual_files(rootdir, exceptions, verbose,
|
||||||
if (base_f == "pom.xml" or
|
if (base_f == "pom.xml" or
|
||||||
base_f in exceptions):
|
base_f in exceptions):
|
||||||
continue
|
continue
|
||||||
any_failures = validate_one_file(
|
any_failures = validate_one_file(schema, rootdir, f, verbose,
|
||||||
schema, rootdir, f, verbose, any_failures,
|
|
||||||
check_syntax, check_niceness)
|
check_syntax, check_niceness)
|
||||||
|
if any_failures:
|
||||||
|
no_failed = no_failed + 1
|
||||||
no_validated = no_validated + 1
|
no_validated = no_validated + 1
|
||||||
|
|
||||||
if voting and any_failures:
|
if no_failed > 0:
|
||||||
print("Check failed, validated %d xml files.\n" % no_validated)
|
print("Check failed, validated %d xml files with %d failures.\n" % (no_validated, no_failed))
|
||||||
|
if voting:
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
else:
|
||||||
print("Check passed, validated %d xml files.\n" % no_validated)
|
print("Check passed, validated %d xml files.\n" % no_validated)
|
||||||
|
|
||||||
|
|
||||||
|
@ -383,8 +387,8 @@ def validate_all_files(rootdir, exceptions, verbose,
|
||||||
"""Validate all xml files."""
|
"""Validate all xml files."""
|
||||||
|
|
||||||
schema = get_schema()
|
schema = get_schema()
|
||||||
any_failures = False
|
|
||||||
no_validated = 0
|
no_validated = 0
|
||||||
|
no_failed = 0
|
||||||
if check_syntax and check_niceness:
|
if check_syntax and check_niceness:
|
||||||
print("Checking syntax and niceness of all xml files...")
|
print("Checking syntax and niceness of all xml files...")
|
||||||
elif check_syntax:
|
elif check_syntax:
|
||||||
|
@ -407,13 +411,17 @@ def validate_all_files(rootdir, exceptions, verbose,
|
||||||
f not in exceptions):
|
f not in exceptions):
|
||||||
path = os.path.abspath(os.path.join(root, f))
|
path = os.path.abspath(os.path.join(root, f))
|
||||||
any_failures = validate_one_file(
|
any_failures = validate_one_file(
|
||||||
schema, rootdir, path, verbose, any_failures,
|
schema, rootdir, path, verbose,
|
||||||
check_syntax, check_niceness)
|
check_syntax, check_niceness)
|
||||||
|
if any_failures:
|
||||||
|
no_failed = no_failed + 1
|
||||||
no_validated = no_validated + 1
|
no_validated = no_validated + 1
|
||||||
|
|
||||||
if voting and any_failures:
|
if no_failed > 0:
|
||||||
print("Check failed, validated %d xml files.\n" % no_validated)
|
print("Check failed, validated %d xml files with %d failures.\n" % (no_validated, no_failed))
|
||||||
|
if voting:
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
else:
|
||||||
print("Check passed, validated %d xml files.\n" % no_validated)
|
print("Check passed, validated %d xml files.\n" % no_validated)
|
||||||
|
|
||||||
|
|
||||||
|
@ -641,7 +649,7 @@ def build_affected_books(rootdir, book_exceptions,
|
||||||
maxjobs = 4
|
maxjobs = 4
|
||||||
pool = multiprocessing.Pool(maxjobs)
|
pool = multiprocessing.Pool(maxjobs)
|
||||||
print("Queuing the following books for building:")
|
print("Queuing the following books for building:")
|
||||||
for book in books:
|
for book in sorted(books):
|
||||||
print(" %s" % os.path.basename(book))
|
print(" %s" % os.path.basename(book))
|
||||||
pool.apply_async(build_book, (book, ),
|
pool.apply_async(build_book, (book, ),
|
||||||
callback=logging_build_book)
|
callback=logging_build_book)
|
||||||
|
@ -659,9 +667,12 @@ def build_affected_books(rootdir, book_exceptions,
|
||||||
% (book, returncode))
|
% (book, returncode))
|
||||||
print("\n%s" % output)
|
print("\n%s" % output)
|
||||||
|
|
||||||
if voting and any_failures:
|
if any_failures:
|
||||||
|
print("Building of books finished with failures.\n")
|
||||||
|
if voting:
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
print("Building finished.")
|
else:
|
||||||
|
print("Building of books finished successfully.\n")
|
||||||
|
|
||||||
|
|
||||||
def main(args):
|
def main(args):
|
||||||
|
@ -673,7 +684,7 @@ def main(args):
|
||||||
args.check_niceness = True
|
args.check_niceness = True
|
||||||
|
|
||||||
if not args.force and only_www_touched():
|
if not args.force and only_www_touched():
|
||||||
print("Only files in www directory changed, nothing to do.")
|
print("Only files in www directory changed, nothing to do.\n")
|
||||||
return
|
return
|
||||||
|
|
||||||
if args.check_deletions:
|
if args.check_deletions:
|
||||||
|
|
Loading…
Reference in New Issue