Commit graph

1472 commits

Author SHA1 Message Date
Vladislav Vaintroub
5abf0fea51 mtr - synchronize output between different threads on Windows.
An attempt to fix lost output sometimes seen on buildbot.
2024-03-18 22:03:21 +01:00
Sergei Golubchik
ac0ce44519 ./mtr --skip-not-found should skip combinations too
With the result like

encryption.innochecksum 'debug'   [ skipped ] combination not found

instead of

*** ERROR: Could not run encryption.innochecksum with 'debug' combination(s)
2024-01-08 13:57:51 +01:00
Sergei Golubchik
78cd45b29a ./mtr --skip-not-found
New mtr option --skip-not-found makes it to show not found tests
as skipped

main.a                                   [ skipped ]  not found

(but only if the test was specified with the suite name)
and not error out early with

mysql-test-run: *** ERROR: Could not find 'a' in 'main' suite

This is useful in buildbot, on builders that generate the list
of tests dynamically.
2023-10-23 17:40:03 +02:00
Vladislav Vaintroub
f197f9a527 MDEV-32387 Windows - mtr output on is messed up with large MTR_PARALLEL.
Windows C runtime does not implement line buffering mode for stdio.

This sometimes makes output from different tests interleaved in MTR
MTR relies on this buffering (lines won't  output until "\n") to correctly
work in parallel scenarios.

Implement do-it-yourself line buffering on Windows, to workaround.
2023-10-10 20:53:00 +02:00
Sergei Golubchik
04b7b3a0ca mtr bug: even if the test is skipped, process combinations
otherwise, e.g.

  ./mtr main.mysql_install_db_win_admin,innodb

results in sporadic

mysql-test-run: *** ERROR: Could not run main.mysql_install_db_win_admin with 'innodb' combination(s)

depending on whether it'll process the skip (not windows admin)
or the innodb.combinations first (if skip is processed first,
innodb combination wasn't, making the further code think that the test
doesn't have innodb combination)
2023-09-29 10:44:09 +02:00
Aleksey Midenkov
848b3af816 MDEV-30836 MTR MSYS2 fix attempt
MSYS2 is basically Cygwin, except it has more easy installation (but
with tools which are not used) and it has some more control of path
conversion via MSYS2_ARG_CONV_EXCL and MSYS2_ENV_CONV_EXCL. So it
should be more Windows-friendly than Cygwin.

Installation

Similar to Cygwin, except installing patch requires additional command
run from shell:

    pacman -S patch

MSYS2 still doesn't work as it returns wierd "Bad address" when
exec-ing forked process from create_process(). Same exec from
standalone perl -e runs just fine... :(
2023-09-05 17:43:15 +10:00
Aleksey Midenkov
640cd404af MDEV-30836 MTR Cygwin fix
Cygwin is more Unix-oriented. It does not treat \n as \r\n in regexps
(fixed by \R), it supplies Unix-style paths (fixed by
mixed_path()). It does some cleanup on paths when running exe, so it
will be different in exe output (like with $exe_mysqld, comparing
basename() is enough).

Cygwin installation

1. Just install latest perl version (only base package) and
   patchutils from cygwin-setup;
2. Don't forget to add c:\cygwin64\bin into system path
   before any other perl flavors;
3. There is path-style conflict (see below), you must replace
   c:\cygwin64\bin\sh.exe with the wrapper. Run MTR with
   --cygwin-subshell-fix=do for that. Make sure you are running Cygwin
   perl for the option to work.
4. Restart buildbot via net stop buildbot; net start buildbot

Path-style conflict of Cygwin-ish Perl

Some exe paths are passed to mysqltest which are executed by a native
call. This requires native-style paths (\-style). These exe paths also
executed by Perl itself. Either by MTR itself which is not so
critical, but also by tests' --perl blocks which is impossible to
change. And if Perl detects shell-expansion or uses pipe command it
passess this exe path to /bin/sh which is Cygwin-compiled bash that
cannot work with \-style (or at least in -c processing). Thus we require
\-style on some parts of MTR execution and /-style on another parts.

The examples of tests which cover these different parts are:

    main.mysqlbinlog_row_compressed \
    main.sp_trans_log

That could be great to force Perl to use something different from
/bin/sh, but unfortunately /bin/sh is compiled-in into binary. So the
only solution left is to overwrite /bin/sh with some wrapper script
which passes the command to cmd.exe instead of bash.
2023-09-05 17:43:15 +10:00
Aleksey Midenkov
4ed583031a MDEV-30836 MTR Cygwin subshell wrapper fix
See "Path-style conflict" in "MDEV-30836 MTR Cygwin fix" for explanation.

To install subshell fix use --cygwin-subshell-fix=do
To uninstall use --cygwin-subshell-fix=remove

This works only from Cygwin environment. As long as perl on PATH is
from Cygwin you are on Cygwin environment. Check it with

     perl --version

     This is perl 5, version 36, subversion 1 (v5.36.1) built for
     x86_64-cygwin-threads-multi
2023-09-05 17:43:15 +10:00
Aleksey Midenkov
92fb31f0b1 MDEV-30836 MTR misc improvements
1. Better logging and error reporting;
2. Worker process title;
3. Some comments

Worker process title example:

 446209 pts/2    R+     0:00 mysql-test-run.pl worker[01] :42146 -> :35027 versioning.view
 446210 pts/2    S+     0:00 mysql-test-run.pl worker[02] :42150 -> :35027 versioning.view
 446211 pts/2    S+     0:00 mysql-test-run.pl worker[03] :42154 -> :35027 versioning.foreign
 446212 pts/2    S+     0:00 mysql-test-run.pl worker[04] :42160 -> :35027 versioning.autoinc

Manager-worker localhost socket connection is represented by a pair :source -> :destination ports.

-vv Now adds --verbose to mysqltest as well, see var/mysqltest.log for the output.
2023-09-05 17:17:44 +10:00
Oleksandr Byelkin
c062b351f0 Make vgdb call more universal. 2023-08-21 13:00:34 +02:00
Sergei Golubchik
d214628af4 mtr: fix the help text for debuggers 2023-06-27 17:25:20 +02:00
Sergei Golubchik
aca641da28 mtr: handle the case of existing but unreadable /proc/cpuinfo 2023-06-02 17:51:40 +02:00
Oleksandr Byelkin
3d27f6d7f4 Merge branch '10.3' into 10.4 2023-04-21 09:10:58 +02:00
Vladislav Vaintroub
f812f8e1ab MDEV-30475 Windows, mtr - Remove outdated instructions on how to install post-mortem debugger
Also, use standard C:\symbols location for OS debugging symbols cache,
rather than own invention C:\cdb_symbols.
2023-01-26 12:32:15 +01:00
Marko Mäkelä
fb0808c450 Merge 10.3 into 10.4 2023-01-03 16:10:02 +02:00
Marko Mäkelä
9f8fc983d5 MDEV-30242 MTR fails to report stack traces of all threads by default
An unfortunate change to the default behavior of the handling of
core dumps was implemented in
commit e9be5428a2
by making MTR_PRINT_CORE=small the default value, that is, to
only display the stack trace of one thread in crash reports.
Many if not most failures that occur in regression tests are
sporadic and involve race conditions or deadlocks. To be able to
analyze such failures, having the stack traces of all active threads
is a must, because CI environments typically do not save any core dumps.

While the environment variable MTR_PRINT_CORE could be set in CI
environments to compensate for the unfortunate change, it is better
to revert to the old default (dumping all threads) so that
no explicit action will be required from maintainers of independent
CI systems. In that case, if something fails once in a blue moon,
we can have some hope of diagnosing it based on the output.

We fix this regression by defaulting the unset environment variable
MTR_PRINT_CORE to "medium".
2022-12-16 09:59:09 +02:00
Marko Mäkelä
fdf43b5c78 Merge 10.3 into 10.4 2022-12-13 11:37:33 +02:00
Anel Husakovic
3d5ce0430b MDEV-29348 rpl.rpl_rewrt_db test fails with [gdb,manual-gdb] with wrong parsing
Reviewer: <serg@mariadb.com>
Closes PR #2244
2022-11-28 15:10:30 +01:00
Oleksandr Byelkin
65e8506ca9 Merge branch '10.3' into bb-10.4-release 2022-08-10 12:21:08 +02:00
Sergei Golubchik
122742897b my_safe_process: try to kill the process softly first
first SIGTERM and if the process didn't die in 10 seconds, SIGKILL it.

This allows various tools like `rr`, `gcov`, `gprof`, etc to flush
their data to disk properly
2022-08-10 09:14:17 +02:00
Oleksandr Byelkin
3bb36e9495 Merge branch '10.3' into 10.4 2022-07-27 11:02:57 +02:00
Aleksey Midenkov
1bdcffb028 MDEV-29025 Refactoring: moved out core_wanted() out of mysql-test-run.pl 2022-07-18 23:16:17 +03:00
Aleksey Midenkov
e9be5428a2 MDEV-28931 MTR prints detailed stack trace unconditionally
66832e3a introduced change that prints core dumps in very detailed
format. That's completely out of user-friendliness but serves as a
measure for debugging hard-reproducible bugs.

The proper way to implement this:

  1. it must be controlled by command-line and environment variable;
  2. detailed traces must be default for buildbots only, for user
     invocations normal stack traces should be printed.

Options for control are: MTR_PRINT_CORE and --print-core that accept
the following values:

  no	         Don't print core
  short	       	 Print stack trace of failed thread
  medium	 Print stack traces of all threads
  detailed       Print all stack traces with debug context
  custom:<code>  Use debugger commands <code> to print stack trace

Default setting is: short (see env_or_default() call in pre_setup())

For environment variable wrong values are silently ignored (falls back
to default setting, see env_or_default()).

Command-line option --print-core (or -C) overrides environment
variable. Its default value is 'short' if not specified explicitly
(same env_or_default() call in pre_setup()). Explicit values are
checked for validity.

--print-method option can specify by which debugger we print
cores. For Windows there is only one choice: cdb. For Unix the values
are: gdb, dbx, lldb, auto. Default value is: auto

In 'auto' we try to use all possible debuggers until success.
2022-07-18 23:16:17 +03:00
Aleksey Midenkov
220fb6797b MDEV-28931 Debugger.pm readability fix
setup_boot_args(), setup_client_args(), setup_args() traversing
datastructures on each invocation. Even if performance is not
important to perl script (though it definitely saves some CO2), this
nonetheless provokes some code-reading questions. Reading and
debugging such code is not convenient.

The better way is to prepare all the data in advance in an easily
readable form as well as do the validation step before any further
processing.

Use mtr_report() instead of die() like the other code does.

TODO: do_args() does even more data processing magic. Prepare that
data according the above strategy in advance in pre_setup() if possible.
2022-07-18 23:16:17 +03:00
Aleksey Midenkov
ce7820eb83 MDEV-28931 --verbose option is too verbose
GetOpt::Long bundling option for convenient one-char verbosity levels:

  -v    General verbosity (file and execute operations)
  -vv   High verbosity (algorithmic considerations)
  -vvv  Debug verbosity (anything else)
2022-07-18 23:16:17 +03:00
Aleksey Midenkov
83f7d25c44 MDEV-28931 Cleanup: try GDB to print core first
Do we still need this Sun Studio hack?
2022-07-18 23:16:17 +03:00
Sergei Golubchik
a70a1cf3f4 Merge branch '10.3' into 10.4 2022-05-08 23:03:08 +02:00
Sergei Golubchik
6f6c74b0d1 Merge branch '10.2' into 10.3 2022-04-21 10:05:50 +02:00
Daniel Black
66832e3a64 mtr: extend gdb backtace info
bt full - to include args and locals.

set print sevenbit on
  - it is more useful to be able to see the exact bytes
    (in case something is dumped as a string and not hexadecimal digits)
set print static-members off
  - there are many interesting (non-const) static members
set frame-arguments all
  - even non-printables are useful to see.

Let's make our bb logs give a little bit more detail on those
hard to reproduce bugs.

Tests on rhel7's gdb-7.6.1-120.el7
2022-04-14 19:55:26 +10:00
Marko Mäkelä
9c6135e81f Merge 10.3 into 10.4 2022-03-15 08:10:35 +02:00
Sergei Golubchik
f217c76189 mtr: fix --source lines detection
mysqltest allows leading spaces before `--`, so mtr should too
2022-03-14 08:55:59 +01:00
Oleksandr Byelkin
a576a1cea5 Merge branch '10.3' into 10.4 2022-01-30 09:46:52 +01:00
Oleksandr Byelkin
41a163ac5c Merge branch '10.2' into 10.3 2022-01-29 15:41:05 +01:00
Sergei Golubchik
a88a4336fc mtr failed to detect when a combination is forced
mtr detects a forced combination if the command line for a test already
includes all options from this combination. options are stored in a perl
hash as (key,value) pairs.

this breaks if the command line has two options with the same name,
like --plugin-load-add=foo --plugin-load-add=bar, and the combination
forces plugin foo.

In particular, this resulted in warnings when running
federated.federatedx_versioning test
2022-01-14 22:16:39 +01:00
Marko Mäkelä
47ab793d71 Merge 10.3 into 10.4 2021-11-09 08:40:14 +02:00
Marko Mäkelä
524b4a89da Merge 10.2 into 10.3 2021-11-09 08:26:59 +02:00
Marko Mäkelä
026984c360 MDEV-26949 --debug-gdb installs redundant signal handlers
There is a server startup option --gdb a.k.a. --debug-gdb that requests
signals to be set for more convenient debugging. Most notably, SIGINT
(ctrl-c) will not be ignored, and you will be able to interrupt the
execution of the server while GDB is attached to it.

When we are debugging, the signal handlers that would normally display
a terse stack trace are useless.

When we are debugging with rr, the signal handlers may interfere with
a SIGKILL that could be sent to the process by the environment, and ruin
the rr replay trace, due to a Linux kernel bug
https://lkml.org/lkml/2021/10/31/311

To be able to diagnose bugs in kill+restart tests, we may really need
both a trace before the SIGKILL and a trace of the failure after a
subsequent server startup. So, we had better avoid hitting the problem
by simply not installing those signal handlers.
2021-11-01 10:29:58 +02:00
Marko Mäkelä
36f8cca6f3 Merge 10.3 into 10.4 2021-10-21 18:06:31 +03:00
Marko Mäkelä
f9b856b052 Merge 10.2 into 10.3 2021-10-21 17:39:34 +03:00
Sergei Krivonos
7d6617e966 MDEV-19129: Xcode compatibility update: mysql-test-run.pl: rename $opt_vs_config to $multiconfig to use with other cmake multiconfig generators 2021-10-21 16:48:00 +03:00
Vladislav Vaintroub
25a5ce367b Merge branch '10.3' into 10.4 2021-09-24 12:29:57 +02:00
Vladislav Vaintroub
ca7046dc19 MDEV-11499 mysqltest, Windows : improve diagnostics if server fails to shutdown
Create minidump when server fails to shutdown. If process is being
debugged, cause a debug break.

Moves some code which is part of safe_kill into mysys, as both safe_kill,
and mysqltest produce minidumps on different timeouts.

Small cleanup in wait_until_dead() - replace inefficient loop with a single
wait.
2021-09-24 11:49:28 +02:00
Marko Mäkelä
0464761126 Merge 10.3 into 10.4 2021-08-31 09:22:21 +03:00
Marko Mäkelä
e835cc851e Merge 10.2 into 10.3 2021-08-31 08:36:59 +03:00
Sergei Golubchik
600e494906 mtr: fix the check where a combination is pre-selected
if all options from a combination from the combinations file are already
present in the server's list of options, then don't try to run tests
in other combinations from this file.

old behavior was: if at least one option from a combination is
already present in the list...
2021-08-29 17:32:30 +02:00
Oleksandr Byelkin
7841a7eb09 Merge branch '10.3' into 10.4 2021-07-31 22:59:58 +02:00
Sergei Golubchik
6190a02f35 Merge branch '10.2' into 10.3 2021-07-21 20:11:07 +02:00
Sergei Golubchik
621fae3cbc MDEV-25802 mtr: race condition if the test quickly restarts twice
part II

need to tell SafeProcess not to collect the exited mysqld
in sleep_until_file_created(), so that it would be found in the
later wait_any_timeout() in run_testcase()

Removed a strange condition in SafeProcess::wait_one()
that treated return value of -1 from waitpid() as "process exists"
instead of as "no such child process" (see `perldoc -f waitpid`)
2021-07-06 16:12:13 +02:00
Sergei Golubchik
1223cfe1d3 MDEV-25802 mtr: race condition if the test quickly restarts twice
expect file is always removed before starting a server.
So if it exists here, it means the server started successfully,
mysqltest continued executing the test, created a new expect file,
and shut down the server. All while we were waiting for the server
to start.

In other words, if the expect file exists, the server did actually start.
Even if it isn't running now.

This fixes occasional failures of innodb.log_corruption (in 10.6)
2021-07-06 16:12:13 +02:00
Daniel Black
2301093f8f MDEV-25894: support AIX as a platform in mtr
Parital backport of 48938c57c7
so platform dependent AIX tests can be done.
2021-07-02 17:17:19 +10:00