This change adds a docs directory at the root level of the Pigweed
repository for building documentation for the entirety of Pigweed.
The directory contains a top-level index.rst and conf.py for docgen,
and a pw_doc_gen build target to render the documentation.
Change-Id: Iba981c64662d48a1d23bb7bda9bf0ed5a104873b
This change updates the bloat script to output an RST version of its
report card table. Metadata is added to the bloat_report GN template
indicating its RST output, allowing it to be listed as a dependency of
pw_doc_group targets.
Change-Id: I3f098d352856a9dd8688bac44e3b60ddbb97a3a6
This change adds a size reporting module named pw_bloat. The module
uses Bloaty McBloatface to generate size report cards for binaries. It
provides a GN template which defines an action to perform a size diff
on a group of binary targets.
Example output:
simple_bloat
────────────
┌────────────────┬──────────────┬────────┬───────┬───────┐
│ Label │ Segment │ Before │ Delta │ After │
├════════════════┼══════════════┼════════┼═══════┼═══════┤
│ Add a loop │ EXAMPLE CODE │ 429 │ +32 │ 461 │
│ │ EXAMPLE RAM │ 576 │ +8 │ 584 │
├────────────────┼──────────────┼────────┼───────┼───────┤
│ Add a function │ EXAMPLE CODE │ 429 │ +16 │ 445 │
│ │ EXAMPLE RAM │ 576 │ +8 │ 584 │
└────────────────┴──────────────┴────────┴───────┴───────┘
Change-Id: I14b3d383ec450bc6d017bf5d0111e266b0a3c368
- Move pw_unit_test_create_run_targets to pw_vars_default.gni so that
targets can set it.
- Keep the default false, but set it to true for the host targets.
Change-Id: Ia1af584642d0dd4d16b801b2ee4a8bb1a78c286e
- Update host_clang to work on Linux: switch to -Map and --gc-sections
options
- Make pw_target_toolchain a build arg for Linux and macOS targets.
Default to gcc on Linux, clang on macOS.
- Rename x86_linux_gcc to host_gcc.
Change-Id: I72eef9ba9398a331f6567b68ad404092186eb15b
EXPECT_EQ happens to work (sometimes) because of string interning, but
these strings should be compared by value with EXPECT_STREQ.
Change-Id: Ifdcc7cf12d9c0868d8e7976baf549935ef117efc
This adds a generic host_clang toolchain, targeting hosts running Mac and
Linux to start, and likely Windows later.
For now, on Mac the default toolchain is set to host_clang_og
Change-Id: Iea457c61586930d509439c6616574c9a74919433
Introduce functions for outputting numbers as strings. Unlike some
snprintf implementations, these functions support 64-bit integers. Also,
very limited floating point support is provided.
These functions are faster than snprintf and never truncate numbers.
Change-Id: Id5ae06a5d175f15403c34cddb2a077a88be47cf8
This change defines the build target system used by Pigweed, where the
build is configured using per-target globals imported from a target .gni
file. A single build arg specifying the path to the target file replaces
the previous args.
A default build variables file is provided in the Pigweed root. This
file defines and documents all of the build variables used by Pigweed.
A top-level targets directory is added to define the targets used by
Pigweed developers. Currently, only a "host" target is added, which
configures the build for a development system based on the host OS.
Change-Id: Ie62b8d41e5789bfe7fffe20462160142c79076c4
- Create StatusWithSize, which efficiently stores a Status and a
non-negative integer.
- Add tests for Status and StatusWithSize.
Change-Id: I34ade117d890318d45a27664fe53303365f21f68
This change adds a module which builds documentation using Sphinx.
Documentation files and assets are defined using a pw_doc_group GN
template which lists out all of the sources as metadata. Another GN
template, pw_doc_gen, collects the metadata from pw_doc_group targets
into a JSON file and defines an action that runs a script to build the
HTML docs.
A docgen script is provided by the pw_docgen module. This script reads
the JSON metadata file collected by a pw_doc_gen template, copies all of
the source and resource files into a documentation tree, and runs Sphinx
on the tree to render the docs as HTML.
Change-Id: I97890f05d850d5119cbd3bbf48138cd82f22d56c
GN requires all actions to have at least one output file. However, many
Python scripts are run to process data without generating a file. Such
scripts would previously have to specify a dummy output file and touch
it on completion.
This change adds this stamp functionality to the script-runner script.
The pw_python_script template accepts a boolean "stamp" argument. If
set, the runner will touch a dummy file after it runs its sub-command.
Change-Id: Iff0408ea0d93007418a1766f1eb7ed7b30ec6913
This change adds a pw_python_script GN template which defines an action
to run a Python script through a script-runner script. This runner is
responsible for resolving any GN paths to filesystem paths, and finding
output binaries for compiled targets. This allows writing Python scripts
which are ignorant of the GN build system and work only with filesystem
paths.
The unit test runner script is updated to use the new runner template.
Change-Id: I132bb620af2bb1e57e9278fac57b676f8ab5a415
This change makes the default toolchain for the build system an
argument so that it can be configured per build target.
Change-Id: I32822be9a6e33376bb1e75b996f79d3451ef9963
This makes two tweaks to enable compiling with Clang on the desktop:
- Switch from (&function_pointer) to (*function_pointer) style.
- Make destructor final in derived test class to prevent warning from
the "-Wdelete-non-abstract-non-virtual-dtor" flag.
Change-Id: Ic1783e41ee8092a5ad218ebdb48376742f85ff50
This change adds a GN template for defining unit test executables.
The template, called pw_test, defines the executable and outputs a JSON
metadata file for the test.
A new build argument is added. This argument determines whether unit
test run targets are supported by the current build target. If this is
set, the pw_test template additionally creates a run target for its test
executable which invokes the executable through a script.
A basic test runner script is added to the pw_unit_test module. This
script currently only runs a single test executable directly.
The unit tests in the pw_preprocessor module are updated to use the
pw_test template.
Change-Id: I3cbde9c19440276dbab80dd2bab5fec87abe6d7e
- Add -fdiagnostics-color so that compiler warnings are colorized. The
way Ninja invokes GCC disables colors by default.
- Move -Wno-psabi up to the arm_gcc_toolchain template so that it
doesn't have to be specified for each arm_gcc_toolchain instance.
- Add -Werror to the strict_warnings config to prevent warnings from
slipping through. Exempt a few warnings that should actually be
warnings.
Change-Id: I8656d6690b488f7b004f15abd7100b62e1945cfd
This makes these changes to the unit test framework:
(1) Makes the simple test runner output match GTest
(2) Adds a new RunAllTestsStart() and RunAllTestsEnd() event
(3) Adds an intentionally-failing expectation to the sample test
Example output:
[==========] Running all tests.
[ RUN ] PigweedTest.ExpectBool
[ OK ] PigweedTest.ExpectBool
[ RUN ] PigweedTest.ExpectBasicComparisons
[ OK ] PigweedTest.ExpectBasicComparisons
[ RUN ] PigweedTest.ExpectStringEquality
[ OK ] PigweedTest.ExpectStringEquality
[ RUN ] PigweedTest.NonCopyableType
[ OK ] PigweedTest.NonCopyableType
[ RUN ] PigweedTest.MacroArgumentsOnlyAreEvaluatedOnce
[ OK ] PigweedTest.MacroArgumentsOnlyAreEvaluatedOnce
[ RUN ] FixtureTest.CustomFixture
[ OK ] FixtureTest.CustomFixture
[ RUN ] PigweedTestFixture.TheNumberIs35
[ OK ] PigweedTestFixture.TheNumberIs35
[ RUN ] PigweedTestFixture.YupTheNumberIs35
[ OK ] PigweedTestFixture.YupTheNumberIs35
[ RUN ] PigweedTestFixture.MissingExpectations
../pw_unit_test/framework_test.cc:156: Failure
Expected: missed_expectations == 200
[ FAILED ] PigweedTestFixture.MissingExpectations
[==========] Done running all tests.
[ PASSED ] 8 test(s).
[ FAILED ] 1 test(s).
Change-Id: I813096a9d62423e256993ae03724337d52702297
This change adds two Pigweed modules: pw_preprocessor and pw_unit_test.
The preprocessor module contains header files providing helpful macros
for the C preprocessor. The unit test module contains a starter
implementation of a unit testing framework for Pigweed.
Change-Id: I46e1a4cae1fd8ce36d7840a2e92f8013fb489cde
This change adds Pigweed's first few (incomplete) modules: pw_build,
pw_status, and pw_toolchain. The main scaffolding for Pigweed's GN-based
build system is also included, with a root BUILDCONFIG and BUILD.gn file
defining a top-level modules build target.
Change-Id: I09599443d50696343d6c5b85853cb5cee3ce0026