Commit Graph

176 Commits

Author SHA1 Message Date
Armando Montanez
050eae89d2 stm32f429i-disc1: Enable hardware FPU
* Add Cortex-M4 toolchains with floating point hardware instructions.
 * Update stm32f429i-disc1 to use hardware fpu toolchain by default.
 * Add code to enable FPU in pw_dumb_io.

Verified tests that use floating point operations continue to pass.

Change-Id: I76bc7eeaf457eca1abacbc60992648d63dc85bf2
2019-12-13 00:33:46 +00:00
Rob Mohr
686c2d83e1 Move Python 3 to pigweed.ensure.
Change-Id: I194f33d91b82cd30391ed0a5eabff60b8fac2146
2019-12-12 21:15:55 +00:00
Armando Montanez
0874558cf3 docs: Add 'targets' section
Creates a new section in the docs for target documentation, and adds
some documentation for the stm32f429i-disc1 target.

Change-Id: I0ffbfa56a97458d850834fc0f670b32885b0d2b5
2019-12-12 21:15:16 +00:00
Wyatt Hepler
dceb02000f pw_presubmit: Only show checks that run
- 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
2019-12-11 19:36:24 -08:00
Wyatt Hepler
d2a16a5ab3 Remove yapf, mypy, and pylint from requirements.in
These packages are specified as requirements of the pw_presubmit
package.

Change-Id: I897a560aee7db41fecca3fac32c58456e58ae056
2019-12-11 16:53:52 -08:00
Wyatt Hepler
a975821cbf pw_presubmit: Fix PATH; run Python tests
- 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
2019-12-11 14:40:09 -08:00
Rob Mohr
97fe66ebce Fix yapf formatting.
Change-Id: I3f70649558c8d7934268bae45f403c6ab52e5477
2019-12-11 21:43:53 +00:00
Rob Mohr
a337adbb7b Remove unused import.
Change-Id: I1f86d3320a6583f396074cc2921b37b387c7fcce
2019-12-11 13:35:32 -08:00
Rob Mohr
9e1ee40f61 Move CIPD installation dir.
Change-Id: I5292aa513d1648761e72c9c56148d3c9a854493f
2019-12-11 11:23:09 -08:00
Rob Mohr
e5b31f08e8 Split up ensure_file.
pigweed.ensure will need to be installed on swarming bots but
luci.ensure will already be installed on them.

Change-Id: Ieca28dafc6f3d68d7226e93d32d9c18ff32ffe0c
2019-12-11 11:15:02 -08:00
Rob Mohr
49de49203a Fix how pw_build docs are used.
Change-Id: Ic6d357a116f0da8b167a1b9618ca84f6513c5ec5
2019-12-10 20:10:44 -08:00
Alexei Frolov
cbc91a2f11
Fix golint warnings
This change adds package comments to the client and server modules as
suggested by golint.

Change-Id: I2b0894ab88ff2aeaaaf105673a2efdbcaf7ae504
2019-12-10 17:39:04 -08:00
Wyatt Hepler
bd89d5c164 docs: Use glob to pull in docs.rst
- Glob for */docs.rst in the modules.rst toctree to avoid needing to
  list each module's docs entry in three places. Globbing also
  automatically maintains alphabetical order.
- Rename a few doc files to docs.rst.

Change-Id: I4ff9a83184d326441b426afea6879a4a7b6740eb
2019-12-10 15:50:29 -08:00
Rob Mohr
84f234e8e1 Add doc for pw_build.
Change-Id: I2b8b234adadfffc7c3d533613b15fa54ab3d3d8f
2019-12-10 19:08:53 +00:00
Rob Mohr
31284b8758 Fix go lint warnings.
Change-Id: I1c4131906db304c11992baa5516bf026c689127f
2019-12-10 10:57:59 -08:00
Rob Mohr
6d5d856a10 Misc. pylint fixes.
Change-Id: I4b790ea8801a2a4742004e2d4b111b4f4a1ab9d7
2019-12-10 10:19:30 -08:00
Keir Mierle
c34f71ffad pw_module: Start module structure documentation
This adds some basic documentation about the Pigweed module structure.
Much more will need to get added, such as rationale and more.

Change-Id: I7b2b16319bc3461ba66db29e9d64a72c862fb157
2019-12-10 10:07:18 -08:00
Wyatt Hepler
867d42d19c pw_span: Fix typo and example in docs
Change-Id: I531e9f044ee81cf9b67206e1bf957af0b25d8179
2019-12-10 09:21:12 -08:00
Wyatt Hepler
ee3e02f6cb Expand docs for a few modules
- Add missing README.md for a few modules.
- Start or expand docs.rst.

Change-Id: Ic13c5f71f02259205ba990c93e0403d43f7b44b1
2019-12-09 17:13:47 -08:00
Armando Montanez
d2e4903a42 pw_dumb_io: Update docs
Add/update docs for the pw_dumb_io facade and backends. Configures GN
build files such that all the backend docs are built even if the backend
isn't in use.

Change-Id: I91fca1cb2d3f5d4b57ae1f6991a89270a35be1c6
2019-12-10 00:05:55 +00:00
Rob Mohr
8edfeaeec0 Rename help to short_help.
Change-Id: Ibd41f06c2701b6c68a4a45c08a07c335679b976c
2019-12-09 13:45:01 -08:00
Wyatt Hepler
8cc1df5a96 Apply pw format --fix
Change-Id: I38e09deb7de05a52e70eefb6def4e0d554d10eb3
2019-12-09 11:25:32 -08:00
Wyatt Hepler
fa70745e1c pw_presubmit: Update a few checks
- 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
2019-12-09 19:20:09 +00:00
Rob Mohr
e023ba9577 Fix pylint warnings.
Change-Id: I8ef482776bcb5ec89afde39f215bd52c950a4b1b
2019-12-09 09:59:51 -08:00
Rob Mohr
9f3e48d2d1 Fix some pylint issues.
Change-Id: I0e65f78e5e40c4f88d19059fd5b818e171f92ffc
2019-12-09 17:34:56 +00:00
Wyatt Hepler
1919c64b5c Move non-virtual-dtor warning to C++ only
Causes a warning when building C files.

Change-Id: Ib82134a0bb7a15c88a3edfbdb04d570fde643198
2019-12-06 16:24:11 -08:00
Wyatt Hepler
9113c9fea2 pw_presubmit: Always init_virtualenv; options
- 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
2019-12-06 16:24:11 -08:00
Armando Montanez
8f1139f5d7 stm32f429i-disc1: Automatic board detection
Introduce automatic STM32F429I-DISC1 board detection on linux, and
integrate it with the test target runer so the com port doesn't need to
be specified.

Change-Id: I2d8aa67bd03501934e9f2404f8afcef75e7d6aca
2019-12-06 23:22:18 +00:00
Rob Mohr
44b0daeb7a Switch to 3pp Python.
Change-Id: I180129cfc38384bb9418a7604eb4fb86a3c721af
2019-12-06 15:10:03 -08:00
Alexei Frolov
d0b2d48782 Add pw_test_server module
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
2019-12-06 22:55:28 +00:00
Wyatt Hepler
1ea1305312 pw_presubmit: Build file check; fatal pylint
- 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
2019-12-06 12:54:48 -08:00
Wyatt Hepler
ce14cb227e pw_presubmit: Use logging; UI improvements
- 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
2019-12-06 12:54:48 -08:00
Wyatt Hepler
8635af956b Update Sphinx conf.py; add autodoc extension
Change-Id: I4754d7d2203da2d9364d11aca65474eb29505fbf
2019-12-05 16:33:33 -08:00
Wyatt Hepler
becb431e5f Apply pw format to the repository
Change-Id: I3c8e4f956dfe6c9e81d3069f72c30c5950852074
2019-12-05 09:31:11 -08:00
Wyatt Hepler
b90f341ba5 pw_presubmit: Add new pw format command
- 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
2019-12-05 09:31:11 -08:00
Rob Mohr
c2e377c8f6 Fix build warning.
It's a warning to not have loads at top of BUILD files.

Change-Id: I2d23c358c0ff4fa5ac883a635d925e3d879750d4
2019-12-05 07:52:07 -08:00
Wyatt Hepler
bc292b9152 pw_presubmit: Rename format_cc to format_code
- Rename format_cc.py to format_code.py to make it language-agnostic.
- Exclude non-existing paths in the presubmit to handle deletions.

Change-Id: If07decfd9fe11539bd5ccc74243f00cbf33736b8
2019-12-04 23:50:19 +00:00
Rob Mohr
416af48496 Config bazel for pw_bloaty and size_report.
Fill out pw_bloaty/BUILD and add pw_string/size_report/BUILD.

Change-Id: I5ff98de0a452491cdff595ad56ee7365f40590dd
2019-12-04 23:21:51 +00:00
Rob Mohr
dc70d1cb86 Bootstrap with 'python' and check CIPD auth.
Bootstrap scripts now use '#!/usr/bin/env python' instead of
'#!/usr/bin/env python3' which should let them work on a wider variety
of systems. Tested again with python 2 and made a couple minor changes
for compatibility.

Added check_auth() function to update.py. If it fails, it prints a
useful error message and gets ABORT_PW_ENVSETUP=1 added to the
environment. This is a cue to env_setup/setup.sh to not continue so the
error is prominent on the terminal. (env_setup/setup.sh clears this
variable so it won't persist into the next time env_setup/setup.sh is
sourced.)

Change-Id: Ib4a694178f1dce8971302914651feea3c727ea15
2019-12-04 10:05:28 -08:00
Rob Mohr
05b0b11d42 Change precedence of options in bazel.
Now options specified in BUILD files can override defaults.

Change-Id: I88586805b2f4dffd18d3920efbede906f670cdf0
2019-12-04 17:13:50 +00:00
Rob Mohr
b90a008994 Use clang/llvm from CIPD.
Change-Id: Ib3329d6937b99bac71328b49c1ffc107bb4dc80a
2019-12-04 01:57:39 +00:00
Keir Mierle
ebd7bfed95 Convert GN python runer to use logging
This switches the test runner to use Python's logging module instead of
directly printing. Additionally, this switches the default logging to
only log errors and not the contents of every command.

Change-Id: I1d2b69cdd682fca6e4c9a6ffe2d121db60f065dd
2019-12-04 01:15:53 +00:00
Armando Montanez
43b4cc2768 Temporarily disable CIPD openocd
Remove openocd from CIPD ensure file.

Change-Id: I095bf92ccc3657fc1369e29d2c46a665dd85486b
2019-12-03 15:50:50 -08:00
Rob Mohr
f1a2863248 Add command for running tests on hardware.
Change-Id: If6e4ee512bc9cf8817688e630886b27573d9d0b8
2019-12-03 13:55:40 -08:00
Rob Mohr
e11d715936 Add #! line to stm32f429i test runner.
Change-Id: Ida76b2683b6a24e9c60f2fa943672b9c5ed2f23d
2019-12-03 13:28:59 -08:00
Armando Montanez
47b0c5c1cd Use openocd provided by CIPD
Updates Pigweed tools to use OpenOCD provided by CIPD.

Change-Id: Iea80343373bc5d36d223dd327b854e89ee9e274a
2019-12-03 19:50:43 +00:00
Wyatt Hepler
956ea9dd52 pw_string: Fix test for limited snprintfs
snprintf should return a negative number if there is a formatting error.
Limited snprintf implementations may not detect these errors. This
caused the test to fail on the STM32 Discovery F429i.

Change-Id: I1da8593c258508c0d3e2fa6c440a58493ce15597
2019-12-03 11:11:13 -08:00
Armando Montanez
93e445e84b pw_cli: Remove date/time from subprocess logs
When python scripts are run using pw_cli.subprocess, the output of their
lgos will be prefixed with a date/time stamp. This change prevents
subprocesses from adding a second timestamp.

Example:
~/pigweed/pigweed$ pw test --root out/stm32f429i-disc1/ --runner stm32f429i_disc1_unit_test_runner -- --port /dev/ttyACM0

 ▒█████▄   █▓  ▄███▒  ▒█    ▒█ ░▓████▒ ░▓████▒ ▒▓████▄
  ▒█░  █░ ░█▒ ██▒ ▀█▒ ▒█░ █ ▒█  ▒█   ▀  ▒█   ▀  ▒█  ▀█▌
  ▒█▄▄▄█░ ░█▒ █▓░ ▄▄░ ▒█░ █ ▒█  ▒███    ▒███    ░█   █▌
  ▒█▀     ░█░ ▓█   █▓ ░█░ █ ▒█  ▒█   ▄  ▒█   ▄  ░█  ▄█▌
  ▒█      ░█░ ░▓███▀   ▒█▓▀▓█░ ░▓████▒ ░▓████▒ ▒▓████▀

20191202 14:30:07 INF Scanning for tests...
20191202 14:30:07 INF Found 4 test groups (10 tests).
20191202 14:30:07 INF Running test groups //pw_status:tests, //pw_preprocessor:tests, //pw_string:tests, //pw_span:tests
20191202 14:30:07 INF Test  1/10: [RUN] concat_test
20191202 14:30:07 OUT [24930] INF Flashing firmware to device...
20191202 14:30:07 OUT [24930] INF Successfully flashed firmware to device!
20191202 14:30:07 OUT [24930] INF Test passed!
20191202 14:30:08 INF stm32f429i_disc1_unit_test_runner exited successfully
20191202 14:30:08 INF Test  1/10: [PASS] concat_test
20191202 14:30:08 INF Test  2/10: [RUN] type_to_string_test
20191202 14:30:08 OUT [24947] INF Flashing firmware to device...
20191202 14:30:09 OUT [24947] INF Successfully flashed firmware to device!
20191202 14:30:11 OUT [24947] INF Test passed!
20191202 14:30:11 INF stm32f429i_disc1_unit_test_runner exited successfully

Change-Id: I9ea7cafcde2183132f54e135ecadd7b2878f71f0
2019-12-03 18:32:43 +00:00
Wyatt Hepler
f2278ee6b0 presubmit: Fix invoking script directly
Change-Id: I1dff5a6d91335ecf7213b0c3f9e511cc067318ef
2019-12-03 17:06:14 +00:00
Keir Mierle
9bc70214f5 pw_module: New checkers
Add new checkers to 'pw module-check'
- Enforce public include directories as <module>/public/<module>
- Enforce alternate name 'public_overrides/' for headers that don't
  match the pattern.

Change-Id: I7bb7823921c921baaae8e46934b5b0b063849850
2019-12-03 08:56:35 +00:00