mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 22:32:46 +00:00
Bug 1928709 - Convert tryselect cram tests to python tests, r=jmaher
The cram tests are slow to run and difficult to maintain. There's also nothing they offer that we can't accomplish with pytest. Finally, the later commits in this stack are going to break the mechanism we were using to mock the expected results (it was relying on tryselects caching mechanism). Rather than attempting to fix this, just convert the tests to pytest. Differential Revision: https://phabricator.services.mozilla.com/D227704
This commit is contained in:
parent
1be9df47d2
commit
099b9cc785
@ -1,21 +0,0 @@
|
||||
---
|
||||
tryselect:
|
||||
description: tools/tryselect integration tests
|
||||
platform: linux1804-64/opt
|
||||
treeherder:
|
||||
symbol: cram(try)
|
||||
kind: test
|
||||
tier: 2
|
||||
worker-type: t-linux-xlarge-source
|
||||
worker:
|
||||
docker-image: {in-tree: "lint"}
|
||||
max-run-time: 1800
|
||||
run:
|
||||
using: mach
|
||||
mach: cramtest tools/tryselect
|
||||
always-target: true
|
||||
when:
|
||||
files-changed:
|
||||
- testing/mach_commands.py
|
||||
- third_party/python/cram/**
|
||||
- tools/tryselect/**
|
@ -25,7 +25,6 @@ tasks-from:
|
||||
- android-lint.yml
|
||||
- buildconfig.yml
|
||||
- clang.yml
|
||||
- cram.yml
|
||||
- doc.yml
|
||||
- file-metadata.yml
|
||||
- jsshell.yml
|
||||
|
@ -68,10 +68,6 @@ SPHINX_TREES["profiler"] = "profiler/docs"
|
||||
with Files("tryselect/docs/**"):
|
||||
SCHEDULES.exclusive = ["docs"]
|
||||
|
||||
CRAMTEST_MANIFESTS += [
|
||||
"tryselect/test/cram.toml",
|
||||
]
|
||||
|
||||
PYTHON_UNITTEST_MANIFESTS += [
|
||||
"fuzzing/smoke/python.toml",
|
||||
"lint/test/python.toml",
|
||||
|
@ -208,7 +208,12 @@ def try_default(command_context, argv=None, **kwargs):
|
||||
|
||||
sub = subcommand or command_context._mach_context.settings["try"]["default"]
|
||||
return command_context._mach_context.commands.dispatch(
|
||||
"try", command_context._mach_context, subcommand=sub, argv=argv, **kwargs
|
||||
"try",
|
||||
command_context._mach_context,
|
||||
command_site_manager=command_context.virtualenv_manager,
|
||||
subcommand=sub,
|
||||
argv=argv,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
|
||||
@ -441,7 +446,9 @@ def try_syntax(command_context, **kwargs):
|
||||
"""
|
||||
init(command_context)
|
||||
try:
|
||||
if command_context.substs.get("MOZ_ARTIFACT_BUILDS"):
|
||||
if "PYTEST_CURRENT_TEST" not in os.environ and command_context.substs.get(
|
||||
"MOZ_ARTIFACT_BUILDS"
|
||||
):
|
||||
kwargs["local_artifact_build"] = True
|
||||
except BuildEnvironmentNotFoundException:
|
||||
# If we don't have a build locally, we can't tell whether
|
||||
|
@ -63,6 +63,28 @@ def cache_key(attr, params, disable_target_task_filter):
|
||||
return key
|
||||
|
||||
|
||||
def add_chunk_patterns(tg):
|
||||
for task_name, task in tg.tasks.items():
|
||||
chunk_index = -1
|
||||
if task_name.endswith("-cf"):
|
||||
chunk_index = -2
|
||||
|
||||
chunks = task.task.get("extra", {}).get("chunks", {})
|
||||
if isinstance(chunks, int):
|
||||
task.chunk_pattern = "{}-*/{}".format(
|
||||
"-".join(task_name.split("-")[:chunk_index]), chunks
|
||||
)
|
||||
else:
|
||||
assert isinstance(chunks, dict)
|
||||
if chunks.get("total", 1) == 1:
|
||||
task.chunk_pattern = task_name
|
||||
else:
|
||||
task.chunk_pattern = "{}-*".format(
|
||||
"-".join(task_name.split("-")[:chunk_index])
|
||||
)
|
||||
return tg
|
||||
|
||||
|
||||
def generate_tasks(params=None, full=False, disable_target_task_filter=False):
|
||||
attr = "full_task_set" if full else "target_task_set"
|
||||
|
||||
@ -83,27 +105,6 @@ def generate_tasks(params=None, full=False, disable_target_task_filter=False):
|
||||
taskgraph.fast = True
|
||||
generator = TaskGraphGenerator(root_dir=root, parameters=params)
|
||||
|
||||
def add_chunk_patterns(tg):
|
||||
for task_name, task in tg.tasks.items():
|
||||
chunk_index = -1
|
||||
if task_name.endswith("-cf"):
|
||||
chunk_index = -2
|
||||
|
||||
chunks = task.task.get("extra", {}).get("chunks", {})
|
||||
if isinstance(chunks, int):
|
||||
task.chunk_pattern = "{}-*/{}".format(
|
||||
"-".join(task_name.split("-")[:chunk_index]), chunks
|
||||
)
|
||||
else:
|
||||
assert isinstance(chunks, dict)
|
||||
if chunks.get("total", 1) == 1:
|
||||
task.chunk_pattern = task_name
|
||||
else:
|
||||
task.chunk_pattern = "{}-*".format(
|
||||
"-".join(task_name.split("-")[:chunk_index])
|
||||
)
|
||||
return tg
|
||||
|
||||
cache_dir = os.path.join(
|
||||
get_state_dir(specific_to_topsrcdir=True), "cache", "taskgraph"
|
||||
)
|
||||
|
@ -5,6 +5,7 @@
|
||||
import os
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
import mach_initialize
|
||||
import pytest
|
||||
import yaml
|
||||
from moztest.resolve import TestResolver
|
||||
@ -12,7 +13,7 @@ from responses import RequestsMock
|
||||
from taskgraph.graph import Graph
|
||||
from taskgraph.task import Task
|
||||
from taskgraph.taskgraph import TaskGraph
|
||||
from tryselect import push
|
||||
from tryselect import push, tasks
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@ -60,10 +61,7 @@ def patch_vcs(monkeypatch):
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
def run_mach():
|
||||
import mach_initialize
|
||||
from tryselect.tasks import build
|
||||
|
||||
mach = mach_initialize.initialize(build.topsrcdir)
|
||||
mach = mach_initialize.initialize(tasks.build.topsrcdir)
|
||||
|
||||
def inner(args):
|
||||
return mach.run(args)
|
||||
|
@ -1,5 +0,0 @@
|
||||
["test_auto.t"]
|
||||
["test_empty.t"]
|
||||
["test_fuzzy.t"]
|
||||
["test_message.t"]
|
||||
["test_preset.t"]
|
@ -26,6 +26,8 @@ sequential = true
|
||||
|
||||
["test_scriptworker.py"]
|
||||
|
||||
["test_selectors.py"]
|
||||
|
||||
["test_task_configs.py"]
|
||||
|
||||
["test_tasks.py"]
|
||||
|
@ -1,73 +0,0 @@
|
||||
|
||||
$ . $TESTDIR/setup.sh
|
||||
$ cd $topsrcdir
|
||||
|
||||
Test auto selector
|
||||
|
||||
$ ./mach try auto $testargs
|
||||
Commit message:
|
||||
Tasks automatically selected.
|
||||
|
||||
mach try command: `./mach try auto --no-push --no-artifact`
|
||||
|
||||
Pushed via `mach try auto`
|
||||
Calculated try_task_config.json:
|
||||
{
|
||||
"parameters": {
|
||||
"filters": [
|
||||
"try_auto"
|
||||
],
|
||||
"optimize_strategies": "gecko_taskgraph.optimize:tryselect.bugbug_reduced_manifests_config_selection_medium",
|
||||
"optimize_target_tasks": true,
|
||||
"test_manifest_loader": "bugbug",
|
||||
"try_mode": "try_auto",
|
||||
"try_task_config": {}
|
||||
},
|
||||
"version": 2
|
||||
}
|
||||
|
||||
|
||||
$ ./mach try auto $testargs --closed-tree
|
||||
Commit message:
|
||||
Tasks automatically selected. ON A CLOSED TREE
|
||||
|
||||
mach try command: `./mach try auto --no-push --no-artifact --closed-tree`
|
||||
|
||||
Pushed via `mach try auto`
|
||||
Calculated try_task_config.json:
|
||||
{
|
||||
"parameters": {
|
||||
"filters": [
|
||||
"try_auto"
|
||||
],
|
||||
"optimize_strategies": "gecko_taskgraph.optimize:tryselect.bugbug_reduced_manifests_config_selection_medium",
|
||||
"optimize_target_tasks": true,
|
||||
"test_manifest_loader": "bugbug",
|
||||
"try_mode": "try_auto",
|
||||
"try_task_config": {}
|
||||
},
|
||||
"version": 2
|
||||
}
|
||||
|
||||
$ ./mach try auto $testargs --closed-tree -m "foo {msg} bar"
|
||||
Commit message:
|
||||
foo Tasks automatically selected. bar ON A CLOSED TREE
|
||||
|
||||
mach try command: `./mach try auto --no-push --no-artifact --closed-tree -m "foo {msg} bar"`
|
||||
|
||||
Pushed via `mach try auto`
|
||||
Calculated try_task_config.json:
|
||||
{
|
||||
"parameters": {
|
||||
"filters": [
|
||||
"try_auto"
|
||||
],
|
||||
"optimize_strategies": "gecko_taskgraph.optimize:tryselect.bugbug_reduced_manifests_config_selection_medium",
|
||||
"optimize_target_tasks": true,
|
||||
"test_manifest_loader": "bugbug",
|
||||
"try_mode": "try_auto",
|
||||
"try_task_config": {}
|
||||
},
|
||||
"version": 2
|
||||
}
|
||||
|
@ -1,68 +0,0 @@
|
||||
$ . $TESTDIR/setup.sh
|
||||
$ cd $topsrcdir
|
||||
|
||||
Test empty selector
|
||||
|
||||
$ ./mach try empty --no-push
|
||||
Commit message:
|
||||
No try selector specified, use "Add New Jobs" to select tasks.
|
||||
|
||||
mach try command: `./mach try empty --no-push`
|
||||
|
||||
Pushed via `mach try empty`
|
||||
Calculated try_task_config.json:
|
||||
{
|
||||
"parameters": {
|
||||
"optimize_target_tasks": false,
|
||||
"try_task_config": {
|
||||
"env": {
|
||||
"TRY_SELECTOR": "empty"
|
||||
},
|
||||
"tasks": []
|
||||
}
|
||||
},
|
||||
"version": 2
|
||||
}
|
||||
|
||||
$ ./mach try empty --no-push --closed-tree
|
||||
Commit message:
|
||||
No try selector specified, use "Add New Jobs" to select tasks. ON A CLOSED TREE
|
||||
|
||||
mach try command: `./mach try empty --no-push --closed-tree`
|
||||
|
||||
Pushed via `mach try empty`
|
||||
Calculated try_task_config.json:
|
||||
{
|
||||
"parameters": {
|
||||
"optimize_target_tasks": false,
|
||||
"try_task_config": {
|
||||
"env": {
|
||||
"TRY_SELECTOR": "empty"
|
||||
},
|
||||
"tasks": []
|
||||
}
|
||||
},
|
||||
"version": 2
|
||||
}
|
||||
|
||||
$ ./mach try empty --no-push --closed-tree -m "foo {msg} bar"
|
||||
Commit message:
|
||||
foo No try selector specified, use "Add New Jobs" to select tasks. bar ON A CLOSED TREE
|
||||
|
||||
mach try command: `./mach try empty --no-push --closed-tree -m "foo {msg} bar"`
|
||||
|
||||
Pushed via `mach try empty`
|
||||
Calculated try_task_config.json:
|
||||
{
|
||||
"parameters": {
|
||||
"optimize_target_tasks": false,
|
||||
"try_task_config": {
|
||||
"env": {
|
||||
"TRY_SELECTOR": "empty"
|
||||
},
|
||||
"tasks": []
|
||||
}
|
||||
},
|
||||
"version": 2
|
||||
}
|
||||
|
@ -1,272 +0,0 @@
|
||||
$ . $TESTDIR/setup.sh
|
||||
$ cd $topsrcdir
|
||||
|
||||
Test fuzzy selector
|
||||
|
||||
$ ./mach try fuzzy $testargs -q "'foo"
|
||||
Commit message:
|
||||
Fuzzy query='foo
|
||||
|
||||
mach try command: `./mach try fuzzy --no-push --no-artifact -q "'foo"`
|
||||
|
||||
Pushed via `mach try fuzzy`
|
||||
Calculated try_task_config.json:
|
||||
{
|
||||
"parameters": {
|
||||
"optimize_target_tasks": false,
|
||||
"try_task_config": {
|
||||
"env": {
|
||||
"TRY_SELECTOR": "fuzzy"
|
||||
},
|
||||
"tasks": [
|
||||
"test/foo-debug",
|
||||
"test/foo-opt"
|
||||
]
|
||||
}
|
||||
},
|
||||
"version": 2
|
||||
}
|
||||
|
||||
|
||||
|
||||
$ ./mach try fuzzy $testargs -q "'bar"
|
||||
no tasks selected
|
||||
$ ./mach try fuzzy $testargs --full -q "'bar"
|
||||
Commit message:
|
||||
Fuzzy query='bar
|
||||
|
||||
mach try command: `./mach try fuzzy --no-push --no-artifact --full -q "'bar"`
|
||||
|
||||
Pushed via `mach try fuzzy`
|
||||
Calculated try_task_config.json:
|
||||
{
|
||||
"parameters": {
|
||||
"optimize_target_tasks": false,
|
||||
"try_task_config": {
|
||||
"env": {
|
||||
"TRY_SELECTOR": "fuzzy"
|
||||
},
|
||||
"tasks": [
|
||||
"test/bar-debug",
|
||||
"test/bar-opt"
|
||||
]
|
||||
}
|
||||
},
|
||||
"version": 2
|
||||
}
|
||||
|
||||
|
||||
Test multiple selectors
|
||||
|
||||
$ ./mach try fuzzy $testargs --full -q "'foo" -q "'bar"
|
||||
Commit message:
|
||||
Fuzzy query='foo&query='bar
|
||||
|
||||
mach try command: `./mach try fuzzy --no-push --no-artifact --full -q "'foo" -q "'bar"`
|
||||
|
||||
Pushed via `mach try fuzzy`
|
||||
Calculated try_task_config.json:
|
||||
{
|
||||
"parameters": {
|
||||
"optimize_target_tasks": false,
|
||||
"try_task_config": {
|
||||
"env": {
|
||||
"TRY_SELECTOR": "fuzzy"
|
||||
},
|
||||
"tasks": [
|
||||
"test/bar-debug",
|
||||
"test/bar-opt",
|
||||
"test/foo-debug",
|
||||
"test/foo-opt"
|
||||
]
|
||||
}
|
||||
},
|
||||
"version": 2
|
||||
}
|
||||
|
||||
|
||||
Test query intersection
|
||||
|
||||
$ ./mach try fuzzy $testargs --and -q "'foo" -q "'opt"
|
||||
Commit message:
|
||||
Fuzzy query='foo&query='opt
|
||||
|
||||
mach try command: `./mach try fuzzy --no-push --no-artifact --and -q "'foo" -q "'opt"`
|
||||
|
||||
Pushed via `mach try fuzzy`
|
||||
Calculated try_task_config.json:
|
||||
{
|
||||
"parameters": {
|
||||
"optimize_target_tasks": false,
|
||||
"try_task_config": {
|
||||
"env": {
|
||||
"TRY_SELECTOR": "fuzzy"
|
||||
},
|
||||
"tasks": [
|
||||
"test/foo-opt"
|
||||
]
|
||||
}
|
||||
},
|
||||
"version": 2
|
||||
}
|
||||
|
||||
|
||||
Test intersection with preset containing multiple queries
|
||||
|
||||
$ ./mach try fuzzy --save foo -q "'test" -q "'opt"
|
||||
preset saved, run with: --preset=foo
|
||||
|
||||
$ ./mach try fuzzy $testargs --preset foo -xq "'test"
|
||||
Commit message:
|
||||
Fuzzy query='test&query='opt&query='test
|
||||
|
||||
mach try command: `./mach try fuzzy --no-push --no-artifact --preset foo -xq "'test"`
|
||||
|
||||
Pushed via `mach try fuzzy`
|
||||
Calculated try_task_config.json:
|
||||
{
|
||||
"parameters": {
|
||||
"optimize_target_tasks": false,
|
||||
"try_task_config": {
|
||||
"env": {
|
||||
"TRY_SELECTOR": "fuzzy"
|
||||
},
|
||||
"tasks": [
|
||||
"test/foo-debug",
|
||||
"test/foo-opt"
|
||||
]
|
||||
}
|
||||
},
|
||||
"version": 2
|
||||
}
|
||||
|
||||
$ ./mach try $testargs --preset foo -xq "'test"
|
||||
Commit message:
|
||||
Fuzzy query='test&query='opt&query='test
|
||||
|
||||
mach try command: `./mach try --no-push --no-artifact --preset foo -xq "'test"`
|
||||
|
||||
Pushed via `mach try fuzzy`
|
||||
Calculated try_task_config.json:
|
||||
{
|
||||
"parameters": {
|
||||
"optimize_target_tasks": false,
|
||||
"try_task_config": {
|
||||
"env": {
|
||||
"TRY_SELECTOR": "fuzzy"
|
||||
},
|
||||
"tasks": [
|
||||
"test/foo-debug",
|
||||
"test/foo-opt"
|
||||
]
|
||||
}
|
||||
},
|
||||
"version": 2
|
||||
}
|
||||
|
||||
|
||||
Test exact match
|
||||
|
||||
$ ./mach try fuzzy $testargs --full -q "testfoo | 'testbar"
|
||||
Commit message:
|
||||
Fuzzy query=testfoo | 'testbar
|
||||
|
||||
mach try command: `./mach try fuzzy --no-push --no-artifact --full -q "testfoo | 'testbar"`
|
||||
|
||||
Pushed via `mach try fuzzy`
|
||||
Calculated try_task_config.json:
|
||||
{
|
||||
"parameters": {
|
||||
"optimize_target_tasks": false,
|
||||
"try_task_config": {
|
||||
"env": {
|
||||
"TRY_SELECTOR": "fuzzy"
|
||||
},
|
||||
"tasks": [
|
||||
"test/foo-debug",
|
||||
"test/foo-opt"
|
||||
]
|
||||
}
|
||||
},
|
||||
"version": 2
|
||||
}
|
||||
|
||||
$ ./mach try fuzzy $testargs --full --exact -q "testfoo | 'testbar"
|
||||
Commit message:
|
||||
Fuzzy query=testfoo | 'testbar
|
||||
|
||||
mach try command: `./mach try fuzzy --no-push --no-artifact --full --exact -q "testfoo | 'testbar"`
|
||||
|
||||
Pushed via `mach try fuzzy`
|
||||
Calculated try_task_config.json:
|
||||
{
|
||||
"parameters": {
|
||||
"optimize_target_tasks": false,
|
||||
"try_task_config": {
|
||||
"env": {
|
||||
"TRY_SELECTOR": "fuzzy"
|
||||
},
|
||||
"tasks": [
|
||||
"test/bar-debug",
|
||||
"test/bar-opt"
|
||||
]
|
||||
}
|
||||
},
|
||||
"version": 2
|
||||
}
|
||||
|
||||
|
||||
Test task config
|
||||
|
||||
$ ./mach try fuzzy --no-push --artifact -q "'foo"
|
||||
Commit message:
|
||||
Fuzzy query='foo
|
||||
|
||||
mach try command: `./mach try fuzzy --no-push --artifact -q "'foo"`
|
||||
|
||||
Pushed via `mach try fuzzy`
|
||||
Calculated try_task_config.json:
|
||||
{
|
||||
"parameters": {
|
||||
"optimize_target_tasks": false,
|
||||
"try_task_config": {
|
||||
"disable-pgo": true,
|
||||
"env": {
|
||||
"TRY_SELECTOR": "fuzzy"
|
||||
},
|
||||
"tasks": [
|
||||
"test/foo-debug",
|
||||
"test/foo-opt"
|
||||
],
|
||||
"use-artifact-builds": true
|
||||
}
|
||||
},
|
||||
"version": 2
|
||||
}
|
||||
|
||||
$ ./mach try fuzzy $testargs --env FOO=1 --env BAR=baz -q "'foo"
|
||||
Commit message:
|
||||
Fuzzy query='foo
|
||||
|
||||
mach try command: `./mach try fuzzy --no-push --no-artifact --env FOO=1 --env BAR=baz -q "'foo"`
|
||||
|
||||
Pushed via `mach try fuzzy`
|
||||
Calculated try_task_config.json:
|
||||
{
|
||||
"parameters": {
|
||||
"optimize_target_tasks": false,
|
||||
"try_task_config": {
|
||||
"env": {
|
||||
"BAR": "baz",
|
||||
"FOO": "1",
|
||||
"TRY_SELECTOR": "fuzzy"
|
||||
},
|
||||
"tasks": [
|
||||
"test/foo-debug",
|
||||
"test/foo-opt"
|
||||
]
|
||||
}
|
||||
},
|
||||
"version": 2
|
||||
}
|
||||
|
@ -1,81 +0,0 @@
|
||||
$ . $TESTDIR/setup.sh
|
||||
$ cd $topsrcdir
|
||||
|
||||
Test custom commit messages with fuzzy selector
|
||||
|
||||
$ ./mach try fuzzy $testargs -q foo --message "Foobar"
|
||||
Commit message:
|
||||
Foobar
|
||||
|
||||
Fuzzy query=foo
|
||||
|
||||
mach try command: `./mach try fuzzy --no-push --no-artifact -q foo --message Foobar`
|
||||
|
||||
Pushed via `mach try fuzzy`
|
||||
Calculated try_task_config.json:
|
||||
{
|
||||
"parameters": {
|
||||
"optimize_target_tasks": false,
|
||||
"try_task_config": {
|
||||
"env": {
|
||||
"TRY_SELECTOR": "fuzzy"
|
||||
},
|
||||
"tasks": [
|
||||
"test/foo-debug",
|
||||
"test/foo-opt"
|
||||
]
|
||||
}
|
||||
},
|
||||
"version": 2
|
||||
}
|
||||
|
||||
$ ./mach try fuzzy $testargs -q foo -m "Foobar: {msg}"
|
||||
Commit message:
|
||||
Foobar: Fuzzy query=foo
|
||||
|
||||
mach try command: `./mach try fuzzy --no-push --no-artifact -q foo -m "Foobar: {msg}"`
|
||||
|
||||
Pushed via `mach try fuzzy`
|
||||
Calculated try_task_config.json:
|
||||
{
|
||||
"parameters": {
|
||||
"optimize_target_tasks": false,
|
||||
"try_task_config": {
|
||||
"env": {
|
||||
"TRY_SELECTOR": "fuzzy"
|
||||
},
|
||||
"tasks": [
|
||||
"test/foo-debug",
|
||||
"test/foo-opt"
|
||||
]
|
||||
}
|
||||
},
|
||||
"version": 2
|
||||
}
|
||||
|
||||
$ unset EDITOR
|
||||
$ ./mach try fuzzy $testargs -q foo -m > /dev/null 2>&1
|
||||
[2]
|
||||
|
||||
|
||||
Test custom commit messages with syntax selector
|
||||
|
||||
$ ./mach try syntax $testargs -p linux -u mochitests --message "Foobar"
|
||||
Commit message:
|
||||
Foobar
|
||||
|
||||
try: -b do -p linux -u mochitests
|
||||
|
||||
mach try command: `./mach try syntax --no-push --no-artifact -p linux -u mochitests --message Foobar`
|
||||
|
||||
Pushed via `mach try syntax`
|
||||
$ ./mach try syntax $testargs -p linux -u mochitests -m "Foobar: {msg}"
|
||||
Commit message:
|
||||
Foobar: try: -b do -p linux -u mochitests
|
||||
|
||||
mach try command: `./mach try syntax --no-push --no-artifact -p linux -u mochitests -m "Foobar: {msg}"`
|
||||
|
||||
Pushed via `mach try syntax`
|
||||
$ unset EDITOR
|
||||
$ ./mach try syntax $testargs -p linux -u mochitests -m > /dev/null 2>&1
|
||||
[2]
|
@ -1,410 +0,0 @@
|
||||
$ . $TESTDIR/setup.sh
|
||||
$ cd $topsrcdir
|
||||
|
||||
Test preset with no subcommand
|
||||
|
||||
$ ./mach try $testargs --save foo -b do -p linux -u mochitests -t none --tag foo
|
||||
preset saved, run with: --preset=foo
|
||||
|
||||
$ ./mach try $testargs --preset foo
|
||||
Commit message:
|
||||
try: -b do -p linux -u mochitests -t none --tag foo
|
||||
|
||||
mach try command: `./mach try --no-push --no-artifact --preset foo`
|
||||
|
||||
Pushed via `mach try syntax`
|
||||
|
||||
$ ./mach try syntax $testargs --preset foo
|
||||
Commit message:
|
||||
try: -b do -p linux -u mochitests -t none --tag foo
|
||||
|
||||
mach try command: `./mach try syntax --no-push --no-artifact --preset foo`
|
||||
|
||||
Pushed via `mach try syntax`
|
||||
|
||||
$ ./mach try $testargs --list-presets
|
||||
Presets from */mozbuild/try_presets.yml: (glob)
|
||||
|
||||
foo:
|
||||
no_artifact: true
|
||||
platforms:
|
||||
- linux
|
||||
selector: syntax
|
||||
tags:
|
||||
- foo
|
||||
talos:
|
||||
- none
|
||||
tests:
|
||||
- mochitests
|
||||
|
||||
$ unset EDITOR
|
||||
$ ./mach try $testargs --edit-presets
|
||||
error: must set the $EDITOR environment variable to use --edit-presets
|
||||
$ export EDITOR=cat
|
||||
$ ./mach try $testargs --edit-presets
|
||||
foo:
|
||||
no_artifact: true
|
||||
platforms:
|
||||
- linux
|
||||
selector: syntax
|
||||
tags:
|
||||
- foo
|
||||
talos:
|
||||
- none
|
||||
tests:
|
||||
- mochitests
|
||||
|
||||
Test preset with syntax subcommand
|
||||
|
||||
$ ./mach try syntax $testargs --save bar -b do -p win32 -u none -t all --tag bar
|
||||
preset saved, run with: --preset=bar
|
||||
|
||||
$ ./mach try syntax $testargs --preset bar
|
||||
Commit message:
|
||||
try: -b do -p win32 -u none -t all --tag bar
|
||||
|
||||
mach try command: `./mach try syntax --no-push --no-artifact --preset bar`
|
||||
|
||||
Pushed via `mach try syntax`
|
||||
|
||||
$ ./mach try $testargs --preset bar
|
||||
Commit message:
|
||||
try: -b do -p win32 -u none -t all --tag bar
|
||||
|
||||
mach try command: `./mach try --no-push --no-artifact --preset bar`
|
||||
|
||||
Pushed via `mach try syntax`
|
||||
|
||||
$ ./mach try syntax $testargs --list-presets
|
||||
Presets from */mozbuild/try_presets.yml: (glob)
|
||||
|
||||
bar:
|
||||
dry_run: true
|
||||
no_artifact: true
|
||||
platforms:
|
||||
- win32
|
||||
selector: syntax
|
||||
tags:
|
||||
- bar
|
||||
talos:
|
||||
- all
|
||||
tests:
|
||||
- none
|
||||
foo:
|
||||
no_artifact: true
|
||||
platforms:
|
||||
- linux
|
||||
selector: syntax
|
||||
tags:
|
||||
- foo
|
||||
talos:
|
||||
- none
|
||||
tests:
|
||||
- mochitests
|
||||
|
||||
$ ./mach try syntax $testargs --edit-presets
|
||||
bar:
|
||||
dry_run: true
|
||||
no_artifact: true
|
||||
platforms:
|
||||
- win32
|
||||
selector: syntax
|
||||
tags:
|
||||
- bar
|
||||
talos:
|
||||
- all
|
||||
tests:
|
||||
- none
|
||||
foo:
|
||||
no_artifact: true
|
||||
platforms:
|
||||
- linux
|
||||
selector: syntax
|
||||
tags:
|
||||
- foo
|
||||
talos:
|
||||
- none
|
||||
tests:
|
||||
- mochitests
|
||||
|
||||
Test preset with fuzzy subcommand
|
||||
|
||||
$ ./mach try fuzzy $testargs --save baz -q "'foo" --rebuild 5
|
||||
preset saved, run with: --preset=baz
|
||||
|
||||
$ ./mach try fuzzy $testargs --preset baz
|
||||
Commit message:
|
||||
Fuzzy query='foo
|
||||
|
||||
mach try command: `./mach try fuzzy --no-push --no-artifact --preset baz`
|
||||
|
||||
Pushed via `mach try fuzzy`
|
||||
Calculated try_task_config.json:
|
||||
{
|
||||
"parameters": {
|
||||
"optimize_target_tasks": false,
|
||||
"try_task_config": {
|
||||
"env": {
|
||||
"TRY_SELECTOR": "fuzzy"
|
||||
},
|
||||
"rebuild": 5,
|
||||
"tasks": [
|
||||
"test/foo-debug",
|
||||
"test/foo-opt"
|
||||
]
|
||||
}
|
||||
},
|
||||
"version": 2
|
||||
}
|
||||
|
||||
|
||||
$ ./mach try $testargs --preset baz
|
||||
Commit message:
|
||||
Fuzzy query='foo
|
||||
|
||||
mach try command: `./mach try --no-push --no-artifact --preset baz`
|
||||
|
||||
Pushed via `mach try fuzzy`
|
||||
Calculated try_task_config.json:
|
||||
{
|
||||
"parameters": {
|
||||
"optimize_target_tasks": false,
|
||||
"try_task_config": {
|
||||
"env": {
|
||||
"TRY_SELECTOR": "fuzzy"
|
||||
},
|
||||
"rebuild": 5,
|
||||
"tasks": [
|
||||
"test/foo-debug",
|
||||
"test/foo-opt"
|
||||
]
|
||||
}
|
||||
},
|
||||
"version": 2
|
||||
}
|
||||
|
||||
|
||||
Queries can be appended to presets
|
||||
|
||||
$ ./mach try fuzzy $testargs --preset baz -q "'build"
|
||||
Commit message:
|
||||
Fuzzy query='foo&query='build
|
||||
|
||||
mach try command: `./mach try fuzzy --no-push --no-artifact --preset baz -q "'build"`
|
||||
|
||||
Pushed via `mach try fuzzy`
|
||||
Calculated try_task_config.json:
|
||||
{
|
||||
"parameters": {
|
||||
"optimize_target_tasks": false,
|
||||
"try_task_config": {
|
||||
"env": {
|
||||
"TRY_SELECTOR": "fuzzy"
|
||||
},
|
||||
"rebuild": 5,
|
||||
"tasks": [
|
||||
"build-baz",
|
||||
"test/foo-debug",
|
||||
"test/foo-opt"
|
||||
]
|
||||
}
|
||||
},
|
||||
"version": 2
|
||||
}
|
||||
|
||||
|
||||
$ ./mach try $testargs --preset baz -xq "'opt"
|
||||
Commit message:
|
||||
Fuzzy query='foo&query='opt
|
||||
|
||||
mach try command: `./mach try --no-push --no-artifact --preset baz -xq "'opt"`
|
||||
|
||||
Pushed via `mach try fuzzy`
|
||||
Calculated try_task_config.json:
|
||||
{
|
||||
"parameters": {
|
||||
"optimize_target_tasks": false,
|
||||
"try_task_config": {
|
||||
"env": {
|
||||
"TRY_SELECTOR": "fuzzy"
|
||||
},
|
||||
"rebuild": 5,
|
||||
"tasks": [
|
||||
"test/foo-opt"
|
||||
]
|
||||
}
|
||||
},
|
||||
"version": 2
|
||||
}
|
||||
|
||||
|
||||
$ ./mach try fuzzy $testargs --list-presets
|
||||
Presets from */mozbuild/try_presets.yml: (glob)
|
||||
|
||||
bar:
|
||||
dry_run: true
|
||||
no_artifact: true
|
||||
platforms:
|
||||
- win32
|
||||
selector: syntax
|
||||
tags:
|
||||
- bar
|
||||
talos:
|
||||
- all
|
||||
tests:
|
||||
- none
|
||||
baz:
|
||||
dry_run: true
|
||||
no_artifact: true
|
||||
query:
|
||||
- "'foo"
|
||||
rebuild: 5
|
||||
selector: fuzzy
|
||||
foo:
|
||||
no_artifact: true
|
||||
platforms:
|
||||
- linux
|
||||
selector: syntax
|
||||
tags:
|
||||
- foo
|
||||
talos:
|
||||
- none
|
||||
tests:
|
||||
- mochitests
|
||||
|
||||
$ ./mach try fuzzy $testargs --edit-presets
|
||||
bar:
|
||||
dry_run: true
|
||||
no_artifact: true
|
||||
platforms:
|
||||
- win32
|
||||
selector: syntax
|
||||
tags:
|
||||
- bar
|
||||
talos:
|
||||
- all
|
||||
tests:
|
||||
- none
|
||||
baz:
|
||||
dry_run: true
|
||||
no_artifact: true
|
||||
query:
|
||||
- "'foo"
|
||||
rebuild: 5
|
||||
selector: fuzzy
|
||||
foo:
|
||||
no_artifact: true
|
||||
platforms:
|
||||
- linux
|
||||
selector: syntax
|
||||
tags:
|
||||
- foo
|
||||
talos:
|
||||
- none
|
||||
tests:
|
||||
- mochitests
|
||||
|
||||
Test gecko-profile argument handling. Add in profiling to a preset.
|
||||
|
||||
$ ./mach try fuzzy $testargs --preset baz --gecko-profile-features=nostacksampling,cpu
|
||||
Commit message:
|
||||
Fuzzy query='foo
|
||||
|
||||
mach try command: `./mach try fuzzy --no-push --no-artifact --preset baz --gecko-profile-features=nostacksampling,cpu`
|
||||
|
||||
Pushed via `mach try fuzzy`
|
||||
Calculated try_task_config.json:
|
||||
{
|
||||
"parameters": {
|
||||
"optimize_target_tasks": false,
|
||||
"try_task_config": {
|
||||
"env": {
|
||||
"TRY_SELECTOR": "fuzzy"
|
||||
},
|
||||
"gecko-profile": true,
|
||||
"gecko-profile-features": "nostacksampling,cpu",
|
||||
"rebuild": 5,
|
||||
"tasks": [
|
||||
"test/foo-debug",
|
||||
"test/foo-opt"
|
||||
]
|
||||
}
|
||||
},
|
||||
"version": 2
|
||||
}
|
||||
|
||||
Check whether the gecko-profile flags can be used from a preset, and check
|
||||
dashes vs underscores (presets save with underscores to match ArgumentParser
|
||||
settings; everything else uses dashes.)
|
||||
|
||||
$ ./mach try fuzzy $testargs --save profile -q "'foo" --rebuild 5 --gecko-profile-features=nostacksampling,cpu
|
||||
preset saved, run with: --preset=profile
|
||||
|
||||
$ ./mach try fuzzy $testargs --preset profile
|
||||
Commit message:
|
||||
Fuzzy query='foo
|
||||
|
||||
mach try command: `./mach try fuzzy --no-push --no-artifact --preset profile`
|
||||
|
||||
Pushed via `mach try fuzzy`
|
||||
Calculated try_task_config.json:
|
||||
{
|
||||
"parameters": {
|
||||
"optimize_target_tasks": false,
|
||||
"try_task_config": {
|
||||
"env": {
|
||||
"TRY_SELECTOR": "fuzzy"
|
||||
},
|
||||
"gecko-profile": true,
|
||||
"gecko-profile-features": "nostacksampling,cpu",
|
||||
"rebuild": 5,
|
||||
"tasks": [
|
||||
"test/foo-debug",
|
||||
"test/foo-opt"
|
||||
]
|
||||
}
|
||||
},
|
||||
"version": 2
|
||||
}
|
||||
|
||||
$ EDITOR=cat ./mach try fuzzy $testargs --edit-preset profile
|
||||
bar:
|
||||
dry_run: true
|
||||
no_artifact: true
|
||||
platforms:
|
||||
- win32
|
||||
selector: syntax
|
||||
tags:
|
||||
- bar
|
||||
talos:
|
||||
- all
|
||||
tests:
|
||||
- none
|
||||
baz:
|
||||
dry_run: true
|
||||
no_artifact: true
|
||||
query:
|
||||
- "'foo"
|
||||
rebuild: 5
|
||||
selector: fuzzy
|
||||
foo:
|
||||
no_artifact: true
|
||||
platforms:
|
||||
- linux
|
||||
selector: syntax
|
||||
tags:
|
||||
- foo
|
||||
talos:
|
||||
- none
|
||||
tests:
|
||||
- mochitests
|
||||
profile:
|
||||
dry_run: true
|
||||
gecko_profile_features: nostacksampling,cpu
|
||||
no_artifact: true
|
||||
query:
|
||||
- "'foo"
|
||||
rebuild: 5
|
||||
selector: fuzzy
|
||||
|
||||
$ rm $MOZBUILD_STATE_PATH/try_presets.yml
|
1039
tools/tryselect/test/test_selectors.py
Normal file
1039
tools/tryselect/test/test_selectors.py
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user