Commit Graph
186 Commits
Author SHA1 Message Date
Andrew Halberstadt ec257dcef2 Bug 1392390 - Create a reftest selftest harness, r=jmaher
This just adds two basic tests, one for a passing test and another for a
failing one. In mochitest, we use privileged APIs to also tests crashes,
assertions, asan and leaks. But these APIs aren't available to reftests
so I'm not sure how we can test these things.

I figure it's not worth holding the framework up on this though, I'll file
a follow-up to figure out something to do for that.

MozReview-Commit-ID: 59TSbsugT5T
2017-09-11 16:08:01 -04:00
Andrew Halberstadt f7b445f2f2 Bug 1339178 - Use pytest to run python-tests, r=davehunt
This switches most tests over to use pytest as the runner instead of unittest (taking
advantage of the fact that pytest can run unittest based tests).

There were a couple tests that had failures when swithing to pytest:
config/tests/unit-expandlibs.py
xpcom/idl-parser/xpidl/runtests.py

For these tests, I added a runwith='unittest' argument so that they still run the
same way as before. Once we fix them to use pytest, the unittest logic in mozunit.py
can be deleted.

MozReview-Commit-ID: Gcsz6z8MeOi
2017-08-29 14:50:33 -04:00
Ganti Sai Sarath Chandra 6bda4ec56b Bug 1378422 - Add python 2 only classifiers to python modules under /testing, r=ahal
MozReview-Commit-ID: DRi8KFyCnBn
2017-08-19 04:19:06 +05:30
Dave Hunt 6ebd7c08e1 Bug 1349516 - Add support to pytest-mozlog for tests rerun using pytest-rerunfailures; r=ahal
MozReview-Commit-ID: GrFaW74EwXC
2017-07-20 18:03:11 +01:00
James Graham 931f0c2a20 Bug 1376977 - Update mozlog version number for release, r=whimboo
MozReview-Commit-ID: 6NPCSOXnSAI
2017-06-28 20:06:18 -07:00
James Graham a216f7fb07 Bug 1375145 - Make xdist hook optional in pytest-mozlog, r=davehunt
MozReview-Commit-ID: 6wVUi9XoLZX
2017-06-21 18:07:27 +01:00
Carsten "Tomcat" Book 03bc3da7e1 Backed out changeset ea9c2e2a07e5 (bug 1375145) for test failures in /mozlog/pytest_mozlog/plugin.py:10:1 2017-06-22 12:13:36 +02:00
James Graham 544e47688a Bug 1375145 - Make xdist hook optional in pytest-mozlog, r=davehunt
MozReview-Commit-ID: 6wVUi9XoLZX
2017-06-21 18:07:27 +01:00
Andrew Halberstadt bce781d9b8 Bug 1373294 - Fix E305 (two blank lines after method or class) in files enabled by flake8 linter, r=jmaher
This is needed before we can upgrade to flake8 3.3.0, as that version starts flagging these errors.

These files were modified by running:
autopep8 --select E305 --in-place -r <dir>

on the affected directories. I did it one dir at a time and verified the result after each.

MozReview-Commit-ID: FmlsfiKIbtr
2017-06-15 12:10:59 -04:00
Andrew Halberstadt 5e96b32cdc Bug 1372668 - [mozlog] Limit the size of data logged from error message when suite_start called multiple times, r=jgraham
We've seen a couple of enormous log files (200MB+). This largely happened due to a bug in the test harness that resulted
in suite_start being called over and over again. In each of these instances, mozlog logged something like:
log.error("Suite start called multiple times: {}".format(data))

The problem is that 'data' contained every single test id in the suite, which was *a lot*. Dumping all test ids in that
error message is not useful for debugging. This patch limits the size of the 'suite_start' data in the error message to
100 characters.

MozReview-Commit-ID: GnPizNrZ2QJ
2017-06-14 11:20:39 -04:00
Andrew Halberstadt c3de66ccf8 Bug 1048446 - [mozlog] Don't re-use existing loggers when calling mozlog.commandline.setup_logging a second time, r=jgraham
This is case that got hit with the new mochitest selftest harness. In this scenario, several MochitestDesktop instances
(which call commandline.setup_logging in their constructor) are instantiated in the same interpreter. Because mozlog
implicitly saves the logger state, this meant that setup_logging kept appending duplicate handlers to the existing ones.

I believe that the intent of 'setup_logging' is to get a brand new logger, so it should ensure logger state is reset
on subsequent calls.

MozReview-Commit-ID: Jqyhbj7nC6z
2017-05-29 14:23:04 -04:00
Andrew Halberstadt 47f052b0b6 Bug 1370359 - Stop dumping all tests to errorsummary.log; include manifest in error lines, r=jgraham
MozReview-Commit-ID: 9m0ArgifgU9
2017-06-06 15:05:17 -04:00
Geoff Brown b195bd0c85 Bug 1367780 - Enable eslint on testing/firefox-ui,mozbase,profiles,specialpowers - mechanical updates; r=Standard8 2017-05-30 16:06:29 -06:00
James Graham 995f6ab10b Bug 1368342 - Add mozlog logger that goes via a queue, r=ahal
This allows subprocesses to log to a shared stream via a queue, so that we
avoid the overhead of a multiprocessing Lock around all log access, but still
avoid races where two processes try to log simultaneously. It's mostly useful
where one process is responsible for the majority of logging, but some messages
will be generated in child processes.

MozReview-Commit-ID: ABl6cvpb6qI
2017-05-26 12:53:00 +01:00
Andrew Halberstadt fe1c935c1b Bug 1344346 - [mozlog] Use less verbose formatting on 'process_output' messages, r=jgraham
This simplifies the 'process_output' formatting in both the mach and tbpl formatters. It will also
add the string 'pid' somewhere in the format, but only if the process id is actually a positive int.

MozReview-Commit-ID: 6nc5q06cDfM
2017-03-06 13:20:25 -05:00
Iris Hsiao 235550c59e Backed out 3 changesets (bug 1344346) for mochitest shutdownleaks
Backed out changeset 71e3443cdc43 (bug 1344346)
Backed out changeset cd8993e4d0dd (bug 1344346)
Backed out changeset 8e03e57d44aa (bug 1344346)
2017-03-10 10:44:13 +08:00
Andrew Halberstadt eac259ce12 Bug 1344346 - [mozlog] Use less verbose formatting on 'process_output' messages, r=jgraham
This simplifies the 'process_output' formatting in both the mach and tbpl formatters. It will also
add the string 'pid' somewhere in the format, but only if the process id is actually a positive int.

MozReview-Commit-ID: 6nc5q06cDfM
2017-03-06 13:20:25 -05:00
Sebastian Hengst bd3c183605 Backed out changeset 896205d8a760 (bug 1344346) 2017-03-09 18:35:41 +01:00
Andrew Halberstadt c61b0ef4cd Bug 1344346 - [mozlog] Use less verbose formatting on 'process_output' messages, r=jgraham
This simplifies the 'process_output' formatting in both the mach and tbpl formatters. It will also
add the string 'pid' somewhere in the format, but only if the process id is actually a positive int.

MozReview-Commit-ID: 6nc5q06cDfM
2017-03-06 13:20:25 -05:00
James Graham 43e32f7d29 Bug 1342954 - fixup formatting to keep flake8 happy, a=bustage
MozReview-Commit-ID: xY96Ttr4pz
2017-02-28 14:50:55 +00:00
Andrew Halberstadt 8f7dac86a5 Bug 1340551 - [mozlog] Add test group (manifest) information to test harness error summaries, r=jgraham
This modifies the errorsummary formatter to make use of the new keyed-by-group tests field in the suite_start
message.

MozReview-Commit-ID: 1lcw62fmofa
2017-02-22 14:36:10 -05:00
Andrew Halberstadt b5a0117d1b Bug 1340551 - [mozlog] Change 'tests' field in suite_start action to a dict of tests keyed by group name, r=jgraham
In suite_start, tests is currently a list of test ids. But to support a new 'test-centric' treeherder view, we need to
be able to map tests to their manifests somewhere in the structured log, and the suite_start tests field seemed like a
good spot.

Because not all test suites use manifests, this is being called a "group" so it could potentially be re-used with
directories, tags or subsuites.

MozReview-Commit-ID: 2Sc7nqJrWts
2017-02-22 11:46:09 -05:00
Andrew Halberstadt 82bba7a291 Bug 1340551 - [mozlog] Introduce concept of ContainerType in logtypes and allow nested containers, r=jgraham
Currently the List and Tuple DataTypes must specify what items they contain. But there's no way to specify
item types recursively, e.g List(Tuple(Int, Int)). Also the Dict type can't specify the item types it must
contain either. Dict is a special case because we may want to control both keys and values.

This patch formalizes a ContainerType (of which List, Tuple and Dict are subclasses).

MozReview-Commit-ID: Bouhy1DIAyD
2017-02-21 14:24:14 -05:00
James Graham b455af926f Bug 1342954 - Improve ERROR handling in pytest_mozlog r=davehunt
Not all report objects are strings, tuples or have a .crashrepr
property. In particular some brokeness in wdspec test setup produced
an object with a .errorstring property. Handle that and the general
case of being passed a weird object more gracefully.

MozReview-Commit-ID: 8vfuNNmwjhC
2017-02-27 16:56:48 +00:00
Dave Hunt bec682d9a4 Bug 1340092 - [mozlog] Add metadata from pytest-metadata plugin if installed to suite_start. r=ahal
If the optional pytest-metadata plugin is installed, add the metadata as run_info when logging the suite_start to give additional context to the results.

MozReview-Commit-ID: 1MeXZTmzvyp
2017-02-16 01:54:25 +00:00
Dave Hunt b89330ac5b Bug 1338534 - [mozlog] Indicate unexpected pass with the correct status. r=ahal
Unexpected passes can cause failures in pytest when the expected failures are set to strict. When we're logging these we want to indicate that the correct outcome.

MozReview-Commit-ID: 8VoR6CTrynY
2017-02-14 23:09:28 +00:00
Dave Hunt 416b0535f6 Bug 1338534 - [mozlog] Improve handling of expected failures in pytest-mozlog. r=ahal
Include failure messages and stack traces even when failures are expected.

MozReview-Commit-ID: HSNYfbTEH9O
2017-02-14 12:07:36 +00:00
Dave Hunt 33b92aed38 Bug 1338534 - [mozlog] Log message and stack for failures when using pytest-mozlog with pytest-xdist. r=ahal
When using pytest-xdist to run tests in parallel, failures are serialised as strings. This means we're unable to reliably extract the message and line number, so instead we log the stack and the message as the serialised string result.

MozReview-Commit-ID: 6vrEjBtkXK8
2017-02-14 12:13:11 +00:00
Andrew Halberstadt 64e33c7c26 Bug 1003417 - Add a 'mozbase' subsuite to python unittests on linux, r=ted
The subsuite is added conditionally because we only have the capability of
running source-check tasks on linux at the moment. Once taskcluster support
for windows and mac has matured a bit and the taskcluster configs support
source-check there, we should apply the subuite unconditionally.

MozReview-Commit-ID: Kk9Irz3fn14
2016-11-16 16:43:42 -05:00
Dave Hunt b7a320cb15 Bug 1338531 - [mozlog] Collect tests when using pytest-xdist and send suite_start when the first test starts. r=ahal
When using pytest-xdist we need to gather the tests for each slave. Lack of a better hook means I'm then using the first test start to log the suite_start message including the collected tests.

MozReview-Commit-ID: 7l22z9RvIhx
2017-02-13 18:46:10 +00:00
Dave Hunt aced126e51 Bug 1338528 - [mozlog] Remove formatting of node ID to allow classes and reduce chance of duplicates. r=ahal
Stripping the path from the test file could cause duplicates if two files had the same name in different directories. Splitting on '::' also causes an issue when test classes are used and there are too many values to unpack.

MozReview-Commit-ID: Ex5nHl3SGaQ
2017-02-10 18:48:22 +00:00
Florian Quèze c32c931bc9 Bug 1334831 - script-generated patch to use .remove() instead of .parentNode.removeChild, r=jaws. 2017-01-30 08:10:22 +01:00
Florian Quèze 63de711857 Bug 1331081 - script generated patch to omit addEventListener/removeEventListener's third parameter when it's false, r=jaws. 2017-01-17 11:50:25 +01:00
James Graham 8116f9ba2b Bug 1321127 - Add a assertion_count action to mozlog, r=ahal
This is intended as a structured replacement for the assertion checks
that previously used unstructured logs. It adds a log action
assertion_count, which takes the actual number of assertions observed
during a test, the minimum expeced number and the maximum expected
number. It also updates the reftest harness to use this logging.

MozReview-Commit-ID: JgjLlaYuvSG
2016-12-08 09:53:21 -10:00
Andrew Halberstadt e7efd21c97 Bug 1317970 - Make mozbase tests use mozunit for consistent formatting, r=chmanchester
The mozbase unittests don't use mozunit, so their output is confusing in the log.
This makes mozbase output consistent with the rest of the python unittests.

MozReview-Commit-ID: AIs5mza8Rn6
2016-11-17 16:36:18 -05:00
Francesco Pischedda 46c0d4af68 Bug 1280573 - Add testing/mozbase to flake8 linter: r=ahal
added testing/mozbase to tools/lint/flake8.lint
fixed a first batch of PEP8 errors/warnings

at first the commad autopep8 -i --max-line-length 99 -r -j 8 .
has been used to fix simpler problems, run from testing/mozbase

some of the issues can not easily fixed :
- undefined 'names' in code for example isLinux - isLinux and isBsd "fixed" with # noqa
- undefined 'message' resolved with return fmt.format(...
- undefined 'structured' resolved replacing those with mozlog
- long comments - some remaining - addressed with # noqa
- package level import everything - addressed with # flake8: noqa

restored testing/mozbase/mozdevice/mozdevice/Zeroconf.py
fixed issues reported on mozreview
fixed ')' in testing/mozbase/mozprocess/mozprocess/qijo.py imports
finally fixed multiline string at testing/mozbase/manifestparser/tests/test_manifestparser.py:114
^^^ and again, but now with ./mach python-test --path-only testing/mozbase/manifestparser/tests/test_manifestparser.py passing
fixed testing/mozbase/manifestparser/tests/test_convert_directory.py assert

fixed this error:
10:15:21     INFO -      return lambda line: stack_fixer_module.fixSymbols(line)
10:15:21     INFO -  TypeError: fixSymbols() takes exactly 2 arguments (1 given)

fixed two spaces lint error even of #  noqa comments
restored assignement to lambda with #  noqa to silence the lint error
global noqa for testing/mozbase/manifestparser/tests/test_filters.py
stupid is/is not error...

MozReview-Commit-ID: 1FpJF54GqIi
2016-09-30 16:08:37 +02:00
James Graham 4f7a43e9ab Bug 1265582 - Fix reftest structured logs to match wpt, r=ahal
This allows the logs to work with the structured reftest viewer.

MozReview-Commit-ID: CY71vSdDjLP
2016-09-27 22:54:50 +01:00
James Graham e0df64ee7d Bug 1302796 - Add integration between structured logging and lints, r=ahal
MozReview-Commit-ID: K3tu0Zdg5go
2016-09-13 14:18:41 +01:00
Anjana Vakil 3ce8f2b049 Bug 1285299 - Add pytest_mozlog plugin to mozlog; r=jgraham
Add the `pytest_mozlog` module (from https://github.com/davehunt/pytest-mozlog)
to mozbase/mozlog/mozlog, so that we can use it in the logging of the
Marionette harness tests.

Add an entry point for the plugin to mozlog/setup.py so that
when mozlog is installed, pytest will register the pytest_mozlog
plugin.py module as the plugin 'mozlog'.


Make the following modifications to pytest_mozlog/plugin.py:

- Disable stdout logging by default in pytest-mozlog

  In the pytest-mozlog plugin, disable logging to stdout by
  default when setting up the mozlog logger, so that the
  default output seen when using the plugin is just the
  Pytest terminal output. The user can specify a mozlog
  logger to write to stdout by using the '--log-* -' option,
  in which case both Pytest and pytest-mozlog will log to stdout.

- Record error msg and lineno in pytest-mozlog logs

  Extract the error message and line number for tests with failures/
  errors from the Pytest test report, and pass these to the Mozlog
  logs output by the pytest-mozlog plugin. For skipped tests,
  pass the skip reason, and for unexpected passes allow Mozlog to
  report its default message "expected FAIL".

- Report collected item count in pytest-mozlog

  Add/modify Pytest hooks in the pytest-mozlog plugin so that the
  suite_start event sent to the logger contains the correct list
  of tests to be run, i.e. items collected by Pytest, instead
  of an empty list. This allows mozlog to log the correct number
  of tests to be run.

- Log skipped/xfailed tests with corresponding status (not 'PASS')

  Log skipped tests with status 'SKIP' and expected failures
  that do indeed fail with status 'FAIL'/expected 'FAIL'
  so that these can be distinguished from true passing tests.

- Pass parsed arguments directly to mozlog.commandline.setup_logging

  Pass the entire Pytest config's argument namespace to `setup_logging`
  instead of copying over only the non-None formatters/formatter option
  arguments. Use the new `allow_unused_options` parameter to stop
  Mozlog from raising an error about options for unused formatters.

MozReview-Commit-ID: 4WpprytS5cI
2016-09-08 11:43:11 +02:00
Anjana Vakil 9c94d59ee2 Bug 1285299 - Optionally ignore unused Mozlog formatter options; r=jgraham
Add a parameter `allow_unused_options` to the `setup_logging` and
`setup_handlers` methods in mozlog.commandline. When this parameter
is True, do not raise a ValueError in `setup_handlers` if the
command line arguments include formatter options for unused formatters.
(Default value is False.)

This allows parsed arguments from e.g. the pytest-mozlog plugin
to be passed directly to `setup_logging`, without filtering out
unused formatter options.

MozReview-Commit-ID: 8el0oaT4y1X
2016-09-07 20:55:21 +02:00
James Graham f50dca168e Bug 1293250 - Make reftest log generation less magical, r=ahal
Ensure that the first line of the log for failing tests is identical to
one that would be produced by the tbplformatter from mozlog. This means
that treeherder will be able to sucessfully cross-match error lines.

Also make the data structures used for storing screenshots identical
between reftests and web-platform-tests so that we can start to move
toward removing the reftest-specific codepath here.

MozReview-Commit-ID: FZQXLjj9Ejv
2016-08-08 17:48:39 +01:00
Jeremy Chen 67e0d3efaa Bug 1287480 - Release mozlog 3.3. r=jmaher
MozReview-Commit-ID: D6UsFueHmPB
2016-07-19 09:50:09 +08:00
Henrik Skupin 94e8a69188 Bug 1255986 - [moztest] Safe-guard structured logging for exceptions from bad handlers. r=jgraham
Any exception which gets thrown by a log handler while test results are getting generated, should
not cause test harnesses to stop immediately. To achive that the exception details are written to
stderr and not propagated up the stack.

MozReview-Commit-ID: ChyYxApYSGx
2016-06-03 22:20:59 +02:00
Jeremy Chen 7f52eb59c3 Bug 1287019 - part2: prevent saving redundant screenshots in mozlog's HTML format result. r=jmaher
There are two identical pairs of screenshots (test/reference pair) which are
png/base64 raw files generated from mozlog's HTML formatter. One pair is stored
in the img element to present the visual result; the other pair is stored as a
hyperlink source in the visual result's title.

After part1 patch, we may have one more pair. It appears that the hyperlinks of
the visual result's titles could be eliminated since they are visually closed to
the visual results, and clicking the visual results provides the exact same
function.

DONTBUILD (NPOTB)

MozReview-Commit-ID: 4CLfYXX8g69
2016-07-18 13:53:58 +08:00
Jeremy Chen 9b8915f2b0 Bug 1287019 - part1: make mozlog's HTML format support wptrunner screenshot. r=jmaher
Current mozlog (v3.2) doesn't support screenshot logs exported from wptrunner.
Add this support so we could run css test with --log-html to see more detail
information, such as screenshots of test/reference pages.

DONTBUILD (NPOTB)

MozReview-Commit-ID: AUJwYfvNfda
2016-07-18 13:53:58 +08:00
Henrik Skupin 1b01fb9d64 Bug 1271612 - Release mozlog 3.2. r=jmaher
MozReview-Commit-ID: I8JcpkeLzkv
2016-05-11 10:17:45 +02:00
Henrik Skupin 59eb9829bb Bug 1258343 - [mozlog] Fix HTML report generation for unicode characters. r=jmaher
MozReview-Commit-ID: 79l2BuNRIxq
2016-05-09 23:14:05 +02:00
James Graham ab43cd27f4 Bug 1270507 - Elide subtest results from web-platform-tests on treeherder when they match expectations, r=ahal
MozReview-Commit-ID: DyatYcpdjvQ
2016-05-03 23:21:07 +01:00
Shing Lyu 4bab83b405 Bug 1258616 - Swap the order of test and ref images in html reftest report to match reftest-analyzer convention. r=jmaher 2016-03-30 20:13:00 -04:00
Shing Lyu 944cef86b0 Bug 1253219 - Add reftest screenshots to html report for easier debugging. r=jmaher 2016-03-14 05:16:00 +01:00