scripts: Misc cleanup
- Review feedback from Vulkan-Tools review
- Make vk_validation_stats.py quiet by default instead of blanket
discard of all generator stdout
Change-Id: Iae3a0e2b7dac6e67ff05f61a4595b636ea643a80
diff --git a/scripts/generate_source.py b/scripts/generate_source.py
index 3e3e315..db350c6 100755
--- a/scripts/generate_source.py
+++ b/scripts/generate_source.py
@@ -19,7 +19,6 @@
# Author: Mike Schuchardt <mikes@lunarg.com>
import argparse
-import common_codegen
import filecmp
import os
import shutil
@@ -27,6 +26,8 @@
import sys
import tempfile
+import common_codegen
+
# files to exclude from --verify check
verify_exclude = ['.clang-format']
@@ -84,10 +85,7 @@
for cmd in gen_cmds:
print(' '.join(cmd))
try:
- subprocess.check_call([sys.executable] + cmd,
- # ignore generator output, vk_validation_stats.py is especially noisy
- stdout=subprocess.DEVNULL,
- cwd=gen_dir)
+ subprocess.check_call([sys.executable] + cmd, cwd=gen_dir)
except Exception as e:
print('ERROR:', str(e))
return 1
diff --git a/scripts/vk_validation_stats.py b/scripts/vk_validation_stats.py
index c34a049..8f6c87f 100755
--- a/scripts/vk_validation_stats.py
+++ b/scripts/vk_validation_stats.py
@@ -144,6 +144,7 @@
print (" [ -csv [ <csv_out_filename>] ]")
print (" [ -html [ <html_out_filename>] ]")
print (" [ -export_header ]")
+ print (" [ -summary ]")
print (" [ -verbose ]")
print (" [ -help ]")
print ("\n The vk_validation_stats script parses validation layer source files to")
@@ -162,6 +163,7 @@
print (" -html [filename] output the error database in html to <html_database_filename>,")
print (" defaults to 'validation_error_database.html'")
print (" -export_header export a new VUID error text header file to <%s>" % header_filename)
+ print (" -summary output summary of VUID coverage")
print (" -verbose show your work (to stdout)")
class ValidationJSON:
@@ -571,7 +573,8 @@
hfile.write('</table>\n</body>\n</html>\n')
def export_header(self):
- print("\n Exporting header file to: %s" % header_filename)
+ if verbose_mode:
+ print("\n Exporting header file to: %s" % header_filename)
with open (header_filename, 'w') as hfile:
hfile.write(self.header_version)
hfile.write(self.header_preamble)
@@ -632,6 +635,7 @@
csv_out = False
html_out = False
header_out = False
+ show_summary = False
if (1 > len(argv)):
printHelp()
@@ -672,6 +676,8 @@
header_out = True
elif (arg in ['-verbose']):
verbose_mode = True
+ elif (arg in ['-summary']):
+ show_summary = True
elif (arg in ['-help', '-h']):
printHelp()
sys.exit()
@@ -725,20 +731,21 @@
print(" %d unassigned" % len(val_tests.unassigned_vuids))
# Process stats
- print("\nValidation Statistics (using validusage.json version %s)" % val_json.apiversion)
- print(" VUIDs defined in JSON file: %04d explicit, %04d implicit, %04d total." % (exp_json, imp_json, all_json))
- print(" VUIDs checked in layer code: %04d explicit, %04d implicit, %04d total." % (exp_checks, imp_checks, all_checks))
- print(" VUIDs tested in layer tests: %04d explicit, %04d implicit, %04d total." % (exp_tests, imp_tests, all_tests))
+ if show_summary:
+ print("\nValidation Statistics (using validusage.json version %s)" % val_json.apiversion)
+ print(" VUIDs defined in JSON file: %04d explicit, %04d implicit, %04d total." % (exp_json, imp_json, all_json))
+ print(" VUIDs checked in layer code: %04d explicit, %04d implicit, %04d total." % (exp_checks, imp_checks, all_checks))
+ print(" VUIDs tested in layer tests: %04d explicit, %04d implicit, %04d total." % (exp_tests, imp_tests, all_tests))
- print("\nVUID check coverage")
- print(" Explicit VUIDs checked: %.1f%% (%d checked vs %d defined)" % ((100.0 * exp_checks / exp_json), exp_checks, exp_json))
- print(" Implicit VUIDs checked: %.1f%% (%d checked vs %d defined)" % ((100.0 * imp_checks / imp_json), imp_checks, imp_json))
- print(" Overall VUIDs checked: %.1f%% (%d checked vs %d defined)" % ((100.0 * all_checks / all_json), all_checks, all_json))
+ print("\nVUID check coverage")
+ print(" Explicit VUIDs checked: %.1f%% (%d checked vs %d defined)" % ((100.0 * exp_checks / exp_json), exp_checks, exp_json))
+ print(" Implicit VUIDs checked: %.1f%% (%d checked vs %d defined)" % ((100.0 * imp_checks / imp_json), imp_checks, imp_json))
+ print(" Overall VUIDs checked: %.1f%% (%d checked vs %d defined)" % ((100.0 * all_checks / all_json), all_checks, all_json))
- print("\nVUID test coverage")
- print(" Explicit VUIDs tested: %.1f%% (%d tested vs %d checks)" % ((100.0 * exp_tests / exp_checks), exp_tests, exp_checks))
- print(" Implicit VUIDs tested: %.1f%% (%d tested vs %d checks)" % ((100.0 * imp_tests / imp_checks), imp_tests, imp_checks))
- print(" Overall VUIDs tested: %.1f%% (%d tested vs %d checks)" % ((100.0 * all_tests / all_checks), all_tests, all_checks))
+ print("\nVUID test coverage")
+ print(" Explicit VUIDs tested: %.1f%% (%d tested vs %d checks)" % ((100.0 * exp_tests / exp_checks), exp_tests, exp_checks))
+ print(" Implicit VUIDs tested: %.1f%% (%d tested vs %d checks)" % ((100.0 * imp_tests / imp_checks), imp_tests, imp_checks))
+ print(" Overall VUIDs tested: %.1f%% (%d tested vs %d checks)" % ((100.0 * all_tests / all_checks), all_tests, all_checks))
# Report status of a single VUID
if len(get_vuid_status) > 1: