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

--HG--
extra : rebase_source : c32e1954b6b5b88c825075c64c8b9993be3035c6
This commit is contained in:
Andrew Halberstadt 2017-08-21 11:52:28 -04:00
Родитель dd95aa68cc
Коммит a4a6ffdd99
10 изменённых файлов: 108 добавлений и 16 удалений

Просмотреть файл

@ -64,6 +64,7 @@ DIRS += [
'taskcluster',
'testing/mozbase',
'third_party/python',
'tools',
]
if not CONFIG['JS_STANDALONE']:

Просмотреть файл

@ -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/**

Просмотреть файл

@ -1,7 +1,7 @@
# 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:
@ -10,21 +10,22 @@ 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

Просмотреть файл

@ -52,6 +52,23 @@ 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
###

Просмотреть файл

@ -444,6 +444,7 @@ task_description_schema = Schema({
})
GROUP_NAMES = {
'cram': 'Cram tests',
'mocha': 'Mocha unit tests',
'py': 'Python unit tests',
'tc': 'Executed by TaskCluster',

Просмотреть файл

@ -48,3 +48,7 @@ with Files("update-packaging/**"):
SPHINX_TREES['lint'] = 'lint/docs'
SPHINX_TREES['compare-locales'] = 'compare-locales/docs'
CRAMTEST_MANIFESTS += [
'tryselect/test/cram.ini',
]

Просмотреть файл

@ -0,0 +1 @@
[test_fuzzy.t]

Просмотреть файл

@ -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"

Просмотреть файл

@ -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"
]
}

Просмотреть файл

@ -83,7 +83,7 @@ class VCSHelper(object):
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):