Bug 1391675 - [tryselect] Add a test for 'mach try fuzzy' and associated task, r?gps
Basic test to get the ground work laid out.
MozReview-Commit-ID: LmjA3Kq7xKN
--- a/moz.build
+++ b/moz.build
@@ -59,16 +59,17 @@ if CONFIG['ENABLE_CLANG_PLUGIN']:
DIRS += ['build/clang-plugin']
DIRS += [
'config',
'python',
'taskcluster',
'testing/mozbase',
'third_party/python',
+ 'tools',
]
if not CONFIG['JS_STANDALONE']:
# These python manifests are included here so they get picked up without an objdir
PYTHON_UNITTEST_MANIFESTS += [
'testing/marionette/harness/marionette_harness/tests/harness_unit/python.ini',
'testing/mochitest/tests/python/python.ini',
]
new file mode 100644
--- /dev/null
+++ b/taskcluster/ci/source-test/cram.yml
@@ -0,0 +1,20 @@
+---
+tryselect:
+ description: tools/tryselect integration tests
+ platform: linux64/opt
+ treeherder:
+ symbol: cram(try)
+ kind: test
+ tier: 2
+ worker-type: aws-provisioner-v1/gecko-t-linux-xlarge
+ worker:
+ docker-image: {in-tree: "lint"}
+ max-run-time: 1800
+ run:
+ using: mach
+ mach: cramtest tools/tryselect
+ when:
+ files-changed:
+ - testing/mach_commands.py
+ - third_party/python/cram/**
+ - tools/tryselect/**
--- a/taskcluster/ci/source-test/kind.yml
+++ b/taskcluster/ci/source-test/kind.yml
@@ -1,30 +1,31 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
+---
loader: taskgraph.loader.transform:loader
transforms:
- taskgraph.transforms.source_test:transforms
- taskgraph.transforms.job:transforms
- taskgraph.transforms.task:transforms
jobs-from:
- - python-tests.yml
- - mocha.yml
- - mozlint.yml
- - doc.yml
- - webidl.yml
+ - cram.yml
+ - doc.yml
+ - mocha.yml
+ - mozlint.yml
+ - python-tests.yml
+ - webidl.yml
# This is used by run-task based tasks to lookup which build task it
# should depend on based on its own platform.
dependent-build-platforms:
- linux64-asan/opt:
- label: build-linux64-asan/opt
- target-name: target.tar.bz2
- linux64/debug:
- label: build-linux64/debug
- target-name: target.tar.bz2
- linux64.*:
- label: build-linux64/opt
- target-name: target.tar.bz2
+ linux64-asan/opt:
+ label: build-linux64-asan/opt
+ target-name: target.tar.bz2
+ linux64/debug:
+ label: build-linux64/debug
+ target-name: target.tar.bz2
+ linux64.*:
+ label: build-linux64/opt
+ target-name: target.tar.bz2
--- a/taskcluster/docker/lint/system-setup.sh
+++ b/taskcluster/docker/lint/system-setup.sh
@@ -48,16 +48,33 @@ cd /build
. install-node.sh
/build/tooltool.py fetch -m /tmp/eslint.tt
mv /build/node_modules /build/node_modules_eslint
/build/tooltool.py fetch -m /tmp/eslint-plugin-mozilla.tt
mv /build/node_modules /build/node_modules_eslint-plugin-mozilla
###
+# fzf setup
+###
+
+tooltool_fetch <<EOF
+[
+ {
+ "size": 866160,
+ "digest": "9f0ef6bf44b8622bd0e4e8b0b5b5c714c0a2ce4487e6f234e7d4caac458164c521949f4d84b8296274e8bd20966f835e26f6492ba499405d38b620181e82429e",
+ "algorithm": "sha512",
+ "filename": "fzf-0.16.11-linux_amd64.tgz",
+ "unpack": true
+ }
+]
+EOF
+mv fzf /usr/local/bin
+
+###
# Flake8 Setup
###
cd /setup
pip install --require-hashes -r /tmp/flake8_requirements.txt
###
--- a/taskcluster/taskgraph/transforms/task.py
+++ b/taskcluster/taskgraph/transforms/task.py
@@ -439,16 +439,17 @@ task_description_schema = Schema({
# "Invalid" is a noop for try and other non-supported branches
Required('google-play-track'): Any('production', 'beta', 'alpha', 'rollout', 'invalid'),
Required('dry-run', default=True): bool,
Optional('rollout-percentage'): int,
}),
})
GROUP_NAMES = {
+ 'cram': 'Cram tests',
'mocha': 'Mocha unit tests',
'py': 'Python unit tests',
'tc': 'Executed by TaskCluster',
'tc-e10s': 'Executed by TaskCluster with e10s',
'tc-Fxfn-l': 'Firefox functional tests (local) executed by TaskCluster',
'tc-Fxfn-l-e10s': 'Firefox functional tests (local) executed by TaskCluster with e10s',
'tc-Fxfn-r': 'Firefox functional tests (remote) executed by TaskCluster',
'tc-Fxfn-r-e10s': 'Firefox functional tests (remote) executed by TaskCluster with e10s',
--- a/tools/moz.build
+++ b/tools/moz.build
@@ -43,8 +43,12 @@ with Files("rewriting/**"):
with Files("tryselect/**"):
BUG_COMPONENT = ("Testing", "General")
with Files("update-packaging/**"):
BUG_COMPONENT = ("Release Engineering", "Other")
SPHINX_TREES['lint'] = 'lint/docs'
SPHINX_TREES['compare-locales'] = 'compare-locales/docs'
+
+CRAMTEST_MANIFESTS += [
+ 'tryselect/test/cram.ini',
+]
new file mode 100644
--- /dev/null
+++ b/tools/tryselect/test/cram.ini
@@ -0,0 +1,1 @@
+[test_fuzzy.t]
new file mode 100644
--- /dev/null
+++ b/tools/tryselect/test/setup.sh
@@ -0,0 +1,24 @@
+export topsrcdir=$TESTDIR/../../../
+export MOZBUILD_STATE_PATH=$TMP/mozbuild
+
+cachedir=$MOZBUILD_STATE_PATH/cache/taskgraph
+mkdir -p $cachedir
+
+cat >> $cachedir/target_task_set << EOF
+test/foo-opt
+test/foo-debug
+build-baz
+EOF
+
+cat >> $cachedir/full_task_set << EOF
+test/foo-opt
+test/foo-debug
+test/bar-opt
+test/bar-debug
+build-baz
+EOF
+
+# set mtime to the future so we don't re-generate tasks
+find $cachedir -type f -exec touch -d "next day" {} +
+
+export testargs="--no-push --no-artifact"
new file mode 100644
--- /dev/null
+++ b/tools/tryselect/test/test_fuzzy.t
@@ -0,0 +1,23 @@
+ $ . $TESTDIR/setup.sh
+ $ cd $topsrcdir
+
+Test fuzzy selector
+
+ $ ./mach try fuzzy $testargs -q "'foo"
+ Calculated try selector:
+ {
+ "tasks":[
+ "test/foo-debug",
+ "test/foo-opt"
+ ]
+ }
+ $ ./mach try fuzzy $testargs -q "'bar"
+ no tasks selected
+ $ ./mach try fuzzy $testargs --full -q "'bar"
+ Calculated try selector:
+ {
+ "tasks":[
+ "test/bar-debug",
+ "test/bar-opt"
+ ]
+ }
--- a/tools/tryselect/vcs.py
+++ b/tools/tryselect/vcs.py
@@ -78,17 +78,17 @@ class VCSHelper(object):
def write_task_config(self, labels, templates=None):
config = os.path.join(self.root, 'try_task_config.json')
with open(config, 'w') as fh:
try_task_config = {'tasks': sorted(labels)}
if templates:
try_task_config['templates'] = templates
- json.dump(try_task_config, fh, indent=2)
+ json.dump(try_task_config, fh, indent=2, separators=(',', ':'))
return config
def check_working_directory(self, push=True):
if not push:
return
if self.has_uncommitted_changes:
print(UNCOMMITTED_CHANGES)