[MDEV-19624] A way to have failing tests (basically inverting test results) Created: 2019-05-28  Updated: 2021-10-05  Resolved: 2021-10-05

Status: Closed
Project: MariaDB Server
Component/s: Scripts & Clients
Affects Version/s: None
Fix Version/s: N/A

Type: Bug Priority: Minor
Reporter: Noel Kuntze Assignee: Unassigned
Resolution: Not a Bug Votes: 0
Labels: None


 Description   

It'd be great if mysqltest could have failing tests report as ok and working tests as not ok.
Meaning, I want to have a test that makes sure that, for example, the query "SELECT * FROM passwords" fails with a specific error and does not succeed.

Sadly, there's only the issue type Bug. So this is what it's filed under. Please let me know if there's a better place for such suggestions or feature requests.



 Comments   
Comment by Elena Stepanova [ 2019-05-28 ]

MTR can very well do that. The test below ensures that the query fails with "Table 'test.passwords' doesn't exist".

--error ER_NO_SUCH_TABLE
select * from passwords;

Feature requests are filed with the type 'Task'.

Comment by Noel Kuntze [ 2019-05-28 ]

Thank you. Is there a way I can make mysqltest do that?

Comment by Elena Stepanova [ 2019-05-28 ]

I don't understand the question. Make mysqltest do what? It is an MTR test case, you put it in a file and run it as a usual MTR test.

Comment by Noel Kuntze [ 2019-05-28 ]

I am asking if I can implement the aforementioned requirement with the syntax mysqltest accepts (which is, as far as I know, pure SQL).

Comment by Elena Stepanova [ 2019-05-28 ]

It is a syntax which mysqltest accepts. There is a lot more in mysqltest than just pure SQL.

Comment by Elena Stepanova [ 2019-05-28 ]

jacob.moorman,

MTR (the test framework), including mysqltest (the client program which actually runs the tests) are a part of the server and included in the distribution, but I don't think we have any meaningful documentation for mysqltest in the KB.

Comment by Noel Kuntze [ 2019-05-28 ]

Ah, thank you. That is great to hear. Do you have any existing documentation about the syntax? I'm glad for any scrap of it I can get or find.

Comment by Elena Stepanova [ 2019-05-29 ]

I couldn't find anything right now, maybe jacob.moorman will be able to point at something that I missed.

You can use the actual existing tests to get the idea, in particular I expect that mysqtest.test in the main suite should contain a lot of examples of the syntax (it's <sourcedir>/mysql-test/main/mysqltest.test or <sourcedir>/mysql-test/t/mysqltest.test, depending on which branch you use).
Naturally, other tests can also be looked int as examples, but most of the regression tests only use simple commands. mysqltest.test should have higher coverage for its syntax.

Comment by Noel Kuntze [ 2019-05-29 ]

Thank you! That is already an enormous help.

Comment by Jacob Moorman (Inactive) [ 2019-05-30 ]

This task is accepted to our backlog.

Comment by Noel Kuntze [ 2019-06-04 ]

I have another question: Is there a way to measure the query execution time in microseconds or nanoseconds using mysqltest? I haven't found anything regarding that.

Comment by Sergei Golubchik [ 2019-06-05 ]

not that I know of. One can do, like

set @before=now(6);

then execute the query and then

select unix_timestamp(now(6))-unix_timestamp(@before);

but generally this is not something one should do in mysql-test, because tests are run on a variety of platforms and architectures, some are slow, some are fast, some are very loaded. Any timing-dependent tests are bound to fail eventually.

It's something one can do locally when experimenting or debugging or something, but it's never reliable enough to be pushed, so there's little interest in time measurements in mysqltest.

Comment by Julien Fritsch [ 2021-09-22 ]

jacob.moorman from our discussion, I decided to reassign Kenneth's ticket to you?

Generated at Thu Feb 08 08:53:06 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.