Commit Graph

356 Commits

Author SHA1 Message Date
Pavel Emelyanov
4f4b863e6a test.py: Always disable boost colored output
Tests' output is always redirected to a log file. Enabling colored
output makes it very hard to read.

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
Message-Id: <20210730083731.17813-1-xemul@scylladb.com>
2021-07-30 12:22:31 +03:00
Avi Kivity
2cfc517874 main, test: adjust number of networking iocbs
Seastar's default limit of 10,000 iocbs per shard is too low for
some workload (it places an upper bound on the number of idle
connections, above which a crash occurs). Use the new Seastar
feature to raise the default to 50000.

Also multiply the global reservation by 5, and round it upwards
so the number is less weird. This prevents io_setup() from failing.

For tests, the reservation is reduced since they don't create large
numbers of connections. This reduces surprise test failures when they
are run on machines that haven't been adjusted.

Fixes #9051

Closes #9052
2021-07-18 14:38:44 +03:00
Pavel Emelyanov
cbb4837b77 test.py: Parallelize test-cases run (for boost tests)
The parallelizm is acheived by listing the content of each (boost)
test and by adding a test for each case found appending the
'--run_test={case_name}' option.

Also few tests (logallog and memtable) have cases that depend on
each other (the former explicitly stated this in the head comment),
so these are marked as "no_parallel_cases" in the suite.yaml file.

In dev mode tests need 2m:5s to run by default. With parallelizm
(and updated long-running tests list) -- 1m 35s.

In debug mode there are 6 slow _cases_ that overrun 30 minutes.
They finish last and deserve some special (incremental) care. All
the other tests run ~1h by default vs ~25m in parallel.

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
2021-07-16 17:25:07 +03:00
Pavel Emelyanov
3cac5173b7 test.py: Prepare BoostTest for running individual cases
This means adding the casename argument to its describing class
and handling it:

1. appending to the shortname
2. adding the --run_test= argument to boost args

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
2021-07-16 17:25:07 +03:00
Pavel Emelyanov
0baee5d423 test.py: Prepare TestSuite::create_test() for parallelizm
The method in question is in charge of creating a single
entry in the list of tests to be run. The BoostTestSuite's
method is about to create several entries and this patch
prepares it for this:

- makes it distinguish individual arguments
- lets it select the test.id value itself

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
2021-07-16 17:25:07 +03:00
Pavel Emelyanov
a547677502 test.py: Treat shortname as composite
When running tests in parallel-cases mode the test.uname must
include the case name to make different log and xml files for
different runs and to show which exact case is run when shown
by the tabular-output. At the same time the test shortname
identifies the binary with the whole test.

This patch makes class Test treat the shortname argument as
a dot-separated string where the 0th component is the binary
with the test and the rest is how test identifies itself.

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
2021-07-16 17:25:07 +03:00
Pavel Emelyanov
f188dd3396 test.py: Reformat tabluar output
This change solves several issues that would arise with the
case-by-case run.

First, the currently printed name is "$binary_name.$id". For
case-by-case run the binary name would coinside for many cases
and it will be inconvenient to identify the test case. So
the tests uname is printed instead.

Second, the tests uname doesn't contain suite name (unlike the
test binary name which does), so this patch also adds the
explicit suite name back as a separate column (like MODE)

Third, the testname + casename string length will be far above
the allocated 50 characters, so the test name is moved at the
tail of the line.

Fourth, the total number of cases is 2100+, the field of 7
characters is not enough to print it, so it's extended.

Finally the test.py output would look like this for parallel run:
================================================================================
[N/TOTAL]   SUITE    MODE   RESULT   TEST
------------------------------------------------------------------------------
[1/2108]     raft     dev   [ PASS ] etcd_test.test_progress_leader.40 0.06s
[2/2108]     raft     dev   [ PASS ] etcd_test.test_vote_from_any_state.45 0.03s
[3/2108]     raft     dev   [ PASS ] etcd_test.test_progress_flow_control.43 0.04s
[4/2108]     raft     dev   [ PASS ] etcd_test.test_progress_resume_by_append_resp.41 0.05s
[5/2108]     raft     dev   [ PASS ] etcd_test.test_leader_election_overwrite_newer_logs.44 0.04s
[6/2108]     raft     dev   [ PASS ] etcd_test.test_progress_paused.42 0.05s
[7/2108]     raft     dev   [ PASS ] etcd_test.test_log_replication_2.47 0.06s
...

or like this for regular:
================================================================================
[N/TOTAL]   SUITE    MODE   RESULT   TEST
------------------------------------------------------------------------------
[1/184]      raft     dev   [ PASS ] fsm_test.41 0.06s
[2/184]      raft     dev   [ PASS ] etcd_test.40 0.06s
[3/184]      cql      dev   [ PASS ] cassandra_cql_test.2 1.87s
[4/184]      unit     dev   [ PASS ] btree_stress_test.30 1.82s
...

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
2021-07-16 17:24:36 +03:00
Avi Kivity
ed6c01a9fa test: increase timeout to account for flat_mutation_reader_v2 tests
Since fce124bd90 ("Merge "Introduce flat_mutation_reader_v2" from
Tomasz") tests involving mutation_reader are a lot slower due to
the new API testing. On slower machines it's enough to time out.

Work underway to improve the situation, and it will also revert back
to the original timing once the flat_mutation_reader_v2 work is done,
but meanwhile, increase the timeout.

Closes #9046
2021-07-15 12:33:43 +03:00
Avi Kivity
a55b434a2b treewide: extent copyright statements to present day 2021-06-06 19:18:49 +03:00
Botond Dénes
b0056f88dc test.py: revamp coverage support
Instead of attempting to universally set the proper environment
necessary for tests to generate profiling data such that coverage.py can
process it, allow each Test subclass to set up the environment as needed
by the specific Test variant.
With this we now have support for all current test types, including cql,
cql-pytest and alternator tests.
2021-06-06 09:21:23 +03:00
Michael Livshin
3bff94cd29 test.py: refine test mode control
* Add ability to skip tests in individual modes using "skip_in_<mode>".

* Add ability to allow tests in specific modes using "run_in_<mode>".

* Rename "skip_in_debug_mode" to "skip_in_debug_modes", because there
  is an actual mode named "debug" and this is confusing.

Signed-off-by: Michael Livshin <michael.livshin@scylladb.com>
2021-05-11 18:39:10 +03:00
Botond Dénes
435d699393 test.py: add basic coverage generation support
Add support for the newly added coverage mode. When --mode=coverage,
also invoke the coverage generation report script to produce a coverage
report after having run the tests.
There are still some rough edges, alternator and cql tests don't work.
2021-05-07 15:54:49 +03:00
Avi Kivity
c2866f46b5 test: relax quota for tests on machines with small page size
8a8589038c ("test: increase quota for tests to 6GB") increased
the quota for tests from 2GB to 6GB. I later found that the increased
requirement is related to the page size: Address Sanitizer allocates
at least a page per object, and so if the page size is larger the
memory requirement is also larger.

Make use of this by only increasing the quota if the page size
is greater than 4096 (I've only seen 4096 and 65536 in the wild).
This allows greater parallelism when the page size is small.

Closes #8371
2021-03-30 12:13:42 +02:00
Avi Kivity
8785dd62cb tests: use kernel page cache
Tests are short-lived and use a small amount of data. They
are also often run repeatly, and the data is deleted immediately
after the test. This is a good scenario for using the kernel page
cache, as it can cache read-only data from test to test, and avoid
spilling write data to disk if it is deleted quickly.

Acknowledge this by using the new --kernel-page-cache option for
tests.

This is expected to help on large machines, where the disk can be
overloaded. Smaller machines with NVMe disks probably will not see
a difference.

Closes #8347
2021-03-30 12:04:55 +02:00
Konstantin Osipov
269c049a16 test.py: enable back CQL based tests
The patch which introduces build-dependent testing
has a regression: it quietly filters out all tests
which are not part of ninja output. Since ninja
doesn't build any CQL tests (including CQL-pytest),
all such tests were quietly disabled.

Fix the regression by only doing the filtering
in unit and boost test suites.

test: dev (unit), dev + --build-raft
Message-Id: <20201119224008.185250-1-kostja@scylladb.com>
2020-11-20 11:45:15 +02:00
Konstantin Osipov
5f90582362 test.py: do not run tests which are not built
Use ninja unit_test_list to find out the list of configured tests.
 If a test is not configured by configure.py, do not try to run it.
2020-11-03 21:30:08 +03:00
Konstantin Osipov
ef9c63a6d9 test.py: handle ninja mode_list failure
Print an error message if the subcommand fails.
Use a regular expression to match output.
2020-11-03 21:06:17 +03:00
Pavel Emelyanov
364ddab148 test: Do not dump test log onto terminal
When unit tests fail the test.py dump their output on the screen. This is impossible
to read this output from the terminal, all the more so the logs are anyway saved in
the testlog/ directory. At the same time the names of the failed tests are all left
_before_ these logs, and if the terminal history is not large enough, it becomes
quite annoying to find the names out.

The proposal is not to spoil the terminal with raw logs -- just names and summaries.
Logs themselves are at testlog/$mode/$name_of_the_test.log

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
Message-Id: <20201031154518.22257-1-xemul@scylladb.com>
2020-11-02 15:42:34 +02:00
Avi Kivity
83b3d3d1d1 test: increase timeout to 12000 seconds to account for slow ARM cores
Some ARM cores are slow, and trip our current timeout of 3000
seconds in debug mode. Quadrupling the timeout is enough to make
debug-mode tests pass on those machines.

Since the timeout's role is to catch rare infinite loops in unsupervised
testing, increasing the timeout has no ill effect (other than to
delay the report of the failure).

Closes #7518
2020-11-02 10:28:14 +02:00
Avi Kivity
8a8589038c test: increase quota for tests to 6GB
test.py estimates the amount of memory needed per test
in order not to overload the machine, but it underestimates
badly and so machines with many cores but not a lot of memory
fail the tests (in debug mode principally) due to running out
of memory.

Increase the estimate from 2GB per test to 6GB.

Closes #7499
2020-10-30 08:04:40 +02:00
Avi Kivity
767e30927c test: suppress ubsan true-positive on rapidjson
rapidjson has a harmless (but true) ubsan violation. It was fixed
in 16872af889.

Since rapidjson has't released since 2016, we're unlikely to see
the fix, so suppress it to prevent the tests failing. In any case
the violation is harmless.

gcc's ubsan doesn't object to the addition.

Closes #7357
2020-10-07 19:27:49 +03:00
Alejo Sanchez
eff7b63c08 Tests: add disable to configuration
For suite.yaml add an extra configuration option disable.

Tests in this list will disabled for all modes.

Signed-off-by: Alejo Sanchez <alejo.sanchez@scylladb.com>
2020-10-02 14:01:50 +02:00
Pekka Enberg
f6f9f832ee test.py: Add "--list" option to show a list of tests
This patch adds a "--list" option to test.py that shows a list of tests
instead of executing them. This is useful for people and scripts, which
need to discover the tests that will be run. For example, when Jenkins
needs to store failing tests, it can use "test.py --list" to figure out
what to archive.
Message-Id: <20200916135714.89350-1-penberg@scylladb.com>
2020-09-16 16:02:48 +02:00
Rafael Ávila de Espíndola
74ea522cd2 Use detect_stack_use_after_return=1
This works great with gcc 10.2, but unfortunately not any previous
gcc.

Signed-off-by: Rafael Ávila de Espíndola <espindola@scylladb.com>
Message-Id: <20200731161205.22369-1-espindola@scylladb.com>
2020-08-04 11:00:09 +03:00
Konstantin Osipov
e628da863d Export TMPDIR pointing at subdir of testlog/
Export TMPDIR environment variable pointing at a subdir of testlog.
This variable is used by seastar/scylla tests to create a
a subdirectory with temporary test data. Normally a test cleans
up the temporary directory, but if it crashes or is killed the
directory remains.

By resetting the default location from /tmp to testlog/{mode}
we allow test.py we consolidate all test artefacts in a single
place.

Fixes #6062, "test.py uses tmpfs"
2020-07-13 22:22:43 +03:00
Nadav Har'El
21ae457e8a test.py: print test durations
When tests are run in parallel, it is hard to tell how much time each test
ran. The time difference between consecutive printouts (indicating a test's
end) says nothing about the test's duration.

This patch adds in "--verbose" mode, at the end of each test result, the
duration in seconds (in wall-clock time) of the test. For example,

$ ./test.py --mode dev --verbose alternator
================================================================================
[N/TOTAL] TEST                                                 MODE   RESULT
------------------------------------------------------------------------------
[1/2]     boost/alternator_base64_test                         dev    [ PASS ] 0.02s
[2/2]     alternator/run                                       dev    [ PASS ] 26.57s

These durations are useful for recognizing tests which are especially slow,
or runs where all the tests are unusually slow (which might indicate some
sort of misconfiguration of the test machine).

Fixes #6759

Signed-off-by: Nadav Har'El <nyh@scylladb.com>
Message-Id: <20200706142109.438905-1-nyh@scylladb.com>
2020-07-13 17:14:44 +03:00
Pavel Emelyanov
1331623465 test.py: Don't feed fail-on-abandoned-failed-futures to unit tests
The problem is that this option is defined in seastar testing wrapper,
while no unit tests use it, all just start themselves with app.run() and
would complain on unknown option.

"Would", because nowadays every single test in it declares its own options
in suite.yaml, that override test.py's defaults. Once an option-less unit
test is added (B+ tree ones) it will complain.

The proposal is to remove this option from defaults, if any unit test will
use the seastar testing wrappers and will need this option, it can add one
to the suite.yaml.

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
Message-Id: <20200709084602.8386-1-xemul@scylladb.com>
2020-07-10 16:21:14 +02:00
Avi Kivity
8d67537178 Update seastar submodule
* seastar a6c8105443...7664f991b9 (13):
  > gate: add try_enter and try_with_gate
  > Merge "Manage reference counts in the file API" from Rafael
  > cmake: Refactor a bit of duplicated code
  > stream: Delete _sub
  > future: Add a rethrow_exception to future_state_base
  > future: Use a new seastar::nested_exception in finally
  > cmake: only apply C++ compile options to C++ language
  > testing: Enable fail-on-abandoned-failed-futures by default
  > future: Correct a few hypercorrect uses of std::forward
  > futures_test: Test using future::then with functions
  > Merge "io-queue: A set of cleanups collected so far" from Pavel E
  > tmp_file: Replace futurize_apply with futurize_invoke
  > future: Replace promise::set_coroutine with forward_state_and_schedule

Contains update to tests from Rafael:

tests: Update for fail-on-abandoned-failed-futures's new default

This depends on the corresponding change in seastar.

Signed-off-by: Rafael Ávila de Espíndola <espindola@scylladb.com>
2020-06-23 19:39:54 +03:00
Botond Dénes
94e00186b6 test.py: centralize the determining whether stdout is a tty
Currently test.py has three different places it checks whether stdout is
a tty. This patch centralizes these into a single global variable. This
ensures consistency and makes it easier to override it later with a
command-line switch, should we want to.

Signed-off-by: Botond Dénes <bdenes@scylladb.com>
Message-Id: <20200529101124.123925-1-bdenes@scylladb.com>
2020-05-29 14:50:43 +02:00
Botond Dénes
caf21d7db9 test.py: disable boost test's colored output when stdout is not a tty
Boost test uses colored output by default, even when the output of the
test is redirected to a file. This makes the output quite hard to read
for example in Jenkins. This patch fixes this by disabling the colored
output when stdout is not a tty. This is in line with the colored output
of configure.py itself, which is also enabled only if stdout is a tty.

Signed-off-by: Botond Dénes <bdenes@scylladb.com>
Message-Id: <20200526112857.76131-1-bdenes@scylladb.com>
2020-05-27 14:20:12 +03:00
Piotr Sarna
1906e35d12 test: add --skip option
The --skip option allows providing a pattern for tests which
will not be run. Example usage:
./test.py --mode dev --skip alternator

Tests: unit(dev), with `--skip alternator` and with no parameters
Message-Id: <6970134d2bc15314f0e4944f3b167d0e105ea69b.1589811943.git.sarna@scylladb.com>
2020-05-19 08:14:32 +03:00
Benny Halevy
94a558e9a8 test.py: print test command line and env to log
Print the test command line and the UBSAN and ASAN env settings to the log
so the run can be easily reproduced (optionally with providing --random-seed=XXX
that is printed by scylla unit tests when they start).

Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
Message-Id: <20200513110959.32015-1-bhalevy@scylladb.com>
2020-05-13 14:27:15 +03:00
Nadav Har'El
858a12755b test.py: run Alternator test with the correct Scylla binary
The Alternator test's run script, test/alternator/run, runs Scylla.
By default, it chooses the last built Scylla executable build/*/scylla.

However, test.py has a "mode" option, that should be able to choose which
build mode to run. Before this patch, this mode option wasn't honored by
the Alternator test, so a "test.py alternator/run" would run the same
Scylla binary (the one last built) three times, instead of running each
of the three build modes.

We fix this in this patch: test.py now passes the "SCYLLA" environment
variable to the test/alternator/run script, indicating the location of the
Scylla binary with the appropriate build mode. The script already supported
this environment variable to override its default choice of Scylla binary.

In test.py, we add to the run_test() function an optional "env" parameter
which can be used to pass additional environment variables to the test.

Fixes #6286

Signed-off-by: Nadav Har'El <nyh@scylladb.com>
Message-Id: <20200427131958.28248-1-nyh@scylladb.com>
2020-04-27 16:23:58 +03:00
Nadav Har'El
0cccb5a630 test.py: add xunit XML output file for "Run" tests
Assumes that "Run" tests can take the --junit-xml=<path> option, and
pass it to ask the test to generate an XML summary of the run to a file
like testlog/dev/xml/run.1.xunit.xml.

This option is honored by the Alternator tests.

Signed-off-by: Nadav Har'El <nyh@scylladb.com>
2020-04-12 16:26:50 +03:00
Nadav Har'El
0ae3136900 test.py: add new test type "Run"
This patch adds a new test type, "Run". A test subdirectory of type "Run"
has a script called "run" which is expected to run all the tests in that
directory.

This will be used, in the next patch, by the Alternator functional tests.
These tests indeed have a "run" script, which runs Scylla and then runs
*all* of Alternator's tests, finishing fairly quickly (in less than a
minute). All of that will become one test.py test.

Signed-off-by: Nadav Har'El <nyh@scylladb.com>
2020-04-12 16:26:50 +03:00
Nadav Har'El
36e44972f1 test.py: flag for aborting tests with SIGTERM, not SIGKILL
Today, if test.py is interrupted with SIGINT or SIGTERM, the ongoing test
is killed with SIGKILL. Some types of tests - such as Alternator's test -
may depend on being killed politely (e.g., with SIGTERM) to clean up
files.

We cannot yet change the signal to SIGTERM for all tests, because Seastar
tests often don't deal well with signals, but we can at least add a flag
that certain test types - that know they can be killed gently - will use.

Signed-off-by: Nadav Har'El <nyh@scylladb.com>
2020-04-12 16:26:50 +03:00
Pavel Emelyanov
7af3bbd57b test.py: Mark some tests as "run_first"
Those tests take long time to finish, so it makes sense to start
them earlier than others.

The provided list of long tests consists of those running more
than 10 minutes in debug mode.

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
2020-03-19 12:52:18 +03:00
Pavel Emelyanov
59bc116695 test.py: Generate list with short names
The list will be sorted a bit differently, for this I will need
the shortname at once

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
2020-03-19 11:46:02 +03:00
Pavel Emelyanov
30c540aae1 test.py: Rename "long" to "skip_in_debug_mode"
The "long" test will mean that it is to be started first, not
skipped, so rename "long" to avoid additional confusion

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
2020-03-19 11:45:55 +03:00
Konstantin Osipov
9c009441e0 test.py: do not override environment options
Do not reset user-defined environment options for ASAN with test.py
flags.
Message-Id: <20200306135714.3380-1-kostja@scylladb.com>
2020-03-09 14:56:09 +02:00
Konstantin Osipov
848195125c test.py: check test xml output
Check that XML output of a test is valid and warn otherwise.

The following tests currently produce a warning:
boost/multishard_mutation_query_test

Message-Id: <20200305213501.52279-2-kostja@scylladb.com>
2020-03-06 10:05:28 +02:00
Konstantin Osipov
48f09b95d0 test.py: remove log output on success unless -s is specified
Log output is saved by the build system and can take a lot of
space. Remove it unless -s is specified.
2020-03-03 13:59:14 +03:00
Konstantin Osipov
ae2820a1c7 test.py: do not store entire log output in junit report.
This makes report very heavy and is suspected to corrupt
XML output.
2020-03-03 13:59:14 +03:00
Konstantin Osipov
7b7462b49f test.py: fix a bug with an incorrect glob pattern
On start, test.py cleans up testlog directory.
The cleanup file search pattern was shell style, not python
glob style, which led to .log files being left around
between runs.
Message-Id: <20200212204047.22398-9-kostja@scylladb.com>
2020-02-16 11:22:29 +02:00
Konstantin Osipov
70fcbd8e32 test.py: print test invocation failure to test log
Capture test invocation failure in the test log.
Remove dead code lingering from introduction of log output.
Message-Id: <20200212204047.22398-6-kostja@scylladb.com>
2020-02-15 17:19:28 +02:00
Konstantin Osipov
851b2d652e test.py: start run_test() by opening test log file
Always open the log file first, this will be necessary to append
output to it in case the test timed out or didn't start.
Message-Id: <20200212204047.22398-5-kostja@scylladb.com>
2020-02-15 17:19:28 +02:00
Konstantin Osipov
22a050250e test.py: if a test fails, print it on its own line, even in compact mode
To be able to easily see what tests have failed as they run,
print failed tests on their own line even if --verbose switch is off.
Message-Id: <20200212204047.22398-4-kostja@scylladb.com>
2020-02-15 17:19:28 +02:00
Konstantin Osipov
8eb127279e test.py: convert cookie to TabularConsoleOutput class
test.py used a functional programming cookie pattern to
carry tabular console output state, convert this cookie
to an object.
In order to make console output more pretty we'll need to
add more state to it, and keeping this state in a tuple
would be too messy.
Message-Id: <20200212204047.22398-3-kostja@scylladb.com>
2020-02-15 17:19:28 +02:00
Avi Kivity
501b24cad3 test.py: use command line option in preference to environment variable when calling a test
Command line options are printed out, so if a user cuts-and-pastes a
command line they will get a run that is more similar to the one that
the test executed.
Message-Id: <20200202133209.209608-1-avi@scylladb.com>
2020-02-04 10:20:28 +02:00
Avi Kivity
2816404f57 test.py: documented exit code value
Document our chosen exit failure code value and its relationship
to git bisect.
Message-Id: <20200202134223.210578-1-avi@scylladb.com>
2020-02-03 00:58:58 +02:00