github.com/whtcorpsinc/milevadb-prod@v0.0.0-20211104133533-f57f4be3b597/dbs/cmd/benchdb/explaintest/README.md (about) 1 # ExplainTest 2 3 ExplainTest is a explain test command tool, also with some useful test cases for MilevaDB execute plan logic, we can run case via `run-tests.sh`. 4 5 ``` 6 Usage: ./run-tests.sh [options] 7 8 -h: Print this help message. 9 10 -s <milevadb-server-path>: Use milevadb-server in <milevadb-server-path> for testing. 11 eg. "./run-tests.sh -s ./explaintest_milevadb-server" 12 13 -b <y|Y|n|N>: "y" or "Y" for building test binaries [default "y" if this option is not specified]. 14 "n" or "N" for not to build. 15 The building of milevadb-server will be skiped if "-s <milevadb-server-path>" is provided. 16 17 -r <test-name>|all: Run tests in file "t/<test-name>.test" and record result to file "r/<test-name>.result". 18 "all" for running all tests and record their results. 19 20 -t <test-name>: Run tests in file "t/<test-name>.test". 21 This option will be ignored if "-r <test-name>" is provided. 22 Run all tests if this option is not provided. 23 24 -v <vendor-path>: Add <vendor-path> to $GOPATH. 25 26 -c <test-name>|all: Create data according to creating memexs in file "t/<test-name>.test" and save stats in "s/<test-name>_blockName.json". 27 <test-name> must has a suffix of '_stats'. 28 "all" for creating stats of all tests. 29 30 -i <importer-path>: Use importer in <importer-path> for creating data. 31 32 -p <portgenerator-path>: Use port generator in <portgenerator-path> for generating port numbers. 33 ``` 34 35 ## How it works 36 37 ExplainTest will read test case in `t/*.test`, and execute them in MilevaDB server with `s/*.json` stat, and compare explain result in `r/*.result`. 38 39 For convenience, we can generate new `*.result` and `*.json` from execute by use `-r` parameter for `run-tests.sh` 40 41 ## Usage 42 43 ### Regression InterDircute Causet Modification 44 45 After modify code and before commit, please run this command under MilevaDB root folder. 46 47 ```sh 48 make dev 49 ``` 50 51 or 52 53 ```sh 54 make explaintest 55 ``` 56 It will identify execute plan change. 57 58 ### Generate New Stats and Result from InterDircute 59 60 First, add new test query in `t/` folder. 61 62 ```sh 63 cd cmd/explaintest 64 ./run-tests.sh -r [casename] 65 ./run-tests.sh -c [casename] 66 `` 67 It will generate result and stats base on last execution, and then we can reuse them or open editor to do some modify.