mysql-tester icon indicating copy to clipboard operation
mysql-tester copied to clipboard

(Call For Participation)*: Different expected error behavior when recording the test output.

Open bb7133 opened this issue 5 years ago • 0 comments

For example, given an test file, say t/some_test.test:

sh> cat t/some_test.test -n
     1	drop database if exists tdb;
     2	create database tdb;
     3	use tdb;
     4	
     5	create table t(a int primary key);
     6	insert into t values (1);
     7	# an incorrect expected error
     8	--Error 1062
     9	insert into t values (2);

Notice that at line 8, an incorrect expected error("--Error 1062") is given, and when we try to record the result, MySQL test framework reports an error like the followings:

sh>mysqltest -u root < t/mysql_replace.test
drop database if exists tdb;
create database tdb;
use tdb;
create table t(a int primary key);
insert into t values (1);
mysqltest: At line 9: Query 'insert into t values (2)' succeeded, should have failed with error '1062'
not ok

But in this framework, recording is done successfully:

sh>run-tests.sh -s tidb-server -r some_test -b n
skip building tidb-server, using existing binary: ./tidb-server
skip building mysqltest, using existing binary: ./mysql_test
start tidb-server, log file: ./mysql-test.out
tidb-server(PID: 10971) started
record result for case: "some_test"
./t/some_test.test: ok! 2 test cases passed, take time 0.023170004 s

Great, All tests passed
mysqltest end
tidb-server(PID: 10971) stopped

bb7133 avatar Mar 23 '20 15:03 bb7133