[MDEV-11619] mtr: environment MTR_MEM conflicts with --mem Created: 2016-12-21  Updated: 2017-02-27  Resolved: 2017-02-27

Status: Closed
Project: MariaDB Server
Component/s: Tests
Affects Version/s: 10.0.28, 10.1.20, 10.2.3
Fix Version/s: 10.0.30, 10.1.22, 10.2.5

Type: Bug Priority: Blocker
Reporter: Daniel Black Assignee: Daniel Black
Resolution: Fixed Votes: 0
Labels: community, contribution, foundation, patch

Sprint: 5.5.55, 10.0.30

 Description   

Since 716621db3f3055781e24f561325cec6eac181717, opt_mem is
a pure flag. However it is assigned to the value of $MTR_MEM.

This leads to conflicts when MTR_MEM=/xxx/yy ./mtr --mem is
invoked. Here the --mem option overrided opt_mem leaving the
default path to be chosen rather than $MTR_MEM.



 Comments   
Comment by Elena Stepanova [ 2016-12-26 ]

danblack, serg,
Does anyone have any idea why 716621db3f3055781e24f561325cec6eac181717 was needed at all, what was wrong with the optional value?

Comment by Daniel Black [ 2017-01-08 ]

I couldn't work out why it was applied either.

Comment by Elena Stepanova [ 2017-01-10 ]

So, shall we just revert it?

Comment by Daniel Black [ 2017-01-10 ]

worked it out, using MTR_MEM environment variable and --mem caused MTR_MEM to be ignored.

The new PR attached is tested as follows:

MTR_MEM value is used

cd mysql-test; rm -rf var;  MTR_MEM=/run/user/1000 ./mtr --mem)
Logging: /home/dan/repos/mariadb-server/mysql-test/mysql-test-run.pl  --mem
vardir: /home/dan/repos/build-mariadb-server-10.2/mysql-test/var
Removing old var directory...
Creating var directory '/home/dan/repos/build-mariadb-server-10.2/mysql-test/var'...
 - symlinking 'var' to '/run/user/1000/var_auto_e3Ac'

MTR_MEM value used

 (cd mysql-test; rm -rf var;  MTR_MEM=/run/user/1000 ./mtr )
Logging: /home/dan/repos/mariadb-server/mysql-test/mysql-test-run.pl
vardir: /home/dan/repos/build-mariadb-server-10.2/mysql-test/var
Removing old var directory...
Creating var directory '/home/dan/repos/build-mariadb-server-10.2/mysql-test/var'...
 - symlinking 'var' to '/run/user/1000/var_auto_FiMv'

No MTR_MEM used

(cd mysql-test; rm -rf var;  ./mtr )
Logging: /home/dan/repos/mariadb-server/mysql-test/mysql-test-run.pl
vardir: /home/dan/repos/build-mariadb-server-10.2/mysql-test/var
Removing old var directory...
Creating var directory '/home/dan/repos/build-mariadb-server-10.2/mysql-test/var'...
Checking supported features...

--mem argument used

(cd mysql-test; rm -rf var;  MTR_MEM=/tmp/ignore_me ./mtr --mem=/run/user/1000  )
Logging: /home/dan/repos/mariadb-server/mysql-test/mysql-test-run.pl  --mem=/run/user/1000
vardir: /home/dan/repos/build-mariadb-server-10.2/mysql-test/var
Removing old var directory...
Creating var directory '/home/dan/repos/build-mariadb-server-10.2/mysql-test/var'...
 - symlinking 'var' to '/run/user/1000/var_auto_x7cj'

Default mtr paths tested and symlinks aren't used.

(cd mysql-test; rm -rf var;  ./mtr --mem  )
Logging: /home/dan/repos/mariadb-server/mysql-test/mysql-test-run.pl  --mem
vardir: /home/dan/repos/build-mariadb-server-10.2/mysql-test/var
Removing old var directory...
Creating var directory '/home/dan/repos/build-mariadb-server-10.2/mysql-test/var'...
 - symlinking 'var' to '/dev/shm/var_auto_Ok_X'

Comment by Elena Stepanova [ 2017-02-19 ]

https://github.com/MariaDB/server/commit/5e42c958a56f038c51952ddb9464686c1939201b

Comment by Elena Stepanova [ 2017-02-20 ]

I've found the reason why (probably) --mem was made a pure flag. The provided patch breaks common operation.

If MTR is envoked so that --mem is immediately followed by command-line arguments (test names), the first test is considered to be the value of mem option rather than a test name. The "value" is later ignored because the location of course does not exist, but the test is not executed.

Example:

perl ./mysql-test-run.pl --mem 1st alias
...
==============================================================================
 
TEST                                      RESULT   TIME (ms) or COMMENT
--------------------------------------------------------------------------
 
worker[1] Using MTR_BUILD_THREAD 300, with reserved ports 16000..16019
main.alias                               [ pass ]     79
--------------------------------------------------------------------------
The servers were restarted 0 times
Spent 0.079 of 5 seconds executing testcases

Comment by Daniel Black [ 2017-02-21 ]

thanks elenst, fixed in pr #317

Comment by Elena Stepanova [ 2017-02-21 ]

danblack, see my comment in the PR.

Comment by Elena Stepanova [ 2017-02-27 ]

The change is partially reverted, --mem is a pure flag again.

https://github.com/MariaDB/server/commit/b54566d73bb96ef9eb7d734742d3743fb3369a40

Generated at Thu Feb 08 07:51:22 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.