commit | 50b827ef6423908165af5b4c95e173dc91214d57 | [log] [tgz] |
---|---|---|
author | Bruce Dawson <brucedawson@chromium.org> | Sun May 22 04:55:49 2022 |
committer | Copybara-Service <copybara-worker@google.com> | Sun May 22 05:12:00 2022 |
tree | dd355a31bca1f242e2b730d350e8f94a462bba5a | |
parent | 147bc70b0cc5d636d0f2f84e47efbb222b64995c [diff] |
Fix mb_unittest.py for Windows The tests in mb_unittest.py carefully mock the file system entirely, and then do Linux and Windows tests on both platforms. That's all great, but somehow when run on Windows we were getting various errors including this one: KeyError: '/fake_src/out/Default/C:\\src\\temp\\mb_test/task.json' That path does not look good. The root cause is that crrev.com/c/2378273 added a TempDir function and that function did this: tmp_dir = os.path.join(tempfile.gettempdir(), 'mb_test') That is, it used OS functions to get the temporary directory and to do path joining. When testing the Linux functionality on Windows the _AbsPath would look at 'C:\\src\\temp\\mb_test' and determine that it was not a relative directory so it would prepend the current working directory, and the world falls apart. The fix is to mock the temporary directory as well. It's anticlimactic really. The fact that these tests worked on Linux was just luck (good or bad, you decide). With this fixed the presubmits only have one minor Windows-specific failure remaining. Bug: 1309977 Change-Id: I4988b6d1b56e2da50196dfc3f339c4e12b80045c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3659032 Reviewed-by: Daniel Cheng <dcheng@chromium.org> Commit-Queue: Bruce Dawson <brucedawson@chromium.org> Cr-Commit-Position: refs/heads/main@{#1006200} NOKEYCHECK=True GitOrigin-RevId: 5d8d1585b8af955b4866b1f7c88a32a8959b5e9f
MB is a simple wrapper around the GN build tool.
It was originally written as part of the GYP->GN migration, in order to provide a uniform interface to either GYP or GN, such that users and bots can call one script and not need to worry about whether a given bot was meant to use GN or GYP.
It eventually grew additional functionality and is now still used even though everything is GN-only.
It supports two main functions:
“gen” - the main gn gen
invocation that generates the Ninja files needed for the build.
“analyze” - the step that takes a list of modified files and a list of desired targets and reports which targets will need to be rebuilt.
We also use MB as a forcing function to collect all of the different build configurations that we actually support for Chromium builds into one place, in //tools/mb/mb_config.pyl
.
For more information, see: