summaryrefslogtreecommitdiff
path: root/zephyr/zmake/tests
Commit message (Collapse)AuthorAgeFilesLines
* Revert "zmake: Trim short version on full hashes"Jack Rosenthal2021-09-212-68/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 695b3c909c4846493eacd324e9c26933847372d1. Reason for revert: Broke CQ See https://ci.chromium.org/ui/p/chromeos/builders/postsubmit/trogdor-zephyr-postsubmit/314 Original change's description: > zmake: Trim short version on full hashes > > The ec_version.h contains both a long build string and also a 31 char > string. Change the short string to omit the commit count, and only > include full hashes, i.e. hayato_v2.6-ec:5bd1aa,os:ade7b4 not > hayato_v2.6.73670-ec:5bd1aa,os: > > Change test to be a real version string with hashes of the right length. > > BUG=None > BRANCH=None > TEST=./zephyr/zmake/run_tests.sh > > Change-Id: I18d73345036933594b8c74187796c3727f868629 > Signed-off-by: Jeremy Bettis <jbettis@google.com> > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3160464 > Tested-by: Jeremy Bettis <jbettis@chromium.org> > Auto-Submit: Jeremy Bettis <jbettis@chromium.org> > Commit-Queue: Jack Rosenthal <jrosenth@chromium.org> > Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Bug: None Change-Id: Ib4282f761c514c0ca2da6249d38ccc9cba852f6d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3172040 Auto-Submit: Jack Rosenthal <jrosenth@chromium.org> Tested-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
* zmake: Trim short version on full hashesJeremy Bettis2021-09-202-24/+68
| | | | | | | | | | | | | | | | | | | | | The ec_version.h contains both a long build string and also a 31 char string. Change the short string to omit the commit count, and only include full hashes, i.e. hayato_v2.6-ec:5bd1aa,os:ade7b4 not hayato_v2.6.73670-ec:5bd1aa,os: Change test to be a real version string with hashes of the right length. BUG=None BRANCH=None TEST=./zephyr/zmake/run_tests.sh Change-Id: I18d73345036933594b8c74187796c3727f868629 Signed-off-by: Jeremy Bettis <jbettis@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3160464 Tested-by: Jeremy Bettis <jbettis@chromium.org> Auto-Submit: Jeremy Bettis <jbettis@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* system: Add CrOS FWID to version outputRob Barnes2021-09-141-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | EC version does not follow the the AP and OS version. This causes confusion during development. This change augments the EC version output to include the CrOS FWID when available. The CrOS FWID will be missing when the CrOS EC is built outside of cros_sdk. When CrOS FWID is missing 'CROS_FWID_MISSING' will be used. Zephyr/zmake support will be added later, CROS_FWID32 is set to 'CROS_FWID_MISSING' in zephyr builds until then. BUG=b:188073399 TEST=version 21-05-20 16:43:18.627 Chip: Nuvoton NPCX993F A.00160101 21-05-20 16:43:18.631 Board: 1 21-05-20 16:43:18.631 RO: guybrush_v2.0.8770+f47439f75 21-05-20 16:43:18.634 guybrush_13983.0.21_05_20 21-05-20 16:43:18.639 RW_A: * guybrush_v2.0.8770+f47439f75 21-05-20 16:43:18.641 * guybrush_13983.0.21_05_20 21-05-20 16:43:18.644 RW_B: guybrush_v2.0.8770+f47439f75 21-05-20 16:43:18.644 guybrush_13983.0.21_05_20 21-05-20 16:43:18.647 Build: guybrush_v2.0.8770+f47439f75 21-05-20 16:43:18.651 guybrush_13983.0.21_05_20 2021-05-20 21-05-20 16:43:18.657 16:31:19 robbarnes@robbarnes0 ectool version RO version: guybrush_v2.0.8770+f47439f75 RO cros fwid: guybrush_13983.0.21_05_20 RW version: guybrush_v2.0.8770+f47439f75 RW cros fwid: guybrush_13983.0.21_05_20 Firmware copy: RO Build info: guybrush_v2.0.8770+f47439f75 guybrush_13983.0.21_05_20 2021-05-20 16:31:19 robbarnes@robbarnes0 Tool version: 1.1.9999-f47439f @robbarnes0 BRANCH=None Signed-off-by: Rob Barnes <robbarnes@google.com> Change-Id: Ief0a0c6e9d35edc72ac2d4780ee203be41d7305f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2894145 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* zephyr: zmake: Bound size of relative paths for resolve_build_dir testsJack Rosenthal2021-09-131-1/+4
| | | | | | | | | | | | | | | | | | | | | In Linux, both filenames and paths are not unbounded in size. The typical constants NAME_MAX and PATH_MAX specify the maximum size (in bytes) of a file name and a file path, respectively. In Linux, these constants are 256 and 4096. The regex which was previously used here assumed file names could be infinitely long. Bound it. Additionally, we need to limit to ASCII word characters, as Unicode characters may sometimes be more than one byte. BUG=b:199769823 BRANCH=none TEST=run unit tests Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I404302ea10ec27acc9c8e6988bb6dd6050deb09a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3158895 Reviewed-by: Raul E Rangel <rrangel@chromium.org>
* zephyr: zmake: implement multiple toolchain support/probingJack Rosenthal2021-09-014-24/+152
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Our GitLab builder uses different toolchains than the supported ones we use for development. At present, this means that the GitLab CI needs to call -t for each build with the desired toolchain, preventing us from using the more general commands "zmake coverage" or "zmake testall". Extend the idea of toolchain in our config files to be "supported toolchains" instead (i.e., multiple toolchains can be supported instead of one. We do this by refactoring our toolchain support code to consist of two related methods: - "probe" returns True if the toolchain is detected on the system, or False otherwise - "get_toolchain_config" returns the BuildConfig associated with the toolchain for the system, mirroring the functionality previously implemented in lambda functions. Also dropped support for arm-none-eabi, as I believe this was only used early on during scarlet development, and am not aware of any current users. BUG=b:178731498 BRANCH=none TEST=./run_tests.sh TEST=zmake testall Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I9b2ad508ae6703f0c3b56518fc32606c0ff1777c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3134668 Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* zephyr: zmake: add re-exec logicJack Rosenthal2021-08-251-0/+59
| | | | | | | | | | | | | | | | | | | Add some logic to re-exec zmake when running inside of a chroot and we find the source code available (to reduce the number of times we have to update the chroot). Note: we also discussed adding a chroot-upgrade-required warning logic. This is actually a separate idea so will be handled in a separate CL. BUG=b:197636145 BRANCH=none TEST=unit tests Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I26ecbb9a575f22c8667a1928e4bd5836f6fd4fe1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3114503 Reviewed-by: Yuval Peress <peress@chromium.org>
* Reland "zephyr: pull in the version string from zmake"Jack Rosenthal2021-08-203-1/+98
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 93adb802c1a626fbb73d762124e90be4fee08a8b. This commit was reverted due to build failures with the chromeos-zephyr ebuild. The root cause of the build failures was that the ebuild uses different working directories between the configure and build phases, and so the path to the include directory we generate during the configure phase won't work in the build phase. Use the full path here so that we can run the diffrerent phases in different working directories. Diff from original commit: Change-Id: Idcbd0c0546f9fcb12fcd66c617e024b8aa2a893a > --- a/zephyr/zmake/zmake/zmake.py > +++ b/zephyr/zmake/zmake/zmake.py > @@ -235,7 +235,7 @@ class Zmake: > self.logger.info("Clearing old build directory %s", build_dir) > shutil.rmtree(build_dir) > > - generated_include_dir = build_dir / "include" > + generated_include_dir = (build_dir / "include").resolve() > base_config = zmake.build_config.BuildConfig( > environ_defs={"ZEPHYR_BASE": str(zephyr_base), "PATH": "/usr/bin"}, > cmake_defs={ BUG=b:197287679 BRANCH=none TEST=emerge-volteer chromeos-zephyr Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I80cec7a1622edcecc670b7dbeed56dadcdf71555 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3111305 Commit-Queue: Yuval Peress <peress@chromium.org> Reviewed-by: Yuval Peress <peress@chromium.org>
* Revert "zephyr: pull in the version string from zmake"Rob Barnes2021-08-203-98/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 10809eb023d475681b45863e68d906fae4667eda. Reason for revert: Causing build errors b/197287679 Original change's description: > zephyr: pull in the version string from zmake > > Zmake computes a version string and stores it in FRID/FWID, but this > was never plumbed all the way out into the version functionality in > the OS, which was reporting the version generated by > util/getversion.sh. > > Add a mechanism to generate the version header from zmake and replace > the getversion.sh generation with that. > > BUG=b:184832251 > BRANCH=none > TEST=provided unit tests > TEST=get this version string on posix-ec: > posix-ec_v2.6.73347-cmsis:c3bd20,ec:c814a9,hal_stm32:f8ff8d,os:efe095 > 2021-08-18 14:10:18 jrosenth@germania > > Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> > Change-Id: Idec1c5f8b5f014126706e4fdc1f3d158edf40a63 > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3104625 > Reviewed-by: Denis Brockus <dbrockus@chromium.org> Bug: b:184832251 Change-Id: Ifcc4830e3097c8dc8126bb76adfeb3ce75a7a667 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3110293 Auto-Submit: Rob Barnes <robbarnes@google.com> Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org> Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
* zephyr: zmake: organize the commit hashes a bit betterJack Rosenthal2021-08-191-3/+3
| | | | | | | | | | | | | | | | | | - Put EC repo first, since that's probably the most useful commit hash. - Put Zephyr kernel second, since that's probably the second most useful commit hash. - Put all other modules after that, alphasorted. BUG=b:184832251 BRANCH=none TEST=updated unit tests Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: Id14e9706980d733637e29643dd355aaa82a51fc2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3105265 Reviewed-by: Yuval Peress <peress@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>
* zephyr: pull in the version string from zmakeJack Rosenthal2021-08-193-1/+98
| | | | | | | | | | | | | | | | | | | | | | Zmake computes a version string and stores it in FRID/FWID, but this was never plumbed all the way out into the version functionality in the OS, which was reporting the version generated by util/getversion.sh. Add a mechanism to generate the version header from zmake and replace the getversion.sh generation with that. BUG=b:184832251 BRANCH=none TEST=provided unit tests TEST=get this version string on posix-ec: posix-ec_v2.6.73347-cmsis:c3bd20,ec:c814a9,hal_stm32:f8ff8d,os:efe095 2021-08-18 14:10:18 jrosenth@germania Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: Idec1c5f8b5f014126706e4fdc1f3d158edf40a63 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3104625 Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* zephyr: zmake: drop support for v2.5Jack Rosenthal2021-08-112-8/+8
| | | | | | | | | | | | | | v2.5 is now unused, cleanup the last tidbits in zmake supporting it. BUG=b:195571108 BRANCH=none TEST=zephyr/zmake/run_test.sh Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: Iea93f1d8703ad7e9c5c9bac18af0c47aed1e9a7b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3086367 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Fabio Baltieri <fabiobaltieri@google.com>
* zephyr: zmake: drop "print-versions" subcommandJack Rosenthal2021-08-111-38/+0
| | | | | | | | | | | | | | | | This command was intended for use in ebuild, but never instrumented. Remove the dead code. BUG=b:195571108 BRANCH=none TEST=zephyr/zmake/run_tests.sh Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I68d3da2e4dfdb4a44b5a58d2b8e2c01da373c06f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3086366 Reviewed-by: Fabio Baltieri <fabiobaltieri@google.com> Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* zephyr: zmake: run black on all files, enable check in run_tests.shJack Rosenthal2021-07-1212-236/+294
| | | | | | | | | | | | | | | Run black on all files. Enable check in run_tests.sh to enforce future formatting requirements. BUG=b:192389533 BRANCH=none TEST=run_tests.sh Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I5d93ef61d32d0dab4fe4bf3a77faf3f6693be627 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3002839 Commit-Queue: Yuval Peress <peress@chromium.org> Reviewed-by: Yuval Peress <peress@chromium.org>
* zephyr: zmake: Run isort on all files, add check to run_tests.shJack Rosenthal2021-07-029-17/+23
| | | | | | | | | | | | | | | Run isort on all files, and enforce future formatting checks by putting in run_tests.sh. BUG=b:192389533 BRANCH=none TEST=run_tests.sh Cq-Depend: chromium:3003455 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I5795ffae30b88fe3a5f093ab7a0d8cd9389da285 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3002838 Reviewed-by: Yuval Peress <peress@chromium.org>
* zmake: Fix use of ZEPHYR_SDK_INSTALL_DIRYuval Peress2021-07-011-0/+33
| | | | | | | | | | | | | | | | | | | | Zephyr v2.6 (when building using the zephyr SDK) tries to find the sdk using $ENV{ZEPHYR_SDK_INSTALL_DIR}. Add the environment variable def into the toolchain rule of zmake. Note that the cmake -D value for the same key isn't removed. This is to avoid breaking any other uses that attempt to resolve ${ZEPHYR_SDK_INSTALL_DIR} (which is used in several places. BRANCH=none BUG=none TEST=Install zephyr SDK and build volteer TEST=Added unit tests Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: I2cee8942c453dc332061df1a57b32cfc00c6c4d5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2991395 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
* zmake: Add ability to print compatible zephyr versionsYuval Peress2021-06-241-0/+37
| | | | | | | | | | | | | | | | | This simple subcommand in zmake prints the compatible Zephyr versions for the project. It will be used in the zephyr ebuild to set the correct zephyr-base and modules directories. BRANCH=none BUG=b:190731415, b:191892353 TEST=zmake print-versions zephyr/projects/volteer/volteer TEST=added unit tests Change-Id: If597035f71cca1e90c9402dbdb0e5e558e1e0892 Signed-off-by: Yuval Peress <peress@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2984298 Reviewed-by: Simon Glass <sjg@chromium.org> Commit-Queue: Simon Glass <sjg@chromium.org>
* zmake: block hypothesis health checks for CQYuval Peress2021-06-221-0/+8
| | | | | | | | | | | | | | | | | | Allow passing a --cq flag to zmake for running a CQ pass. When done, zmake will remove flaky features such as hypothesis health checks which cause pytests to fail when taking longer than "expected". Note that the health checks ignore the deadline set on each function and will still fail if they deem the test to have run too long. BRANCH=none BUG=b:190229270, b:190957007 TEST=sudo emerge chromeos-base/zephyr-build-tools && \ zmake --cq testall Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: Iaf9a38e0bbd65f0be9521019a615279d8b5fbb49 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2977586 Reviewed-by: Simon Glass <sjg@chromium.org>
* zmake: test final file output sizeYuval Peress2021-06-101-0/+51
| | | | | | | | | | | | | | | | | | | | | | Zephyr's build allows the image to consume the full flash size (CONFIG_FLASH_SIZE) since it doesn't assume anything about how chromium lays out the images (using RO/RW). This means that in systems with 512Kb of flash space, images taking up more than 256Kb will successfully build (even though the final image will be larger than 512Kb). Add a check in the output packers for the final size. This test ignores by default the .elf extension. BRANCH=none BUG=b:190435084 TEST=Added unit tests TEST=build brya Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: I94f1657d0ff44d79920ae5e8e7f11edf1580de05 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2948169 Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* zmake: Add utility for getting value from autoconf.hYuval Peress2021-06-091-0/+10
| | | | | | | | | | | | | | | | | | | Kconfig generates an autoconf.h header from the various Kconfig files. These values (such as CONFIG_FLASH_SIZE) may not be obvious to find. This is especially true since some Kconfig values are passed in from zmake while others reside in Kconfig files. Add a utility to get the #define value from the autoconf.h that's generated during the build. BRANCH=none BUG=b:190435084 TEST=Added unit tests Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: Id2c1f05a809e17f67a435209e35606ffd7245174 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2948168 Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* zmake: fix test timeoutYuval Peress2021-06-091-1/+3
| | | | | | | | | | | | | | | In CQ some tests that require file access may take a long time. Update the deadline for the tests to 1 minute which matches the deadline of tests in test_util.py. BRANCH=none BUG=b:188492664 TEST=run pytest (but the real test will be in CQ) Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: I00b15667bf4bdbbfe8101b21a58aefdce6d4ec91 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2948164 Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* Reland "zephyr: zmake: Show devicetree / compiler errors"Simon Glass2021-05-262-9/+375
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit a984234afc7763018f9b5f9e767e567fd1137e4c. Reason for revert: Seeing if this can be landed now Original change's description: > Revert "zephyr: zmake: Show devicetree / compiler errors" > > 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> BUG=b:184298184, chromium:1198472 BRANCH=none TEST=(cd zephyr/zmake/; python3 -m pytest tests/*.py -v -k test_filter) Change-Id: I9065a5682090b5e32414bbb6a518788ec02a6f0c Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2841024 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* zmake: Allow filter tests to be run without pytestSimon Glass2021-05-261-46/+54
| | | | | | | | | | | | | | | | | | | | Put these tests in a class and add a main program so we can run the tests directly. This makes it easier to see any output produced by the test, for debugging purposes. For example a print() added to a test will not be suppressed. This makes debugging easier. BUG=b:184298184 BRANCH=none TEST=(cd zephyr/zmake/; PYTHONPATH=`pwd` python3 tests/test_zmake.py TestFunctional.test_filter ) Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: Ic5384d8926e54322a4bf828dd6ee91b1ab4507ff Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2911474 Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Commit-Queue: 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: Prefix logs with the name of the projectJeremy Bettis2021-05-031-25/+23
| | | | | | | | | | | | | | | | 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: Change 2nd underscore for a hyphen in version formatJack Rosenthal2021-04-301-2/+2
| | | | | | | | | | | | | | | 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: add utility to compute version stringJack Rosenthal2021-04-291-0/+88
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Revert "Reland "zephyr: zmake: Add a test for zmake and output filtering""Jack Rosenthal2021-04-203-744/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-203-0/+744
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: remove fail_fast functionalityJack Rosenthal2021-04-131-31/+5
| | | | | | | | | | | | | | | | | | 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-133-744/+0
| | | | | | | | | | | | | | | 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-131-9/+0
| | | | | | | | | | | | | | | | 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-132-334/+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-132-2/+334
| | | | | | | | | | | | | | | 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-131-0/+9
| | | | | | | | | | | | | | | | | | 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-133-0/+744
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Add find_projects() to zmake.project.Jeremy Bettis2021-03-311-0/+38
| | | | | | | | | | | | | | | | 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: drop support for zephyr v2.4Jack Rosenthal2021-02-231-1/+1
| | | | | | | | | | | | | | | | | | | 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-231-0/+44
| | | | | | | | | | | | | | | | | | | | | 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-231-0/+38
| | | | | | | | | | | | | | | | | | | 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: remove . and .. from file names in BuildConfig testJack Rosenthal2021-02-101-1/+1
| | | | | | | | | | | | | | | | . and .. are special names for the current and parent directories, respectively. Thus, we should not use these names when formulating filenames for testing. BUG=chromium:1176487 BRANCH=none TEST=zmake testall Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I2f16cb960878aa8a61f77ca1d074e0bac59bca3d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2685403 Commit-Queue: Simon Glass <sjg@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
* zepyhr: zmake: add a function to read zephyr version from $ZEPHYR_BASEJack Rosenthal2021-02-101-0/+16
| | | | | | | | | | | | | | This will be used to read the version from a non-CrOS checked-out zephyr base. BUG=b:179813084 BRANCH=none TEST=provided unit tests Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: Id6c3bdebbc5273df767f23115f00f2dac794e3a7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2685474 Reviewed-by: Simon Glass <sjg@chromium.org>
* zephyr: zmake: disable deadlines for test_find_dts_overlaysJack Rosenthal2021-02-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | The timing in the CQ seems rather inconsistent for this test. Hypothesis complains about this: > Unreliable test timings! On an initial run, this test took > 1456.42ms, which exceeded the deadline of 1000.00ms, but on a > subsequent run it took 183.34 ms, which did not. If you expect this > sort of variability in your test timings, consider turning deadlines > off for this test by setting deadline=None. So, I'm setting deadline=None to see if it helps. BUG=chromium:1175647 BRANCH=none TEST=CQ de-flakes? Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I09bffa6d00ea6b5457c28d8eb9003e7bf077e9b3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2682838 Reviewed-by: Yuval Peress <peress@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
* zephyr: zmake: add board-specific DTS overlaysJack Rosenthal2021-02-061-0/+82
| | | | | | | | | | | | | | | Allow board-specific DTS overlays to be placed at zephyr/dts/board-overlays/${BOARD}.dts in any module. Zmake will find the file and append it to the DTC_OVERLAY_FILE list when discovered. BUG=b:179491802 BRANCH=none TEST=provided unit test passes Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I53d4a04b6056689696b4615b5998937dbcf801c4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2678795 Reviewed-by: Simon Glass <sjg@chromium.org>
* zephyr: zmake: Fix zmake default build directory resolutionYuval Peress2021-02-051-13/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | The previous changes to the zmake build system made the incorrect assumption that the build directory exists already as such, running `zmake configure -B $build_dir` with a new non-initialized director would fail since the resolve_build_dir function would fail to recognize it as a valid build directory. The new logic also allows for passing directories which do not yet exist. BRANCH=none BUG=none TEST=pytest zephyr/zmake/tests/test_util.py TEST=zmake configure -B /tmp/z/pos \ zephyr/projects/posix-ec/ \ && zmake -l DEBUG build /tmp/z/pos Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: I754d4545f8d98cc65270b8d50f327cbb04ce3c87 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2678927 Tested-by: Simon Glass <sjg@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
* zmake: allow zmake build/test to target project directoriesYuval Peress2021-02-041-29/+46
| | | | | | | | | | | | | | | | | | | | | | Allows zmake to use the default platform/ec/build directory when running the build/test subcommand. Developers can now simply point to the actual projects without having to worry about where the build is being done. BRANCH=none BUG=none TEST=Added/modified unit tests TEST=zmake configure zephyr/test/system && \ zmake build zephyr/test/system && \ zmake test zephyr/test/system && \ echo SUCCESS TEST=rm -fr build/zephyr/test/system ; \ zmake build zephyr/test/system || echo SUCCESS Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: Id830f8dffc30f641fff0cd5ff50d30b2efedeece Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2665072 Reviewed-by: Simon Glass <sjg@chromium.org>
* zmake: enable default build directory for configure subcommandYuval Peress2021-02-041-0/+51
| | | | | | | | | | | | | | | | | Allow zmake to create a default build directory when running zmake configure. This provides a similar behavior to platform/ec's make system. Projects will be placed under platform/ec/build/zephyr/... BRANCH=none BUG=none TEST=Added unit test TEST=zmake configure -b zephyr/projects/volteer Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: Icabed1b77cf5876a75898322d39806237e05d520 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2665071 Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: zmake: add a test for BuildConfig objectsJack Rosenthal2021-01-291-0/+184
| | | | | | | | | | | | | | | Implement test coverage for BuildConfigs, including merging using `|` operator, and running `popen_cmake`. BUG=b:178642582 BRANCH=none TEST=pytest Cq-Depend: chromium:2654350 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I07d8e913af999dac4f66f904b9d53e974e57eb40 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2656515 Reviewed-by: Simon Glass <sjg@chromium.org>