Commit graph

22 commits

Author SHA1 Message Date
Luke Granger-Brown 4de343cccf nixos/test-driver: use a variety of different Tesseract settings for OCR
When performing OCR, some of the Tesseract settings perform better than
others on a variety of different workloads, but they mostly take
~negligible incremental time to run compared to the overhead of running
the ImageMagick filters.

After this commit, we try using all three of the current Tesseract
models (classic, LSTM, and classic+LSTM) to generate output text. This
fixes chromium-90's tests at release-20.09, and should make cases where
you're looking for *specific* text better, with the tradeoff of running
Tesseract multiple times.

To make it sensible to cherrypick this into release-20.09, this doesn't
change the existing API surface for the test driver. In particular,
get_screen_text continues to have the existing behaviour.
2021-04-23 18:42:35 +00:00
Bryan Gardiner d3ea5a7290
nixos/manual/writing-nixos-tests: document how to disable Black silently 2021-03-10 18:56:52 -08:00
Philipp Bartsch eae103c835 nixos/doc: fix dead link 2020-09-19 12:52:14 +02:00
Olli Helenius 446669cb5e
nixos/manual: Fix reference to send_key 2020-08-03 13:16:24 +03:00
Olli Helenius 2d8311dac9
nixos/manual: Fix reference to copy_from_host 2020-07-18 14:26:44 +03:00
rnhmjoj b520055df6
nixos/lib/test-driver: add wait_for_console_text
This method is similar to wait_for_text but is based on matching
serial console lines instead of the VGA output.
2020-06-24 10:22:53 +02:00
Tom Fitzhenry f3c8acc0bb nixos/doc: update stale fn name s/copy_file_from_host/copy_from_host/
This was renamed in the Perl -> Python test driver migration.
2020-06-01 18:05:58 +10:00
Maximilian Bosch b72661749b
nixos/python-test-driver: add an option to disable python linter
While it's a good idea to automate the linting of the python code used
for our tests, I think that it can be quite distracting when hacking on
a NixOS test.

I figured that it might be more convenient to add an option as a
shortcut for this to avoid that everyone needs to dig into the test
driver again.
2019-12-22 19:27:43 +01:00
Jacek Galowicz 7d19c5aaa7 nixos/test: Pythonify documentation 2019-11-04 23:50:50 +01:00
Eelco Dolstra b0ccd6dd16
Revert "nixos/doc: re-format"
This reverts commit ea6e8775bd. The new
format is not an improvement.
2019-09-19 19:17:30 +02:00
Jan Tojnar ea6e8775bd
nixos/doc: re-format 2019-09-18 22:13:35 +02:00
Jan Tojnar 11cb382a4c
nixos/doc: Fix spurious indentation 2019-06-17 12:28:26 +02:00
Erik Arvstedt 931b7b47a2 nixos tests doc: minor fixes
This fixes some quirks I introduced in previous commits.

1. No need for an extra newline when printing the output of shell commands.
2. 'or die' is what's already used in the NixOS test sources, while
   'die unless' has no occurrences.
2018-11-26 19:36:50 +01:00
Erik Arvstedt b0956b0ae3 nixos tests doc: fix example statement
False statements don't cause NixOS tests to fail, we need to throw an
exception or terminate.
2018-09-17 13:08:02 +02:00
Samuel Dionne-Riel 88ca2b1ec4 nixos/doc: ran make format
With visual inspection that nothing got worse.
2018-05-31 21:03:51 -04:00
Graham Christensen eca5c99bf8
nixos docs: format =) 2018-05-01 19:57:09 -04:00
Maximilian Bosch e18b0b6033
test-driver: mention $user argument in the NixOS manual and the Impala release notes 2018-01-06 10:09:18 +01:00
Bastian Köcher 1200f9b9e2 Adds missing documentation for copyFileFromHost in NixOS tests 2017-11-23 15:50:54 +01:00
aszlig 8be00dc71d
nixos/test-driver: Make tesseract OCR optional.
By default this is now enabled, and it has to be explicitely enabled
using "enableOCR = true". If it is set to false, any usage of
getScreenText or waitForText will fail with an error suggesting to pass
enableOCR.

This should get rid of the rather large dependency on tesseract which
we don't need for most tests.

Note, that I'm using system("type -P") here to check whether tesseract
is in PATH. I know it's a bashism but we already have other bashisms
within the test scripts and we also run it with bash, so IMHO it's not a
problem here.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
2015-05-22 07:21:58 +02:00
aszlig 8bd025a75e
nixos/test-driver: Add new waitForText function.
As promised in the previous commit, this can be used similarly to
$machine->waitForWindow, where you supply a regular expression and it's
retrying OCR until the regexp matches.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
2015-05-21 19:55:21 +02:00
aszlig 235c2228ca
nixos/test-driver: Add new getScreenText function.
Basically, this creates a screenshot and throws tesseract at it to
recognize the characters from the screenshot. In order to produce a
result that is well enough, we're using lanczos scaling and scale the
image up to 400% of its original size.

This provides the base functionality for a new Machine method which will
be called waitForText. I originally had that idea long ago when writing
the VM tests for VirtualBox and Chromium, but thought it would be
disproportionate to the case.

The downside however is that VM tests now depend on tesseract, but given
the average runtime of our tests it really shouldn't have a too big
impact and it's only a runtime dependency after all.

Another issue is that the OCR process takes quite some time to finish,
but IMHO it's better (as in more deterministic) than to rely on sleep().

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
2015-05-21 19:55:21 +02:00
Mikey Ariel a099ca4505 Chunk NixOS manual
[Squashed commits to make git blame etc. more likely to work. -ED]
2014-08-26 19:03:49 +02:00