This change improves the Windows env_setup UI to mirror that of POSIX.
Not everything matches yet, and there is still no distinction between
bootstrap and activate.
Change-Id: I8680400340c7af03dbce234a248a65839287e6eb
- Fix several typing issues.
- Disable type checking in several places where mypy wasn't working
correctly.
- Enable mypy.
- Execute individual steps in the same order as they are provided with
--step.
Change-Id: I229cf8ee39a4db5067c1923b4acfc5fcd164f733
This fixes the long standing GN build breakage on Mac, which was due to
the CIPD-provided Clang defaulting to the system-provided libc++.
In order to restore Mac builds, this patch also:
- Disable GN GCC host build in presubmit (it's just Clang)
- Disable CMake host build (needs toolchain work)
- Disable Bazel host build (needs toolchain work)
Change-Id: I01dbe1e951af202a028a66d26d9c496cab736748
No longer attempt to form boxes for each step, which does not work well
when there are log messages during a step.
Example:
═══════════════════════════════════════════════════════════════════════════════╗
Presubmit checks for pigweed ║
═══════════════════════════════════════════════════════════════════════════════╝
20200304 10:28:05 INF Running 17 of 17 checks on 521 files in /home/hepler/pw/pigweed
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
1/17 init_cipd 521 files
PASSED init_cipd 0:00.8
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
2/17 init_virtualenv 521 files
PASSED init_virtualenv 0:00.0
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
3/17 copyright_notice 453 files
20200304 10:28:06 WRN 1 file with a missing or incorrect copyright notice:
/home/hepler/pw/pigweed/pw_presubmit/py/pw_presubmit/format_code.py
FAILED copyright_notice 0:00.0
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
════════╦══════════════════════════════════════════════════════════╦═══════════╗
FAILED ║ 17 checks: 2 passed, 1 failed, 14 did not run ║ 0:00.8 ║
════════╩══════════════════════════════════════════════════════════╩═══════════╝
Change-Id: Ib9bb1049b61e7b7962c22dd814f9295e1c551b8b
This changes the names of the code format steps to lowercase with
underscores to make them consistent with all other steps and easy to
specify via the --step CLI option.
Change-Id: Ie319f36da77fdb0218337ea418ed6e938b6ba317
- Set PW_ROOT if it's not set to allow running outside of the Pigweed
environment.
- Reorder the steps in the full program to put quicker steps first.
- Have the Git pre-push hook run the quick program instead of the
default full program.
Change-Id: I28c3a5a62bf61e4ed2d889fa9bea17003fcdeab7
Sometimes the Bazel cache gets in a bad state where it complains about
undeclared inclusions on C standard library headers. The only way to fix
this is to delete the Bazel cache. This adds a message to the presubmit
about how to clear the cache if the Bazel build fails.
Fixed: 114
Change-Id: I7c3ad45bdce919a325f721f2071e99c1e56582c0
Add symlink from previous location of requirements.txt. Will remove in
a followup after recipes have been configured to point to new path.
Bug: 67
Change-Id: I0b808c99789d65ac216dbd176a684061c8b2d8a8
Add symlink from previous locations of json files. Will remove in a
followup after recipes have been configured to point to new path.
Bug: 67
Change-Id: Icff7c64860da73ba8260d1c8f2e14eab5f078ade
Store CIPD references in JSON so it's easier to automatically roll
versions of tools and parse from recipes.
Change-Id: I918421401fa19d719b3bde52dde0173bb7a69a42
Bug: 103
This change moves building documentation out of the host and disco targets
into a special docs target.
The presubmit script is updated to handle the docs target.
Change-Id: I975170c9e8941d126d85a391c0f3b355e4fa44dd
For empty files the copyright check would keep reading but because
it was at EOF it would keep getting an empty string, for which
'not line.strip()' would always evaluate to True. This change
causes it to exit the loop when it hits EOF.
Change-Id: I0fe5d95fe1d4f1d9dcaf1ff4e1351fa40b96bd72
- Use . as a separator in the test group target names. For example,
pw_run_tests_pw_varint is now pw_run_tests.pw_varint.
- Force the compiler to colorize its output.
Change-Id: I47c283974db935ec5f93402de965caab57a9750c
Running, but not passing. Also, presubmit steps that are not yet
passing can be added to the "broken" program so they can be easily
tested.
I think it needs '-warnings-as-errors' but I get errors when adding
that. It also complains about '-Wno-psabi'.
Change-Id: I72d92cce16f6a764b523d83d36280d6ce3350440
Bug: 45
Create a logger for each check. Add a FileHandler with level DEBUG to
these loggers. Since they're child loggers of the root logger, warn()
and error() send output to the log file and to stderr.
Make several changes to simplify passing these log objects around.
Add log statements to a few presubmit checks.
Change-Id: If13ad92da5c2abf9035e78c1cbe81d5025916888
Bug: 3
The pw presubmit command no longer cds to the repository root. By default,
it puts output in repository_root/.presubmit, but output can be placed
anywhere. Both of these presubmit commands pass.
$ cd $PW_ROOT ; pw presubmit
$ cd $PW_ROOT/.. ; pw presubmit --repository ~/pigweed/pigweed \
--output-directory .
The presubmit context object now has an output_directory member. Presubmit
checks should place output in that folder.
Change-Id: Ibb0a3c7add54de6409561006e3c74dd8c8603a25
The installed pre-push hook checks against origin/master..HEAD instead
of just origin/master so that checks are only triggered by committed
changes.
Run pw presubmit --install to update the pre-push hook.
Change-Id: I6df0eef4fdec362222582592af4df1863608b95d
Instead of passing paths into some presubmit checks and not others, always
pass a PresubmitContext object that includes paths, repository root, and can
contain additional members in the future.
For checks that used filtered paths, filter the PresubmitContext object
before it gets passed to the check.
Change-Id: Icf35b11587f89eeae2fdc578e11f6647b48e27f2
This disables the Pylint checker for line continuation, to avoid
fighting with YAPF. For now, the YAPF continuations are not in
accordance with PEP8, but we have decided that operationally it makes
more sense to just go with whatever YAPF suggests.
This also makes some tweaks to the format command logic better separate
out unrelated functionality.
Bug: 22
Change-Id: Ia29bc4c38c4de31dface0206d54db3b72a32c0cb
- Evaluate each unique path filter once before running the checks.
- Do not output results for skipped checks.
- Add a message that calls out when no files are being checked.
Change-Id: I0d8debd50e7b5838e837693d46e29cc6d9da447e
- Update the PATH to include the new CIPD directories.
- With the current Python test finding approach, Python tests must be
run from the package directory. Update the presubmit check to do this.
Change-Id: Ie1cdf61875643d435608597b27d03695bf46d3c3
- Fix Go formatting, which was accidentally using clang-format.
- Update source_is_in_build_files to query the build system rather than
check build file contents.
- Remove pylint_errors_only check since full pylint is running.
- Add log_run wrapper that logs at debug then calls subprocess.run.
Change-Id: I1a335e2999b5aabcb2a39a2d8bc9fbe43d6dd75b
- Remove the path filter for init_virtualenv since the build depends on
Python.
- Add --clean-py option for cleaning only the Python venv.
- Rename --continue to --keep-going for consistency with Bazel.
- Make updates to Git path handling to correctly handle absolute versus
relative paths.
- Make the .presubmit directory relative to the root of the repo.
Change-Id: I9b2ce32dd4e1a9c993a10f37c252a685625c46ad
This change adds a pw_test_server module which implements a gRPC server
for queueing and distributing unit tests across multiple test runners.
The server is implemented as a Go library which can be imported and used
by developers to build a custom unit test running infrastructure.
To use the server, a UnitTestRunner interface that processes requests to
run unit tests must be implemented and registered with the server. An
implementation of this interface which runs unit test executables
through an external command is provided alongside the server.
An example program that uses the server library to run a unit test
server is also provided within the module. This program uses the
command-based test runners to run unit tests on a local machine. It is
configurable through a config file, allowing multiple workers to be
registered with the server. The program additionally doubles as a gRPC
client for the server which can be invoked with the path to a unit test
executable to schedule it to be run.
Change-Id: I347d230370620395de09e277f9763d7df1c4abad
- Check that all C, C++ sources appear in BUILD and BUILD.gn files.
- Check that all .rst files appear in BUILD.gn files.
- Make the pylint check fatal. The full presubmit will fail until some
issues are fixed. Incremental presubmits (e.g. with the pre-push hook
or pw presubmit --base master) will pass (unless there are errors).
Change-Id: Id42cc2e06278d0e56017a2008676db8e77ba6c20
- Switch many print statements to log statements.
- Only show command output when commands fail or debug logging is
enabled.
- Add a wrapper class for check functions to consolidate running
and logging logic for presubmit checks.
Change-Id: I72e155d602135b60c18f8973a778f40e65bb40da
- pw format (or pw_presubmit/format_code.py) supports checking and
fixing the format of Python, C/C++, GN, and Go code.
- Move code format presubmit checks into format_code.py.
- Accept paths not in a Git repository for pw format.
- Add an explicit check that pw presubmit is run from a Git repo.
Change-Id: I74bf54057bd5ace70a90271f7d1343711455792a