Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

serg/mtr-bash-completion enhancement #63

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

grooverdan
Copy link
Member

Handle out of tree builds

Handle mysql-test/mtr completions where mtr isn't the current directory

Order "suite" before "storage,plugins" _mtr_complete_testnames so that
"rpl" picks up rpl suite rather than the tokudb rpl suite.

Handle out of tree builds

Handle mysql-test/mtr completions where mtr isn't the current directory

Order "suite" before "storage,plugins" _mtr_complete_testnames so that
"rpl" picks up rpl suite rather than the tokudb rpl suite.
@grooverdan grooverdan requested a review from vuvova July 19, 2021 04:04
@vuvova
Copy link
Member

vuvova commented Jul 23, 2021

$ mysql-test/mtr
**** ERROR **** You must start mysql-test-run from the mysql-test/ directory

Why do you need completion "where mtr isn't the current directory" ?

@grooverdan
Copy link
Member Author

$ mysql-test/mtr
**** ERROR **** You must start mysql-test-run from the mysql-test/ directory

Why do you need completion "where mtr isn't the current directory" ?

This works on out of tree builds starting from the top level build directory.

Out of tree builds can start from anywhere:

~/repos 
$ build-mariadb-server-10.2_second/mysql-test/mtr  --mem main.select
Logging: /home/dan/repos/mariadb-server-10.2_second/mysql-test/mysql-test-run.pl  --mem main.select
vardir: /home/dan/repos/build-mariadb-server-10.2_second/mysql-test/var
Checking leftover processes...
Removing old var directory...
Creating var directory '/home/dan/repos/build-mariadb-server-10.2_second/mysql-test/var'...
 - symlinking 'var' to '/dev/shm/var_auto__hqx'
Checking supported features...
MariaDB Version 10.2.39-MariaDB
 - SSL connections supported
 - binaries built with wsrep patch
Collecting tests...
Installing system database...

==============================================================================

TEST                                      RESULT   TIME (ms) or COMMENT
--------------------------------------------------------------------------

worker[1] Using MTR_BUILD_THREAD 300, with reserved ports 16000..16019
main.select                              [ pass ]    940
--------------------------------------------------------------------------
The servers were restarted 0 times
Spent 0.940 of 9 seconds executing testcases

Completed: All 1 tests were successful.

testnames=$( cd $dir && echo *.test | sed -e 's/\.test\>//g' )
dir="$1"
[ -d "$dir"/t ] && dir="$dir"/t
testnames=$( cd "$dir" && echo *.test | sed -e 's/\.test\>//g' )
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did you actually test it with a path that contains spaces? Or you've quoted paths just in case, without testing?

}
_mtr_all_suites ()
{
suites=$(find suite ../{storage,plugin}/*/mysql-test -type d -exec find '{}' -maxdepth 1 -name '*.test' -print -quit \; | sed -E 's@/(t/)?[^/]+$@@; s@^(suite|.*/mysql-test)/@@'|sort -u)
suites=$(find "$sourcetestdir"/suite "$sourcetestdir"/../{storage,plugin}/*/mysql-test -type d -exec find '{}' -maxdepth 1 -name '*.test' -print -quit \; | sed -E "s@^$sourcetestdir/(suite|\.\./storage|\.\./plugin)/@@"'; s@/mysql-test@@; s@(/t)?/[^/]+\.test$@@'|sort -u)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this sed line looks suspicious. I'd expect something like

sed -E "s@^$sourcetestdir/(suite|\.\./(storage|plugin)/mysql-test)/@@"'; s@(/t)?/[^/]+\.test$@@'

}
_mtr_complete()
{
[ -x ./mtr ] || return
[ -d main ] && main=main || main=.
sourcetestdir=$(sed -n -e "/^chdir/s/[^']*'\(.*\)');$/\1/p" < "$1")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that works only for out-of-source mtr, right? what about "normal" in-source mysql-test-run.pl ?

@fauust fauust force-pushed the master branch 2 times, most recently from 77b6092 to ed394b7 Compare April 28, 2022 21:12
@fauust fauust force-pushed the master branch 13 times, most recently from 7c3b2ca to cd5321a Compare May 9, 2022 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants