← Back to team overview

maria-developers team mailing list archive

Improving `source` in mysqltest


Hello mariadb developers!
This year we have a student on mysqltest parser improvements, mentored by
me and @serg. The major improvement will be proper expressions support,
which you'll soon receive an email about.

Another a bit more minor-ish improvement we want our student Igor to make
is parameters support for source command, which I want to ask you about,
which way is better to implement.
It's quite spread in the tests to parametrize source with variables, for

> --let SEARCH_FILE=$MYSQLTEST_VARDIR/log/mysqld.1.err
> --let SEARCH_PATTERN= This connection closed normally without
> authentication
> --source include/search_pattern_in_file.inc

Another example is period/create_triggers.inc.

So, we want make it possible to write

> --source do_something.inc A=1 B=foobar

And the question is, how should it behave.

One way is to make it a strict equivalent of

> let A=1;
> let B=foobar;
> source do_something.inc;

This allows to reuse previously set values, for example:

> --source do_something.inc A=1 B=foobar

> ...

> --source do_something.inc A=2

Which literally means

> let A=1;
> let B=foobar;
> --source do_something.inc;


let A=2;
> --source do_something.inc;

Another way is to make it work like local arguments, so the arguments are
put in the stack, and as a result

> let A=qwe;
> --source do_something.inc A=1 B=foobar
> --echo $A;

outputs qwe.

What do you think of this, what's more suitable for us?
This is an important question, since all of us are using mysqltest, and we
probably wouldn't change the behavior ever later.

Yours truly,
Nikita Malyavin