Skip to content

Commit 2f83b82

Browse files
authored
add my-tester support for cascades planner. (#137)
1 parent 0d83955 commit 2f83b82

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

README.md

+8-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ This is a golang implementation of [MySQL Test Framework](https://github.com/mys
55
## Requirements
66

77
- All the tests should be put in [`t`](./t), take [t/example.test](./t/example.test) as an example.
8-
- All the expected test results should be put in [`r`](./r). Result file has the same file name with the corresponding test file, but with a `.result` file suffix, take [r/example.result](./r/example.result) as an examle.
8+
- All the expected test results should be put in [`r`](./r). Result file has the same file name with the corresponding test file, but with a default `.result` file extension, it can be changed by `-extension`, take [r/example.result](./r/example.result) as an examle.
99

1010
## How to use
1111

@@ -39,13 +39,20 @@ Usage of ./mysql-tester:
3939
The user for connecting to the database. (default "root")
4040
-xunitfile string
4141
The xml file path to record testing results.
42+
-check-error
43+
If --error ERR does not match, return error instead of just warn
44+
-extension
45+
Specify the extension of result file under special requirement, default as ".result"
4246
```
4347

4448
By default, it connects to the TiDB/MySQL server at `127.0.0.1:4000` with `root` and no passward:
4549
```sh
4650
./mysql-tester # run all the tests
4751
./mysql-tester example # run a specified test
4852
./mysql-tester example1 example2 example3 # seperate different tests with one or more spaces
53+
# modify current example cases for .result output.
54+
./mysql-tester -record=1 -check-error=1
55+
4956
```
5057

5158
For more details about how to run and write test cases, see the [Wiki](https://github.com/pingcap/mysql-tester/wiki) page.

r/example.result

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,17 @@ SELECT 6;
1818
6
1919
6
2020
1 SELECT;
21-
Error 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use line 1 column 1 near "1 SELECT;"
21+
Error 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use line 1 column 1 near "1 SELECT"
2222
2 SELECT;
2323
3 SELECT;
2424
Got one of the listed errors
2525
explain analyze format='brief' select * from t;
2626
id estRows actRows task access object execution info operator info memory disk
27-
TableReader 10000.00 5 root NULL time:<num>, loops:<num>, RU:<num>, cop_task: {num:<num>, max:<num>, proc_keys:<num>, rpc_num:<num>, rpc_time:<num>, copr_cache_hit_ratio:<num>, build_task_duration:<num>, max_distsql_concurrency:<num>} data:TableFullScan <num> Bytes N/A
27+
TableReader 10000.00 5 root NULL time:<num>, open:<num>, close:<num>, loops:<num>, RU:<num>, cop_task: {num:<num>, max:<num>, proc_keys:<num>, copr_cache_hit_ratio:<num>, build_task_duration:<num>, max_distsql_concurrency:<num>, rpc_info:{Cop:{num_rpc:<num>, total_time:<num>}} data:TableFullScan <num> Bytes N/A
2828
└─TableFullScan 10000.00 5 cop[tikv] table:t tikv_task:{time:<num>, loops:<num>} keep order:false, stats:pseudo N/A N/A
2929
explain analyze select * from t;
3030
id estRows actRows task access object execution info operator info memory disk
31-
TableReader_5 10000.00 5 root NULL time:<num>, loops:<num>, RU:<num>, cop_task: {num:<num>, max:<num>, proc_keys:<num>, rpc_num:<num>, rpc_time:<num>, copr_cache_hit_ratio:<num>, build_task_duration:<num>, max_distsql_concurrency:<num>} data:TableFullScan_4 <num> Bytes N/A
31+
TableReader_5 10000.00 5 root NULL time:<num>, open:<num>, close:<num>, loops:<num>, RU:<num>, cop_task: {num:<num>, max:<num>, proc_keys:<num>, copr_cache_hit_ratio:<num>, build_task_duration:<num>, max_distsql_concurrency:<num>, rpc_info:{Cop:{num_rpc:<num>, total_time:<num>}} data:TableFullScan_4 <num> Bytes N/A
3232
└─TableFullScan_4 10000.00 5 cop[tikv] table:t tikv_task:{time:<num>, loops:<num>} keep order:false, stats:pseudo N/A N/A
3333
insert into t values (6, 6);
3434
affected rows: 1

src/main.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ var (
4747
retryConnCount int
4848
collationDisable bool
4949
checkErr bool
50+
extension string
5051
)
5152

5253
func init() {
@@ -63,6 +64,7 @@ func init() {
6364
flag.IntVar(&retryConnCount, "retry-connection-count", 120, "The max number to retry to connect to the database.")
6465
flag.BoolVar(&checkErr, "check-error", false, "if --error ERR does not match, return error instead of just warn")
6566
flag.BoolVar(&collationDisable, "collation-disable", false, "run collation related-test with new-collation disabled")
67+
flag.StringVar(&extension, "extension", "result", "the result file extension for result file")
6668
}
6769

6870
const (
@@ -1081,7 +1083,7 @@ func (t *tester) resultFileName() string {
10811083
name = name + "_enabled"
10821084
}
10831085
}
1084-
return fmt.Sprintf("./r/%s.result", name)
1086+
return fmt.Sprintf("./r/%s.%s", name, extension)
10851087
}
10861088

10871089
func loadAllTests() ([]string, error) {

0 commit comments

Comments
 (0)