Commit Graph

11 Commits

Author SHA1 Message Date
Alexei Frolov
917756d925
Add a stamp option to pw_python_script
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
2019-11-12 15:07:43 -08:00
Alexei Frolov
d1f98fadeb Script-runner script and pw_python_script template
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
2019-11-12 18:40:24 +00:00
Alexei Frolov
02dfcc47d9 Make default toolchain a build argument
This change makes the default toolchain for the build system an
argument so that it can be configured per build target.

Change-Id: I32822be9a6e33376bb1e75b996f79d3451ef9963
2019-11-11 17:59:47 +00:00
Wyatt Hepler
771056581c pw_span module
pw::span is a stand-in for C++20's std::span.

Change-Id: I1f36d5da43493c20b4806f6cb1198faf62d47743
2019-11-08 17:15:01 -08:00
Keir Mierle
2b0e008a75 pw_unit_test: Clang fixes
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
2019-11-08 00:01:49 -08:00
Alexei Frolov
925fb8f510 Build and run unit tests through GN
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
2019-11-08 01:16:04 +00:00
Wyatt Hepler
979890d732 Compiler option updates
- 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
2019-11-07 10:51:32 -08:00
Keir Mierle
243e32a85f pw_unit_test: Make simple runner look like GTest
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
2019-11-05 14:48:19 -08:00
Alexei Frolov
c10c81201d Add preprocessor and unit_test modules
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
2019-11-04 16:07:34 -08:00
Alexei Frolov
1a82c146ff
Initial Pigweed modules
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
2019-10-31 17:43:53 -07:00
Keir Mierle
5d1226f428 Initial commit for Pigweed
This sets up a basic license, readme, and contributors file.

Change-Id: I384e59e5d5ac0a2369606a360d5d2ed2cbface35
2019-10-31 13:26:45 -07:00