Fix check_sql_module presubmit
1. Make CheckSqlModules presubmit actually fail when the check fails, rather than just notifying. 2. Add a utility in tools/tracing/check_stdlib.py to run the checks for faster iteration, without having to run git cl presubmit every time. Change-Id: I1082cd97b1773a13f4133cc8f1cb606c1d5de667 Bug: b/287233783 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5030001 Commit-Queue: Rasika Navarange <rasikan@google.com> Reviewed-by: Alexander Timin <altimin@chromium.org> Cr-Commit-Position: refs/heads/main@{#1226181}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
897f371632
commit
48dfa3b4aa
@ -4,28 +4,19 @@
|
||||
|
||||
PRESUBMIT_VERSION = '2.0.0'
|
||||
|
||||
def CheckSqlModules(input_api, output_api):
|
||||
def CheckStdlib(input_api, output_api):
|
||||
stdlib_dir = input_api.PresubmitLocalPath()
|
||||
chromium_src_dir = input_api.os_path.abspath(
|
||||
input_api.os_path.join(stdlib_dir, '..', '..'))
|
||||
perfetto_src_dir = input_api.os_path.join(
|
||||
chromium_src_dir, 'third_party', 'perfetto')
|
||||
tool = input_api.os_path.join(
|
||||
chromium_src_dir,
|
||||
'third_party', 'perfetto', 'tools', 'check_sql_modules.py')
|
||||
cmd = [
|
||||
input_api.python3_executable,
|
||||
tool,
|
||||
'--stdlib-sources',
|
||||
input_api.os_path.join(
|
||||
perfetto_src_dir,
|
||||
'..', '..', 'base', 'tracing', 'stdlib', 'chrome')
|
||||
]
|
||||
'tools', 'tracing', 'check_stdlib.py')
|
||||
cmd = [ input_api.python3_executable, tool ]
|
||||
test_cmd = input_api.Command(
|
||||
name='check_sql_modules',
|
||||
name='check_stdlib',
|
||||
cmd=cmd,
|
||||
kwargs={},
|
||||
message=output_api.PresubmitNotifyResult)
|
||||
message=output_api.PresubmitError)
|
||||
return input_api.RunTests([test_cmd])
|
||||
|
||||
_STDLIB_PATHS = (
|
||||
|
@ -2,4 +2,9 @@
|
||||
|
||||
The [PerfettoSQL Standard Library](https://perfetto.dev/docs/analysis/stdlib-docs) contains commonly used SQL tables, views, functions and macros to make it easier for users to query traces. The Chrome Standard Library contains those metrics that are specific to Chrome.
|
||||
|
||||
The source of truth of the Perfetto SQL Chrome stdlib has been moved from Perfetto to the Chromium repository to make it easier to develop new metrics and add tests for them in a single Chromium CL.
|
||||
The source of truth of the Perfetto SQL Chrome stdlib has been moved from Perfetto to the Chromium repository to make it easier to develop new metrics and add tests for them in a single Chromium CL.
|
||||
|
||||
|
||||
## PerfettoSQL Schema
|
||||
|
||||
The Perfetto CI runs a [script](https://source.chromium.org/chromium/chromium/src/+/main:third_party/perfetto/tools/check_sql_modules.py) to check that standard library modules are documented with the proper schema. In Chromium, we can run these checks locally by running `tools/tracing/check_stdlib.py`. This is also run as a presubmit check.
|
28
tools/tracing/check_stdlib.py
Executable file
28
tools/tracing/check_stdlib.py
Executable file
@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env vpython3
|
||||
# Copyright 2023 The Chromium Authors
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
# A wrapper script for //third_party/perfetto/tools/check_sql_modules.py
|
||||
# to check the Chrome Stdlib.
|
||||
|
||||
import subprocess
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
||||
def main():
|
||||
perfetto_dir = os.path.abspath(
|
||||
os.path.join(__file__, "..", "..", "..", "third_party", "perfetto"))
|
||||
tool = os.path.join(perfetto_dir, "tools", "check_sql_modules.py")
|
||||
stdlib_sources = os.path.join(perfetto_dir, "..", "..", "base", "tracing",
|
||||
"stdlib")
|
||||
completed_process = subprocess.run(
|
||||
["vpython3", tool, "--stdlib-sources", stdlib_sources],
|
||||
check=False,
|
||||
capture_output=True)
|
||||
sys.stderr.buffer.write(completed_process.stderr)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
Reference in New Issue
Block a user