Граф коммитов

198 Коммитов

Автор SHA1 Сообщение Дата
Edwin Takahashi 8eb4f8e716 Bug 1581224 - convert mach uuid to be compatible with both python2/3 r=Callek
Changes:
- remove `uuid` from the python3 blacklist in `mach`
- enable `test_telemetry.py` for python3
- adjust test outcome expectation for Windows + python3, suspect `mozpack.path` is not filtering Windows path correctly in python3 environment
- switch file read mode between `r` and `rb` depending on version of python

Differential Revision: https://phabricator.services.mozilla.com/D45903

--HG--
extra : moz-landing-system : lando
2019-10-21 16:33:00 +00:00
Anmol Agarwal d2dbcf8eba Bug 1433941 - Passed remainder arguments as it is |mach python-test| r=ahal
Differential Revision: https://phabricator.services.mozilla.com/D47832

--HG--
extra : moz-landing-system : lando
2019-10-04 18:32:37 +00:00
Andrew Halberstadt d25a545d74 Bug 1585146 - [mach] Bump to 1.0.0 and add Python classifiers, r=firefox-build-system-reviewers,mshal
Depends on D47668

Differential Revision: https://phabricator.services.mozilla.com/D47669

--HG--
extra : moz-landing-system : lando
2019-10-01 18:32:07 +00:00
Andrew Halberstadt 07d6b341a6 Bug 1585146 - [mach] Move '--disable-tests' check to a pre_dispatch_handler, r=firefox-build-system-reviewers,mshal
This logic is very 'mozill-central' specific and should live outside of mach
core if possible. Luckily we already have a concept of a 'pre_dispatch_handler'
that is meant for exactly this type of use case.

Differential Revision: https://phabricator.services.mozilla.com/D47668

--HG--
extra : moz-landing-system : lando
2019-10-01 22:31:23 +00:00
Andrew Halberstadt 9935b8c10c Bug 1584567 - [mach] Remove support for conditional_names, r=nalexander
Depends on D47626

Differential Revision: https://phabricator.services.mozilla.com/D47627

--HG--
extra : moz-landing-system : lando
2019-10-01 12:40:28 +00:00
Andrew Halberstadt 3b6e9c57e2 Bug 1567642 - [mach] Fix flake8 under Python 3 lint issues r=firefox-build-system-reviewers,chmanchester
Differential Revision: https://phabricator.services.mozilla.com/D45412

--HG--
extra : moz-landing-system : lando
2019-09-17 18:52:28 +00:00
championshuttler a19f899a6f Bug 1580492 - Run mach 'core' commands with Python 3. r=ahal
Differential Revision: https://phabricator.services.mozilla.com/D45694

--HG--
extra : moz-landing-system : lando
2019-09-12 20:26:45 +00:00
Andrew Halberstadt 8c97bc7a17 Bug 1577908 - [mach] Disable suggested command execution until Python 3 migration is finished, r=glandium
The mach driver will now run all misspelled commands with Python 3. That means
we can't automatically execute the suggested command anymore, as it may need to
run against Python 2.

Ideally we could figure out a way to check the command against the 'mach'
whitelist, but until then, let's just disable automatic execution. Worst case
scenario we can turn it back on after the migration has finished.

Differential Revision: https://phabricator.services.mozilla.com/D44282

--HG--
extra : moz-landing-system : lando
2019-09-03 03:46:16 +00:00
Andrew Halberstadt 23aca97aa6 Bug 1577501 - [mach] Make sure ./mach help <command> uses the correct Python, r=glandium
Some commands use external argument parsers, so invoking |mach help <command>| will import
external modules (which may only be Python 2 compatible).

This makes sure that we detect the actual subcommand we're generating help for
and use the proper Python.

A much simpler solution would have been to run |mach help| with Python 2 all
the time. However, as we convert things to Python 3 this would have meant that
Python 3 only code would blow up. This would have forced us to continue
supporting Python 2, even for Python 3-only commands.

Differential Revision: https://phabricator.services.mozilla.com/D43989

--HG--
extra : moz-landing-system : lando
2019-09-03 00:39:22 +00:00
Andrew Halberstadt 333ffc4bcf Bug 1473498 - [mach] Support running mach commands with python 3 r=glandium,mars
Credit: mars for making the shell POSIX compliant

This embeds a blacklist of every mach command that needs to run with Python 2
directly in the mach driver itself. Initially this is every mach command. We
then use a bit of shell to determine whether the command being run needs Python
2 or 3.

While this approach may seem a bit hacky, it has several benefits:

1. No need to add complex machinery in mach's registration code.
2. No need to spawn two separate Python interpreters in the event a different
   Python from the original interpreter is needed.
3. Perf impact is negligible.
4. New commands are Python 3 by default.

It is also only a temporary hack. Once all commands are running with Python 3,
we can revert back to the original mach driver.

Differential Revision: https://phabricator.services.mozilla.com/D36103

--HG--
extra : moz-landing-system : lando
2019-08-27 03:08:08 +00:00
Andrew Halberstadt d3ccaac56c Bug 1473498 - Fix Python 3 environment variables with subprocess r=glandium
On Windows in Python 2, the subprocess module requires the use of bytes with
the 'env' argument. For that reason, we would sometimes use byte strings with
'os.environ' like so:

    os.environ[b"FOO"] = b"bar"

However, this is a failure with Python 3 as 'os.environ' must only be used with
the text type. This patch creates a new 'setenv' helper that ensures we create
new environment with 'bytes' on Python 2, and 'text' on Python 3.

Differential Revision: https://phabricator.services.mozilla.com/D38237

--HG--
extra : moz-landing-system : lando
2019-07-30 21:35:53 +00:00
Edwin Gao a1cc4534a7 Bug 1519369 - support 'debugger' parser argument for mach test command r=ahal,gbrown
Differential Revision: https://phabricator.services.mozilla.com/D39229

--HG--
extra : moz-landing-system : lando
2019-07-26 15:18:18 +00:00
Andrew Halberstadt 4e06e1101d Bug 1473498 - [mach] Fix Python 3 decorator compatibility r=firefox-build-system-reviewers,chmanchester
Differential Revision: https://phabricator.services.mozilla.com/D36104

--HG--
extra : moz-landing-system : lando
2019-07-16 20:42:34 +00:00
Justin Wood 4b233fe605 Bug 1559975 - Make python/mach lint with 'py2' and 'py3' r=catlee
Depends on D36096

Differential Revision: https://phabricator.services.mozilla.com/D36099

--HG--
extra : moz-landing-system : lando
2019-07-05 14:24:58 +00:00
Andrew Halberstadt 1a58163ed7 Bug 1473498 - [mach] Enable test_logger with Python 3 r=firefox-build-system-reviewers,chmanchester
Depends on D36101

Differential Revision: https://phabricator.services.mozilla.com/D36102

--HG--
extra : moz-landing-system : lando
2019-07-02 20:59:46 +00:00
Andrew Halberstadt 3f6339271d Bug 1473498 - [mach] Enable test_config with Python 3 r=firefox-build-system-reviewers,chmanchester
Depends on D36100

Differential Revision: https://phabricator.services.mozilla.com/D36101

--HG--
extra : moz-landing-system : lando
2019-07-02 20:59:03 +00:00
Andrew Halberstadt 975f664521 Bug 1473498 - [mach] Enable test_entry_points with Python 3 r=firefox-build-system-reviewers,chmanchester
Differential Revision: https://phabricator.services.mozilla.com/D36100

--HG--
extra : moz-landing-system : lando
2019-07-02 20:58:14 +00:00
Andrew Halberstadt 3824b084b6 Bug 1473498 - [mach] Enable test_dispatcher with python 3 r=firefox-build-system-reviewers,chmanchester
This test is working with minimal effort. Let's get it running to prevent
future regressions.

Differential Revision: https://phabricator.services.mozilla.com/D36098

--HG--
extra : moz-landing-system : lando
2019-07-02 21:27:35 +00:00
Andrew Halberstadt 6f363de429 Bug 1473498 - [mach] Pull tests out of make check r=firefox-build-system-reviewers,mshal
Differential Revision: https://phabricator.services.mozilla.com/D36097

--HG--
extra : moz-landing-system : lando
2019-07-02 20:40:39 +00:00
Nick Alexander aaeaaec3dc Bug 1521996 - Part 1: Add `conditional_name` to mach @Command definition. r=ahal
We want `mach run` for Android to be wildly different than `mach run`
for Desktop.  But right now, mach really doesn't support two different
implementations of the same underlying named command.  The avenues
that might support different implementations, mostly run through
`conditions`.

`conditions` were added to mach commands in Bug 901972, and never
really anticipated this use case: commands are keyed by name condition
evaluation is delayed until dispatch-time.  In order to have different
commands with the same name, and have full support for `--help`,
command matching, suggestions, etc, we really need conditions to
evaluate at parse-time.  Indeed, since Bug 901972 landed, we've moved
context creation earlier in the dispatch flow and hacked in things
that look like parse-time conditions (see Bug 1291335 and Bug
1305695).

This approach is not the prettiest, but it handles this narrow
use-case -- making `mach run` and `mach install` different on Android
-- without much code churn.

Differential Revision: https://phabricator.services.mozilla.com/D18290

--HG--
extra : moz-landing-system : lando
2019-05-17 21:39:31 +00:00
Manish Goregaokar 409a85d649 Bug 1549636: use uuid4() in mach; r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D30147

--HG--
extra : moz-landing-system : lando
2019-05-07 02:34:53 +00:00
Bobby Holley cb0e71a251 Bug 1543246 - Suggest |./mach busted| when something breaks. r=froydnj
Depends on D26818

Differential Revision: https://phabricator.services.mozilla.com/D26930

--HG--
extra : moz-landing-system : lando
2019-04-10 16:40:14 +00:00
Chris Manchester 5c005e476e Bug 1526072 - Record cpu utilization and clobber/full builds in build telemetry. r=nalexander
Differential Revision: https://phabricator.services.mozilla.com/D22630

--HG--
extra : moz-landing-system : lando
2019-03-27 22:42:48 +00:00
Noemi Erli 6269026d4e Backed out 4 changesets (bug 1526072) for causing build bustages in test_clobber.py CLOSED TREE
Backed out changeset d3d56eca307f (bug 1526072)
Backed out changeset 37942b0f911b (bug 1526072)
Backed out changeset a0eb0f43c928 (bug 1526072)
Backed out changeset c1d1576431d7 (bug 1526072)
2019-03-27 22:51:22 +02:00
Chris Manchester 68be120a7f Bug 1526072 - Record cpu utilization and clobber/full builds in build telemetry. r=nalexander
Differential Revision: https://phabricator.services.mozilla.com/D22630

--HG--
extra : moz-landing-system : lando
2019-03-18 20:36:54 +00:00
Andrew Halberstadt 68820fd64b Bug 1513951 - [mach] Fix error handling bug in config.py r=gbrown
Differential Revision: https://phabricator.services.mozilla.com/D21430

--HG--
extra : moz-landing-system : lando
2019-02-28 18:03:47 +00:00
Andrew Halberstadt 80bdd47243 Bug 1518572 - [mach] Stuff the 'handler' instance into the context when applicable r=firefox-build-system-reviewers,mshal
For mach commands that have 'pass_context=True', we should implicitly add the
handler instance to the context. This will give mach command implementations an
easy way to access things like the command/subcommand names, the parser, argv
list, etc.

Differential Revision: https://phabricator.services.mozilla.com/D20521

--HG--
extra : moz-landing-system : lando
2019-02-25 16:19:05 +00:00
Andrew Halberstadt 24b0aff27c Bug 1520006 - [mach] Fix bug in 'mach completion', r=nalexander
This fixes an issue from bug 1518586.

It stemmed from the fact that I misunderstood how the 'parser' attribute
was being used in mach commands and didn't do enough testing. This patch
fixes things such that we check that 'parser' is not None, as well as
add the completion targets from 'handler.arguments'.

Differential Revision: https://phabricator.services.mozilla.com/D16501

--HG--
extra : moz-landing-system : lando
2019-01-14 21:20:55 +00:00
Andrew Halberstadt 292cda01c7 Bug 1519968 - [mach] Minor improvements to autocomplete docs, r=jmaher
Differential Revision: https://phabricator.services.mozilla.com/D16495

--HG--
extra : moz-landing-system : lando
2019-01-14 19:43:53 +00:00
Andrew Halberstadt 8905ad4bab Bug 1518586 - [mach] Implement bash completion for subcommands and arguments r=nalexander
Since we're calling into a mach command for the current completion
implementation anyway (and incurring python startup penalties), we
might as well move all the bash logic into the mach command.

The new 'mach-completion' command was created in case there are
scripts relying on the current behaviour of 'mach-commands'.

Depends on D16254

Differential Revision: https://phabricator.services.mozilla.com/D16255

--HG--
extra : moz-landing-system : lando
2019-01-11 15:28:49 +00:00
Andrew Halberstadt 1d78259cdb Bug 1518586 - [mach] Add some basic usage docs r=nalexander
I was looking for a good place to put documentation for enabling the
bash completion script when I realized that the 'mach' documentation
is targeted at tool developers rather than users.

Seeing as this is the main 'mach' documentation and we want to make
'firefox-source-docs' the place to go for contribution information,
we should endeavour to target end users with this documentation.

This adds a very basic usage page which should be expanded upon, but
is better than nothing.

I changed the headers in 'index.rst' to use raw:: html so that they
don't show up in the nav bar to the left (and subsequently block the
*actually important* things from appearing).

Differential Revision: https://phabricator.services.mozilla.com/D16254

--HG--
extra : moz-landing-system : lando
2019-01-11 03:34:30 +00:00
Ted Mielczarek 70af650a9f bug 1517909 - format build telemetry time correctly when seconds has no fractional component. r=nalexander
It turns out that Python's `datetime.isoformat` method will leave off the
fractional component of seconds if it would be all zeroes, but the voluptuous
`Datetime` validator wants it to be present, so it's possible to hit an error
if you run mach at exactly an integer second.

This patch switches from `isoformat` to `strftime` with an explicit format
string instead.

Differential Revision: https://phabricator.services.mozilla.com/D15981

--HG--
extra : moz-landing-system : lando
2019-01-08 21:29:26 +00:00
Ted Mielczarek fc2a640d8f bug 1517712 - log mach output when test_telemetry.py fails. r=sheehan
Differential Revision: https://phabricator.services.mozilla.com/D15716

--HG--
extra : moz-landing-system : lando
2019-01-08 15:14:51 +00:00
Ted Mielczarek 7f6bbcf435 bug 1517811 - use mozdebug in mach to validate debugger arguments. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D15847

--HG--
extra : moz-landing-system : lando
2019-01-08 16:10:36 +00:00
Ted Mielczarek 5def08dbfb bug 1517244 - Try to log more info during intermittent test_telemetry failure. r=sheehan
Differential Revision: https://phabricator.services.mozilla.com/D15578

--HG--
extra : moz-landing-system : lando
2019-01-02 16:56:12 +00:00
Connor Sheehan 1e603661c4 Bug 1506759: remove `try-except` block which swallows `OSError` r=ted
We have a few bugs filed as intermittent failures all relating
to an `AssertionError` on the return value of this block, which
seems to have a relevant value when `OSError` is thrown. Removing
this will not fix the problem but will at least let us see the
true cause of the failure for debugging and stabilization.

Differential Revision: https://phabricator.services.mozilla.com/D11884

--HG--
extra : moz-landing-system : lando
2018-11-14 16:33:22 +00:00
Ted Mielczarek 54b3bbd1ce bug 1505205 - don't write telemetry for recursive mach command invocations. r=firefox-build-system-reviewers,chmanchester
This change tries to ensure that we don't write telemetry data for mach
commands invoked recursively as part of other mach commands. The intent of
build system telemetry is to only collect data about commands that users are
invoking directly.

There are two ways that we found mach commands can be recursively invoked:
* By running a python subprocess to recursively invoke mach (used in
  `mach bootstrap` to call `mach artifact toolchain`)
* By using `Registrar.dispatch` to delegate to a sub-command (used by many
  build system commands to invoke `mach build`).

The subprocess case is handled here by having mach set a `MACH_MAIN_PID`
environment variable whose value is the current process' pid on startup if it
does not already exist in the environment. Telemetry code then checks that the
value of that variable matches the current pid and skips writing telemetry data
if not.

The dispatch case is handled by making `MachRegistrar` store the current depth
of the command stack and pass it to the `post_dispatch_handler` which will skip
writing telemetry data if depth != 1.

Additionally the `should_skip_dispatch` function in mach_bootstrap is renamed
to `should_skip_telemetry_submission`, which was its original intent. The
combination of checks added in this change should be sufficient for deciding
when to write telemetry data, and we were not collecting telemetry for the set
of mach commands in that function (which included `mach bootstrap`).

In order to facilitate writing a test for the dispatch case this change adds a
`mach python --exec-file` option to execute Python code directly in the context
of the `mach python` command.

Differential Revision: https://phabricator.services.mozilla.com/D11207

--HG--
extra : moz-landing-system : lando
2018-11-10 19:04:30 +00:00
Ted Mielczarek e85df1cdc8 bug 1505325 - fix build telemetry path filtering when cwd is outside of topsrcdir/objdir. r=firefox-build-system-reviewers,chmanchester
The build telemetry code attempts to filter paths to avoid PII from usernames
and other things. It does this by converting every commandline argument to
an absolute path and then making them relative to topsrcdir or topobjdir and
omitting any that fail. This meant that running a mach command with a cwd
outside of the topsrcdir or objdir would omit all arguments since they were
converted to absolute paths from the cwd.

This change fixes this by adding the cwd to the list of paths used to create
relative paths. Additionally we add the user's home directory to that list
to try to avoid usernames sneaking through. Finally, instead of simply
removing these path prefixes, we replace them with sigils: $topsrcdir,
$objdir, $HOME.

Differential Revision: https://phabricator.services.mozilla.com/D11174

--HG--
extra : moz-landing-system : lando
2018-11-10 19:14:44 +00:00
Ted Mielczarek 8e018fdef0 bug 1505325 - add a basic test for build telemetry. r=firefox-build-system-reviewers,chmanchester
This change adds python/mach/mach/test/test_telemetry.py which contains
a simple test that running mach with the build telemetry setting enabled
causes us to write a telemetry file. The test fixture in the file should
make it easy to write additional tests.

A necessary precursor to make the tests work was to change mach_bootstrap's
`should_skip_dispatch` function, which would refuse to write telemetry data
if stdout was not a terminal (which it isn't in the tests) and also in
automation. The latter test is moved to ensure that we don't *submit*
telemetry data from automation, but we can still write it to disk. Machines
in automation should never have the telemetry setting enabled outside of
these tests anyway, so this should not change anything in practice.

Differential Revision: https://phabricator.services.mozilla.com/D11172

--HG--
extra : moz-landing-system : lando
2018-11-10 19:04:05 +00:00
Edwin Gao 9ffeff17f0 Bug 1504550 - error running ./mach wpt --debugger rr --headless --no-manifest-update r=gbrown
Changes:
- under a specific code path such as:
`./mach <test_type> --debugger`
there exists now additional checks for IndexError when attempting to parse the debugger program name.
- print a nicer error message if user failed to properly specify the debugger program name.
- raise exit code of 1 if IndexError is raised.

Others:
- code comments updated to better reflect/describe what the section does.

Differential Revision: https://phabricator.services.mozilla.com/D10987

--HG--
extra : moz-landing-system : lando
2018-11-07 12:47:34 +00:00
Chris Manchester 9b3b733a84 Bug 1497638 - Gather telemetry for mach commands other than build. r=ted,firefox-build-system-reviewers,nalexander
Differential Revision: https://phabricator.services.mozilla.com/D10177

--HG--
extra : moz-landing-system : lando
2018-10-31 20:03:56 +00:00
Edwin Gao 4c107f8236 Bug 1291335 - Check mozconfig for --disable-tests when running mach test commands r=gbrown
Behavior changes:

- instead of reading the mozconfig file, it now instantiates an instance of the build object.
- safe checking methods are used to access attributes to prevent errors on automation environment.
- better mach command parsing is performed with handler category instead of error-prone argv parsing.


Other changes:

- docstring for testing/xpcshell/runxpcshelltests.py::buildTestList() added and modernized.
- added clause that if length of tests gathered is 0, mach exits with an error code of 1.

Differential Revision: https://phabricator.services.mozilla.com/D7133

--HG--
extra : moz-landing-system : lando
2018-10-03 15:40:48 +00:00
Jay Kamat 245ac54f65 Bug 1493345 Fix improper usage of blessings.tigetstr r=ted,firefox-build-system-reviewers
blessings.tigetstr is not part of its API. It happens to work because
blessings imports curses using 'from curses import tigetstr'.

Instead, we can just use terminal.normal, which contains the string we were
going to get anyway.

See https://github.com/erikrose/blessings/pull/138 for more information.

Let me know if there's a better way of resolving this. Hopefully with this +
the patch I submitted to blessings (https://github.com/erikrose/blessings/pull/137)
firefox will build fine with TERM improperly set.

Differential Revision: https://phabricator.services.mozilla.com/D5377

--HG--
extra : moz-landing-system : lando
2018-10-02 18:36:30 +00:00
Edwin Gao d7986ad99a Bug 1305695 - ./mach test --debugger=<debugger> doesn't fail if <debugger> isn't available r=gbrown
- added checkers in python/mach/mach/main.py prior to calling registrar.py.
- added internal function to check if specified debugger is installed.
- support both ./mach test <test_name> and ./mach <test_category> styles.

Differential Revision: https://phabricator.services.mozilla.com/D7234

--HG--
extra : moz-landing-system : lando
2018-10-01 22:06:54 +00:00
shindli 6ba91671cb Backed out changeset 05df95ba3a98 (bug 1305695) for ES lint failures CLOSED TREE 2018-10-02 00:00:23 +03:00
Edwin Gao 63180f5b60 Bug 1305695 - ./mach test --debugger=<debugger> doesn't fail if <debugger> isn't available r=gbrown
- added checkers in python/mach/mach/main.py prior to calling registrar.py.
- added internal function to check if specified debugger is installed.
- support both ./mach test <test_name> and ./mach <test_category> styles.

Differential Revision: https://phabricator.services.mozilla.com/D7234

--HG--
extra : moz-landing-system : lando
2018-10-01 18:03:06 +00:00
Ted Mielczarek 3028fb8bdb bug 1237610 - don't call post_dispatch_handler when using debug-command. r=gps
MozReview-Commit-ID: 4UG6RH4b6tZ

Differential Revision: https://phabricator.services.mozilla.com/D4596

--HG--
extra : rebase_source : a06ef350840b059b2ef9eaea8010085e41d5dd50
2018-05-16 12:56:39 -04:00
Chris Manchester 7edeeaa646 Bug 1475058 - Send SIGINT when interrupting interactive in mach before sending SIGKILL. r=mshal
MozReview-Commit-ID: 2XxLyNi1ZuS

--HG--
extra : rebase_source : d91eed728446219da6be78e310b1a12b597a0d99
2018-07-12 11:50:48 -07:00
Andrew Halberstadt 9435736ade Bug 1471620 - Skip python-tests locally that don't run with python 3 in CI r=davehunt
This will make sure that when running |mach python-test --python 3| locally,
we only run the tests that also run in CI with python 3 (and therefore pass
presumably).

MozReview-Commit-ID: 3OBr9yLSlSq

--HG--
extra : rebase_source : 456340d0ecdddf1078f2b5b4ebb1eddf3813b26a
2018-06-27 11:10:02 -04:00
Dave Hunt c65268bd7a Bug 1388013 - Support running |mach python-test| against Python 3 using pipenv; r=ahal
This patch allows executing |mach python-test| against Python 3 by specifying the optional |--three| command line option. When this option is present, pipenv will be used to manage a virtual environment using Python 3 and attempt to run the tests. When it is not present, pipenv will not be used, and everything will work as it did before this patch.

My original plan was to use pipenv regardless of the target version of Python, however I encountered several issues running some of the tests against our Python packages. Once all tests have been patched to run against Python 3, then we should be able to use pipenv when running them against Python 2.

Note that this patch allows tests to run against Python 3, but there are plenty of issues preventing them from passing. With this patch in place we can start to add Python 3 support to our packages and have the tests running in CI to ensure we don't regress back to just supporting Python 2.

MozReview-Commit-ID: BuU5gZK83hL


IHG: changed taskcluster/ci/source-test/python.yml

--HG--
extra : rebase_source : ca2b15d905f7a5c895a2fd8916144841f5d205de
2018-05-03 10:34:22 +01:00