summaryrefslogtreecommitdiff
path: root/zephyr/zmake
Commit message (Collapse)AuthorAgeFilesLines
* Reland "zephyr: zmake: Ensure all output is produced"Simon Glass2021-05-071-2/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This partially reverts commit 5bc4134337bdabd601159bce047306c73f13e8f8. Reason for revert: Seeing if this can be landed now I removed test_filter_debug() from this CL, since it has already been submitted with a full check of the output. Original change's description: > Revert "zephyr: zmake: Ensure all output is produced" > > This reverts commit ee4257735632f5453b9377f9f60f5c68f6917537. > > Reason for revert: depends on CL:2807486, which is responsible for CQ > failures (crbug.com/1198472). > > BUG=chromium:1198472 > BRANCH=none > TEST=pytest zephyr/zmake/test > > Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> > Change-Id: I5face75f3e59858b68a0b6e77d5c5b1a9881008a > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2823547 > Reviewed-by: Sonny Rao <sonnyrao@chromium.org> BUG=b:184298184, chromium:1198472 BRANCH=none TEST=(cd zephyr/zmake/; python3 -m pytest tests/*.py -v -k test_filter) Change-Id: I0a02d32234d871ba45833eaaab0e979b28257ca8 Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2841023 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* zmake: Add a helper function for test filenamesSimon Glass2021-05-071-16/+16
| | | | | | | | | | | | | Create a new function to reduce the amount of duplicated code. BUG=b:184298184 BRANCH=none TEST=(cd zephyr/zmake/; python3 -m pytest tests/*.py -v -k test_filter) Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I51124fa47eb298112bd9b2b06018d8f14b9968ca Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2880415 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* zephyr: zmake: Add a test for zmake and output filteringSimon Glass2021-05-035-0/+797
| | | | | | | | | | | | | | | | | | | | | | | | | | | At present there are no tests for zmake.py itself. Add a simple one to provide some coverage. Use this to test that the filtering does what we expect. This works by using some pre-canned output for the RO and RW, running each file through a separate 'cat' command in its own process, then comparing the results obtained in the log. BUG=b:177096315 BRANCH=none TEST=cros workon --host start chromeos-base/zephyr-build-tools && \ sudo emerge chromeos-base/zephyr-build-tools && \ make -j16 runhosttests buildall && zmake testall && \ zephyr/firmware_builder.py --metrics /tmp/tmplt8ty8ci test ; echo $? count=0 ; while pytest --verbose zephyr/zmake/tests/test_zmake.py ; do count=$(($count + 1)) ; echo "PASSED $count times" ; rm -rf .pytest_cache/ ; done Change-Id: I9749d9533091ad5c54c298ba6268efcd91fd2bf4 Signed-off-by: Jeremy Bettis <jbettis@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2863945 Tested-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org> Commit-Queue: Jeremy Bettis <jbettis@chromium.org>
* zmake: Cleanup the ninja outputJeremy Bettis2021-05-031-20/+29
| | | | | | | | | | | | | | | With this change, only real warnings and errors show in the output. BUG=b:184298184 TEST=zmake testall BRANCH=None Signed-off-by: Jeremy Bettis <jbettis@google.com> Change-Id: I059325d3cdf0b118d35a62be63710327dfac3636 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2863944 Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Tested-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
* zmake: Prefix logs with the name of the projectJeremy Bettis2021-05-033-46/+84
| | | | | | | | | | | | | | | | Since many commands are running in parallel, prefix each line of output with the project that generated that output. BUG=b:184298184 TEST=zmake testall BRANCH=None Change-Id: I1d5d66c0c1366aff96ac0b46a290c52c6db747a4 Signed-off-by: Jeremy Bettis <jbettis@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2863943 Tested-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Yuval Peress <peress@chromium.org> Commit-Queue: Jeremy Bettis <jbettis@chromium.org>
* zephyr: zmake: resolve the build directory in build phaseJack Rosenthal2021-05-011-0/+1
| | | | | | | | | | | | | | | | | | If "zmake build" is passed a relative directory (as is the case with the chromeos-base/chromeos-zephyr ebuild), we need to resolve it to the absolute path before using it in a binman invocation, as binman is invoked in a different working directory than "zmake build" was started from. BUG=b:181337770 BRANCH=none TEST=emerge-trogdor-zephyr chromeos-zephyr Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: Idd9896f240013760f40cf40387f01bfc291a6f57 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2865026 Commit-Queue: Simon Glass <sjg@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
* zmake: Stop logging the date and logger name.Jeremy Bettis2021-05-011-1/+1
| | | | | | | | | | | | | | | | Instead of logging `date Logger/LEVEL: message`, just log `LEVEL: message`. BUG=b:184298184 TEST=zmake testall BRANCH=None Signed-off-by: Jeremy Bettis <jbettis@google.com> Change-Id: Ic88b0e05e51acd3ee68662f18c9cdf41615442df Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2863942 Tested-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Jeremy Bettis <jbettis@chromium.org>
* zephyr: drop programmatic generation of binman device-tree inputJack Rosenthal2021-05-011-93/+18
| | | | | | | | | | | | | | | | | | | | | | | Move the binman device-tree input into the Zephyr build system's DTS, which allows overriding parts of the binman settings on a board/project specific basis using device-tree. In the process, we need to move the flash offset and size to device-tree instead of Kconfig, because Kconfig is not including during device-tree preprocessing. This is overall, a net-good change, as this should never been Kconfig in the first place. This assumes the existing Kconfig defaults of 512 KB of flash with 256 KB sections, however can still be overridden via device-tree. BUG=b:184388037 BRANCH=none TEST=zmake testall manually investigate the flash output for lazor using dump_fmap Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I424ea15454d5cd02947642116673bebcad3406cd Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2860987 Reviewed-by: Simon Glass <sjg@chromium.org>
* zephyr: zmake: Change 2nd underscore for a hyphen in version formatJack Rosenthal2021-04-302-3/+3
| | | | | | | | | | | | | | | According to CL:2861267, this is apparently a load-bearing underscore, and should look more like the old CroS EC version format for factory process, GoldenEye, etc. to work out better. BUG=b:181337770 BRANCH=none TEST=unit tests Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: Iab293eade1f8252f58e670175b946730405eb498 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2862904 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* zephyr: zmake: support version in FRID/FWIDJack Rosenthal2021-04-292-8/+31
| | | | | | | | | | | | | | | | | | | | | | | Add version information to FRID/FWID using get_version_string. Note: static version option is not plumbed yet to main function, will handle in follow up CL later (non-critical feature). Note: version is not copied into build yet, will do that in a follow-up CL too, which will get rid of our cmake call to get_version.sh. BUG=b:184832251 BRANCH=none TEST=zmake configure -b -B /tmp/lazor projects/trogdor/lazor dump_fmap -x /tmp/lazor/outputs/zephyr.bin RO_FRID RW_FWID observe contents of RO_FRID RW_FWID Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I95e960b6d13360ac4dbad928da9580909b0e2ec7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2857915 Commit-Queue: Simon Glass <sjg@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
* zephyr: zmake: add utility to compute version stringJack Rosenthal2021-04-292-0/+163
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a function, get_version_string, which generates a version string to be used in FRID, FWID, or in headers for the build. The format selected was: LAST_COMPONENT_OF_PROJECT_DIR "_v" ZEPHYR_MAJOR_VERSION "." ZEPHYR_MINOR_VERSION "." TOTAL_COMMITS "_" VCS_HASHES Where VCS_HASHES is the (sorted) list of modules + Zephyr OS commit hashes, like so: mod1:02fd7a,mod2:b5991f,os:2c65cb There is also an option for a "static" version, like in CrOS EC OS, which is not affected by Git repository state. This is useful for comparing builds across commits. In this case, TOTAL_COMMITS is fixed to zero, and VCS_HASHES is set to "STATIC". Note: This is mostly just an initial pass at the version string format, and shouldn't be considered "final" yet. We can make further iterations on the format as we deem necessary. BUG=b:184832251 BRANCH=none TEST=unit tests Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I7560c7d677f5d5ec5cf26ff6048eea91843515c3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2857914 Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
* zephyr: zmake: enable verbose logging with --debugJack Rosenthal2021-04-211-3/+9
| | | | | | | | | | | | | | | | | | | | | | The --debug parameter (which is passed in the CQ, since we want to see as much failure context as we can in the logs) currently prevents disabling tracebacks. We had some discussion when that landed about making it enable verbose logging as well. Make the default with --debug as DEBUG instead of WARNING. BUG=none BRANCH=none TEST=zmake -D testall => observed log level is DEBUG zmake testall => observed log level is WARNING zmake -l INFO testall => observed log level is INFO Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I87bf1d7cca34cffd9ff6deeb53fecf0ae8f2e362 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2842364 Commit-Queue: Simon Glass <sjg@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
* Revert "Reland "zephyr: zmake: Add a test for zmake and output filtering""Jack Rosenthal2021-04-204-747/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 477997408185b0d446d388239a53657de6367570. Reason for revert: Introduces flakes to the CQ BUG=chromium:1196696 TEST=none Original change's description: > Reland "zephyr: zmake: Add a test for zmake and output filtering" > > This reverts commit 3ea453e890f2f782e8195c94af5de00c8c754f74. > > Reason for revert: Trying again to see what error is produced > > Original change's description: > > Revert "zephyr: zmake: Add a test for zmake and output filtering" > > > > This reverts commit ca160a3394c952f0732f66eb113b9735b5655ed2. > > > > Reason for revert: responsible for CQ failures (crbug.com/1198472) > > > > BUG=chromium:1198472 > > BRANCH=none > > TEST=pytest zephyr/zmake/test > > > > Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> > > Change-Id: I273ee3e26309d595973ec8040a2d835169096670 > > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2824028 > > Reviewed-by: Sonny Rao <sonnyrao@chromium.org> > > Bug: chromium:1198472 > Change-Id: Icaae5c6698f6747b634952d03ae83668e937c089 > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2822402 > Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> > Commit-Queue: Jeremy Bettis <jbettis@chromium.org> > Commit-Queue: Jack Rosenthal <jrosenth@chromium.org> Bug: chromium:1198472 Change-Id: Iabbfdf2c7af82113d91f9aeba256024b7e59b4f8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2842363 Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>
* Reland "zephyr: zmake: Add a test for zmake and output filtering"Simon Glass2021-04-204-2/+747
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 3ea453e890f2f782e8195c94af5de00c8c754f74. Reason for revert: Trying again to see what error is produced Original change's description: > Revert "zephyr: zmake: Add a test for zmake and output filtering" > > This reverts commit ca160a3394c952f0732f66eb113b9735b5655ed2. > > Reason for revert: responsible for CQ failures (crbug.com/1198472) > > BUG=chromium:1198472 > BRANCH=none > TEST=pytest zephyr/zmake/test > > Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> > Change-Id: I273ee3e26309d595973ec8040a2d835169096670 > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2824028 > Reviewed-by: Sonny Rao <sonnyrao@chromium.org> Bug: chromium:1198472 Change-Id: Icaae5c6698f6747b634952d03ae83668e937c089 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2822402 Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>
* zmake: Fix test deadlineYuval Peress2021-04-161-0/+4
| | | | | | | | | | | | | | | In CQ sometimes IO operations take a while, set a deadline of 1 minute for the util tests which read/write to files. BRANCH=none BUG=b:185257506 TEST=pytest zephyr/zmake/tests Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: Ie1dd9aed3d3556f748aaa087f47a10724169529d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2829979 Commit-Queue: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: zmake: bind lambda for pytest using default argumentJack Rosenthal2021-04-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | In Python, a lambda or function will capture variables in the parent scope, but using a variable in a loop does not create a new scope. Thus, the test_file argument is being executed as the current value of test_file, not necessarily the value that happened that iteration in the loop. Prior to this CL, we were not guaranteed to run every pytest. It's racy and causes us to run some tests twice or even three times, while completely skipping other tests. Using a default argument in the lambda will bind to the current value instead of the variable. See this SO post for further discussion: https://stackoverflow.com/questions/2295290 BUG=none BRANCH=none TEST=zmake testall Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I5eda075980cce0af13fb7a114fd1917fa6732754 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2823148 Reviewed-by: Yuval Peress <peress@chromium.org>
* zephyr: zmake: make zmake.multiproc.Executor object a class memberJack Rosenthal2021-04-131-11/+11
| | | | | | | | | | | | | | | | | Make the executor object which is currently used in the testall and coverage methods a member of the Zmake object. This will allow us to apply the executor in more places, creating better practices about how we claim and release our jobs. BUG=b:185163907 BRANCH=none TEST=zmake testall Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: Idccf0d053ea8b5ee91a47891705d95a048a7036a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2821607 Reviewed-by: Yuval Peress <peress@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
* zephyr: zmake: remove fail_fast functionalityJack Rosenthal2021-04-134-55/+14
| | | | | | | | | | | | | | | | | | This functionality is something which fundamentally leads to buggy code, as allowing multiproc.Executor.wait() to return while jobs are actually still running means the programmer needs to consider the case that subprocesses are still doing work. Remove it. BUG=chromium:1188822,b:182818881,b:185163907 BRANCH=none TEST=zmake testall Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: Iffa9770734ce4fce8d62de2e3472235eb1cf9c4c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2821606 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* Revert "zephyr: zmake: Add a test for zmake and output filtering"Jack Rosenthal2021-04-134-747/+2
| | | | | | | | | | | | | | | This reverts commit ca160a3394c952f0732f66eb113b9735b5655ed2. Reason for revert: responsible for CQ failures (crbug.com/1198472) BUG=chromium:1198472 BRANCH=none TEST=pytest zephyr/zmake/test Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I273ee3e26309d595973ec8040a2d835169096670 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2824028 Reviewed-by: Sonny Rao <sonnyrao@chromium.org>
* Revert "zephyr: zmake: Ensure all output is produced"Jack Rosenthal2021-04-132-20/+2
| | | | | | | | | | | | | | | | This reverts commit ee4257735632f5453b9377f9f60f5c68f6917537. Reason for revert: depends on CL:2807486, which is responsible for CQ failures (crbug.com/1198472). BUG=chromium:1198472 BRANCH=none TEST=pytest zephyr/zmake/test Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I5face75f3e59858b68a0b6e77d5c5b1a9881008a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2823547 Reviewed-by: Sonny Rao <sonnyrao@chromium.org>
* Revert "zephyr: zmake: Show devicetree / compiler errors"Jack Rosenthal2021-04-133-336/+2
| | | | | | | | | | | | | | | | This reverts commit 6b3b01cbf8a7c2a6a41402fcbc504028b4434497. Reason for revert: depends on CL:2807486, which is responsible for CQ failures (crbug.com/1198472). BUG=chromium:1198472 BRANCH=none TEST=pytest zephyr/zmake/test Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I3f05e547c95b05d0ac3803bed946d7666346bf25 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2823546 Reviewed-by: Sonny Rao <sonnyrao@chromium.org>
* zephyr: zmake: Show devicetree / compiler errorsSimon Glass2021-04-133-2/+336
| | | | | | | | | | | | | | | Some errors are currently suppressed by default which is not very friendly. Fix this. BUG=b:177096315 BRANCH=none TEST=(cd zephyr/zmake/ && python3 -m pytest .) Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: Icdf8e8c91003a3f89d20c704a324673e1269cb0a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2809781 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Yuval Peress <peress@chromium.org>
* zephyr: zmake: Ensure all output is producedSimon Glass2021-04-132-2/+20
| | | | | | | | | | | | | | | | | | At present if one process finishes with an error the output of other processes may be truncated, since zmake exits immediately. This can be confusing since running repeatedly gives different output. Fix it by waiting until all processes are complete before exiting. BUG=b:184298184 BRANCH=none TEST=(cd zephyr/zmake/ && python3 -m pytest .) Change-Id: Ib6c3dd5966c2b381d811c84e3c1c5b5f5fc3cf9a Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2801173 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Yuval Peress <peress@chromium.org>
* zephyr: zmake: Add a test for zmake and output filteringSimon Glass2021-04-134-2/+747
| | | | | | | | | | | | | | | | | | | | | | | | | | | At present there are no tests for zmake.py itself. Add a simple one to provide some coverage. Use this to test that the filtering does what we expect. This works by using some pre-canned output for the RO and RW, running each file through a separate 'cat' command in its own process, then comparing the results obtained in the log. In creating this test, unexpected behaviour was found with the image-size logging (Memory, FLASH:, etc), in that they end up on the ERROR level, if previous output has appeared on that level. This is because the default log level changes to whatever the last log output was. So fix this at the same time. For now we don't check the DEBUG level, since it has a bug. BUG=b:177096315 BRANCH=none TEST=(cd zephyr/zmake/ && python3 -m pytest .) Signed-off-by: Simon Glass <sjg@chromium.org> Cq-Depend: chromium:2819138 Change-Id: Iaa777815b577ab814eb2e69d34a3047ae57f0b45 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2807486
* zephyr: Wait for zmake logging even on errorJeremy Bettis2021-04-091-5/+7
| | | | | | | | | | | | | | | | | | | | When zmake fails, some of the logging of subprocesses can be lost. Call multiproc.wait_for_log_end() even if the subcommand raises an error. BUG=b:184298184 TEST=Wrote a test that doesn't compile, then cros workon --host start chromeos-base/zephyr-build-tools sudo emerge chromeos-base/zephyr-build-tools zmake -j 1 configure --test zephyr/test/drivers BRANCH=none Change-Id: If7799c1cc6f50a0d4602f7bc931d51abf95d00f2 Signed-off-by: Jeremy Bettis <jbettis@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2815244 Tested-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org> Commit-Queue: Jeremy Bettis <jbettis@chromium.org>
* zephyr: Bundle a summary code coverage fileJeremy Bettis2021-04-071-4/+17
| | | | | | | | | | | | | | | | | | | | | | | | Fix zmake coverage, it was still using the removed claim_job flag. Change zmake coverage to output a summary lcov.info file as well. Implement zephyr/firmware_builder.py --code-coverage test. Implement zephyr/firmware_builder.py --code-coverage bundle. BRANCH=none BUG=b:183007888 TEST=cros workon --host start chromeos-base/zephyr-build-tools sudo emerge chromeos-base/zephyr-build-tools zephyr/firmware_builder.py --metrics=/tmp/m --code-coverage test zephyr/firmware_builder.py --metrics=/tmp/m --code-coverage bundle tar tvf /tmp/artifact_bundles/coverage.tbz2 cat /tmp/artifact_bundle_metadata Signed-off-by: Jeremy Bettis <jbettis@google.com> Change-Id: I3fbdc4e57029d23a4d24b7ad6e003ee624c75f37 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2809354 Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Kevin Shelton <kmshelton@chromium.org> Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Tested-by: Jeremy Bettis <jbettis@chromium.org>
* zephyr: zmake: Reset the multiproc module before useSimon Glass2021-04-072-0/+8
| | | | | | | | | | | | | | | | | At present the logging map from one test can still be around for a following tests. This can cause strange behaviour. Add a reset() function to help with this. Call it from the Zmake constructor which is used by any test which cares about this. BUG=b:177096315 BRANCH=none TEST=with other CLs, see that the tests pass when all run together Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I0bf112e705c6badd3958a0afba8a3761e95fa547 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2809780 Reviewed-by: Yuval Peress <peress@chromium.org>
* zephyr: zmake: add FMAP entries using binmanJack Rosenthal2021-04-021-5/+24
| | | | | | | | | | | | | | | | | Add expected FMAP structure (see bug) using binman. You need crrev.com/c/2803414 to get the section types in FMAP. (Does not need to be in CQ Dep though, as code works fine without it, you just miss the WP_RO, EC_RO, and EC_RW entries). BUG=b:184146709 BRANCH=none TEST=dump_fmap -H zephyr.bin Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I5c6bbc71732a4f2c16c963c5fbf3a5efd5ca7727 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2802838 Reviewed-by: Simon Glass <sjg@chromium.org>
* zephyr: zmake: Support sequential buildsSimon Glass2021-04-022-45/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | At present with 'zmake build' everything happens in parallel. This is nice because it saves time. However if there is a build error, or some warnings, these typically appear twice, since both the RO and RW builds are (mostly?) compiling the same code. It is not useful to show the same message twice. As a partial solution, use -j1 to make the RO and RW builds happen one after the other, stopping if the first one fails. This flag can be used in an IDE to provide friendlier output. Admittedly this results in a slower build, but the difference is only material when Kconfig or device tree have changed and everything is being rebuilt. Most of the time an incremental build only takes a second, so this option is quite handy. BUG=b:177096315 BRANCH=none TEST=manually test by running zmake build / configure FEATURE=test sudo -E emerge zephyr-build-tools Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: Ie66cf894a87b05a7648a77767e37e94636771c6a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2789798 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: zmake: Allow warnings to break the buildSimon Glass2021-04-023-9/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | Now that we are showing warnings by default (and not requiring -l DEBUG) they are more likely to receive action. But for the commit queue it seems useful to fail the build if there are any warnings, just in case people are not very observant in their local builds. Add a -w flag for this. It works by checking for any output in the ERROR log, which is safer now that we have cleaned up the error output to just include actual errors. Put the check in a separate function since it will be called from a different place in a future CL. BUG=b:177096315 BRANCH=none TEST=manually test by running zmake build / configure FEATURE=test sudo -E emerge zephyr-build-tools Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I4c0ec53d2836ce0ba67b3c8bcf39b53fa1af2945 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2789797 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Yuval Peress <peress@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: Add zmake command coverage.Jeremy Bettis2021-04-022-1/+169
| | | | | | | | | | | | | | | | | | | Added a new zmake sub-command `coverage`, which builds all projects with coverage, runs unit tests, and creates a html coverage report. BUG=b:183007888 TEST=sudo emerge zephyr-build-tools && \ zmake coverage build/ztest-coverage BRANCH=none Change-Id: Idb6af59c223ece00d3eb09982778cb1b500d8db4 Signed-off-by: Jeremy Bettis <jbettis@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2794925 Tested-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Yuval Peress <peress@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* zmake: Refactor _logging_map to use a classSimon Glass2021-04-011-16/+45
| | | | | | | | | | | | | | | | | | | At present this uses a tuple but it would probably be better to use a named tuple so the fields are named. But we also want to be able to track the output (in a future CL), so change it to a class. Use a log_line() method to avoid anything needing access to its internals. Also put brackets after the log_output() function so it is easier to see that it is a function. BUG=b:177096315 BRANCH=none TEST=FEATURE=test sudo -E emerge zephyr-build-tools Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: Icca863ee706b368109d24782a994a0a009316650 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2796848 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: Add find_projects() to zmake.project.Jeremy Bettis2021-03-313-12/+62
| | | | | | | | | | | | | | | | A new generator function which searches subdirectories for zmake projects. BUG=b:183007888 TEST=zmake testall BRANCH=none Signed-off-by: Jeremy Bettis <jbettis@google.com> Change-Id: Iceca946a12e0e64a46c5994366734addb3e24cb2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2795931 Commit-Queue: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Tested-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: zmake: Move CRITICAL output to ERRORSimon Glass2021-03-311-3/+0
| | | | | | | | | | | | | | | | There really isn't an obvious distinction here between something that is critical and something that is just an error. They are both errors and stop the build, requiring user action. Drop this test and let everything that doesn't otherwise match become an ERROR. BUG=b:177096315 BRANCH=none TEST=manually test by running zmake build / configure Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I94342d9425046285efde8ec9d9c79e79ad9ba181 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2789796 Reviewed-by: Yuval Peress <peress@chromium.org>
* zephyr: zmake: Drop the 'boilerplate' message on stderrSimon Glass2021-03-311-1/+21
| | | | | | | | | | | | | | | The 'Including boilerplate' message is still there on every build and still doesn't seem that useful. Add a filter to the stderr output so we can move it to DEBUG. BUG=b:177096315 BRANCH=none TEST=manually test by running zmake build / configure Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I6e356c0abecbbba624fd41144a3c460398a4e874 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2789795 Reviewed-by: Yuval Peress <peress@chromium.org>
* zephyr: zmake: Drop common cmake and ninja messagesSimon Glass2021-03-311-0/+10
| | | | | | | | | | | | | | | | | | | | | When ninja gets an error it reports that the build stops, but we know that since we see the error and get a return code. Move it to DEBUG. Similarly cmake shows FAILED which is not useful since we can see the actual error immediately above, so move it to INFO. Also it prints out the command that failed but this is normally just a 20-line compiler invocation command which is not actionable and makes it easy to miss the one-line, useful error from the compiler. Move that to DEBUG. BUG=b:177096315 BRANCH=none TEST=manually test by running zmake build / configure Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I0a5946e0210c05f09c0af06817fd263ee17384f3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2789794
* zephyr: zmake: Move devicetree output to DEBUGSimon Glass2021-03-301-0/+14
| | | | | | | | | | | | | | This output appears when a Kconfig or devicetree change is detected. It the same every time and is not an error. Move it to INFO. BUG=b:177096315 BRANCH=none TEST=manually test by running zmake build / configure Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I585dbff4439650f031318ebd0c6c5a35c8f1ff2e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2789793 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: zmake: Drop success and info messagesSimon Glass2021-03-301-0/+10
| | | | | | | | | | | | | | | | | | | | | Update the filter to assume everything it doesn't know about is an error. This is safer than leaving it as an INFO message. On the other hand, build success should be assumed unless otherwise notified, so move the *** SUCCESS *** message and associated asterisk lines to DEBUG. The build ends with a note about memory usage. This is helpful, but is not an error, so show it on the default INFO. BUG=b:177096315 BRANCH=none TEST=manually test by running zmake configure / build Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: Ief932c2f6343049c0b21493231c72c0390bfd444 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2788847 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: zmake: Move progress information to DEBUGSimon Glass2021-03-301-0/+10
| | | | | | | | | | | | | | | | | | | Perhaps unique among ninjas, 'ninja' is very noisy about its progress. This information is not actionable and goes past so quickly only a true ninja could read it. Move it to DEBUG. Do the same with 'Entering directory' since this happens every time and is not very interesting. BUG=b:177096315 BRANCH=none TEST=manually test by running zmake with -D Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: Ied1ac3e73d14b8cd6009aa7ad4247d4fcc6a849b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2788846 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>
* zmake: Adjust the 'building' message to show the commandSimon Glass2021-03-301-2/+4
| | | | | | | | | | | | | | It is useful to be able to see what zmake is doing sometimes. Add the command being run to the output, for informational purposes. BUG=b:177096315 BRANCH=none TEST=manually test by running zmake build Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I7a392a68c9053adb7ec9a2ccf14d52718bf4718a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2788845 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zmake: Send output to INFO by defaultSimon Glass2021-03-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | At present zmake sends most of its output to DEBUG in an attempt to deflect the onslaught of useless progress messages produced by ninja, as well as a good quantity of unactionable output from the Zephyr build system. While this approach certainly makes building bearable, unfortunately it hides a multitude of sins, including introducing build warnings. The correct level, if we have no other information, is INFO, since DEBUG is normally only useful to those debugging the build. Switch it over, with the expectation that future CLs will reduce the INFO output down to a trickle. BUG=b:177096315 BRANCH=none TEST=manually test by running zmake configure / build Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I57fd95034aadd91815cdf8671efc57f946d61255 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2788844 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>
* zmake: Use a common function to report a failure messageSimon Glass2021-03-301-12/+17
| | | | | | | | | | | | | | | | | | | | At present when zmake fails the resulting messages is independently created in a different place for each subcommand. Move this in a common function, so we can make it consistent. Also adjust the output to show the command at the end, in case the user wants to copy it out and try it. Drop the exclaimation mark since errors are not all that exciting. BUG=b:177096315 BRANCH=none TEST=manually test by running zmake configure / build Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I913c3c86dcd257ed8a7f5d378b38e31d7c6d6465 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2788843 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: zmake: Avoid showing a backtrace on errorsSimon Glass2021-03-301-0/+5
| | | | | | | | | | | | | | | | | The backtrace is typically only useful for people debugging zmake. Others just want to use it as a tool and the error message should be enough to explain what is going on. Add a debug flag (-D) to enable the backtrace; otherwise drop it. BUG=b:177096315 BRANCH=none TEST=manually test by running zmake with -D Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: Ib8425289fb057cc907d73fbddb7eee8351fb84d8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2788842 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: Have zmake log every command run at DEBUGJeremy Bettis2021-03-251-1/+4
| | | | | | | | | | | | | | | If you want to see the command line of cmake and ninja, this is helpful. BUG=b:183007888 TEST=zmake -l DEBUG BRANCH=none Change-Id: Icb8baebd36349b1b1a83e74c3ae6dec05bd28ae1 Signed-off-by: Jeremy Bettis <jbettis@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2786064 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Tested-by: Jeremy Bettis <jbettis@chromium.org>
* zephyr: Add --coverage option to zmake configureJeremy Bettis2021-03-182-1/+7
| | | | | | | | | | | | | | | | | | zmake configure --coverage will add CONFIG_COVERAGE to the active kconfigs. BUG=b:183007888 TEST=zmake configure --coverage --test -B \ build/ztest-coverage/accel_cal zephyr/test/accel_cal BRANCH=none Signed-off-by: Jeremy Bettis <jbettis@google.com> Change-Id: I24465a29c9930762b81319f11fcf834e33d938cc Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2770507 Tested-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Jeremy Bettis <jbettis@chromium.org>
* zephyr: zmake: drop support for zephyr v2.4Jack Rosenthal2021-02-232-2/+2
| | | | | | | | | | | | | | | | | | | Drop support for Zephyr OS v2.4 on all boards, since the v2.5 uprev is successful. If someone still needs to manually compile for v2.4 for testing, one can do so by passing --zephyr-base=$PATH_TO_ZEPHYR_24 and --ignore-unsupported-zephyr-version to zmake. BUG=b:180409973 BRANCH=none TEST=zmake testall Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I0b3922c0b7f47811b26bad4e7f99125cabdaed91 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2715345 Commit-Queue: Simon Glass <sjg@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
* zephyr: zmake: prune modules to only those required by the projectJack Rosenthal2021-02-233-0/+89
| | | | | | | | | | | | | | | | | | | | | Implement a new configuration option: "modules", which allows projects to require only specific modules. This is needed for chameleon so they can only require the modules they need (instead of all modules supported by zmake). From pfagerburg@: When zmake pulled in one of the EC modules, that module wanted a bunch of EC symbols to be defined in Chameleon's Kconfig, e.g., CROS_EC_RO and CROS_EC_RW. BUG=b:180545676 BRANCH=none TEST=provided unit test Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I17bf2ac9a8f75f2879e5a67b991fd60d77071c32 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2702509 Reviewed-by: Simon Glass <sjg@chromium.org>
* zephyr: zmake: implement --modules-dir parameterJack Rosenthal2021-02-234-14/+88
| | | | | | | | | | | | | | | | | | | Implement a parameter --modules-dir parameter, which lets the user create a flat directory, with each Zephyr module named appropriately as a subdirectory. This allows Zmake to be used without a Chrome OS source tree if both --modules-dir and --zephyr-base are provided. BUG=b:179813084 BRANCH=none TEST=unit tests TEST=gitlab CI Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: Ibedd1721bcc3f4dc6bae9e9b19d548e82297fa2a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2702507 Reviewed-by: Simon Glass <sjg@chromium.org>
* zephyr: zmake: disable fuzzer deadlines on test_popen_cmake_kconfigJack Rosenthal2021-02-181-0/+1
| | | | | | | | | | | | | | | | | | Hypothesis likes seeing reliable test timings, but the CQ builder environment is somewhat CPU taxed, to the point it trips up syscall heavy tests. Disable it for this one as it seems to occasionally flake. BUG=chromium:1179882 BRANCH=none TEST=CQ de-flakes? Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: Id98c17a9715bd585dab40316b3cc2073aecc128d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2704535 Commit-Queue: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org>
* zephyr: zmake: fix typo in help messageJack Rosenthal2021-02-181-1/+1
| | | | | | | | | | | | | bRingup -> bringup BUG=none BRANCH=none TEST=zmake --help Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I5c2fcdd040f1aec45b2a0d9682249d4d179483f7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2702506 Reviewed-by: Simon Glass <sjg@chromium.org>