Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: move and rename cmd/explaintest to tests/integrationtest #46712

Merged
merged 6 commits into from
Sep 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ coverage.out
*.test.bin
tags
profile.coverprofile
explain_test
cmd/explaintest/explain-test.out
cmd/explaintest/explaintest_tidb-server
cmd/explaintest/portgenerator
cmd/explaintest/s/
integration_test
tests/integrationtest/integration-test.out
tests/integrationtest/integrationtest_tidb-server
tests/integrationtest/portgenerator
tests/integrationtest/s/
*.fail.go
tools/bin/
vendor
Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ buildsucc:

all: dev server benchkv

dev: checklist check explaintest gogenerate br_unit_test test_part_parser_dev ut check-file-perm
dev: checklist check integrationtest gogenerate br_unit_test test_part_parser_dev ut check-file-perm
@>&2 echo "Great, all tests passed."

# Install the check tools.
Expand Down Expand Up @@ -94,7 +94,7 @@ clean: failpoint-disable
test: test_part_1 test_part_2
@>&2 echo "Great, all tests passed."

test_part_1: checklist explaintest
test_part_1: checklist integrationtest

test_part_2: test_part_parser ut gogenerate br_unit_test dumpling_unit_test

Expand All @@ -118,9 +118,9 @@ test_part_br: br_unit_test br_integration_test

test_part_dumpling: dumpling_unit_test dumpling_integration_test

explaintest: server_check
integrationtest: server_check
@mkdir -p $(TEST_COVERAGE_DIR)
@cd cmd/explaintest && GOCOVERDIR=../../$(TEST_COVERAGE_DIR) ./run-tests.sh -s ../../bin/tidb-server
@cd tests/integrationtest && GOCOVERDIR=../../$(TEST_COVERAGE_DIR) ./run-tests.sh -s ../../bin/tidb-server
@$(GO) tool covdata textfmt -i=$(TEST_COVERAGE_DIR) -o=coverage.dat

ddltest:
Expand Down
2 changes: 1 addition & 1 deletion build/nogo_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@
"tools/check/xprog.go": "ignore tools/check code",
"cmd/pluginpkg/pluginpkg.go": "ignore cmd/pluginpkg code",
"tools/check/xprog.go:": "ignore tools/check code",
"cmd/explaintest/main.go": "ignore cmd/explaintest code",
"tests/integrationtest/main.go": "ignore tests/integrationtest code",
"GOROOT/": "ignore code",
"server/internal/testserverclient/server_client.go": "ignore server_client code",
".*_generated\\.go$": "ignore generated code"
Expand Down
12 changes: 6 additions & 6 deletions cmd/explaintest/README.md → tests/integrationtest/README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# ExplainTest
# IntegrationTest

ExplainTest is a explain test command tool, also with some useful test cases for TiDB execute plan logic, we can run case via `run-tests.sh`.
IntegrationTest is a integration test command tool, also with some useful test cases for TiDB execute plan logic, we can run case via `run-tests.sh`.

```
Usage: ./run-tests.sh [options]

-h: Print this help message.

-s <tidb-server-path>: Use tidb-server in <tidb-server-path> for testing.
eg. "./run-tests.sh -s ./explaintest_tidb-server"
eg. "./run-tests.sh -s ./integrationtest_tidb-server"

-b <y|Y|n|N>: "y" or "Y" for building test binaries [default "y" if this option is not specified].
"n" or "N" for not to build.
Expand All @@ -28,7 +28,7 @@ Usage: ./run-tests.sh [options]

## How it works

ExplainTest will read test case in `t/*.test`, and execute them in TiDB server with `s/*.json` stat, and compare explain result in `r/*.result`.
IntegrationTest will read test case in `t/*.test`, and execute them in TiDB server with `s/*.json` stat, and compare integration result in `r/*.result`.

For convenience, we can generate new `*.result` and `*.json` from execute by use `-r` parameter for `run-tests.sh`

Expand All @@ -45,7 +45,7 @@ make dev
or

```sh
make explaintest
make integrationtest
```
It will identify execute plan change.

Expand All @@ -54,7 +54,7 @@ It will identify execute plan change.
First, add new test query in `t/` folder.

```sh
cd cmd/explaintest
cd tests/integrationtest
./run-tests.sh -r [casename]
``
It will generate result base on last execution, and then we can reuse them or open editor to do some modify.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ build=1
mysql_tester="./mysql_tester"
tidb_server=""
portgenerator=""
mysql_tester_log="./explain-test.out"
mysql_tester_log="./integration-test.out"
tests=""
record=0
record_case=""
Expand All @@ -41,10 +41,10 @@ function help_message()
-d <y|Y|n|N|b|B>: \"y\" or \"Y\" for only enabling the new collation during test.
\"n\" or \"N\" for only disabling the new collation during test.
\"b\" or \"B\" for both tests [default].
Enable/Disable the new collation during the explain test.
Enable/Disable the new collation during the integration test.

-s <tidb-server-path>: Use tidb-server in <tidb-server-path> for testing.
eg. \"./run-tests.sh -s ./explaintest_tidb-server\"
eg. \"./run-tests.sh -s ./integrationtest_tidb-server\"

-b <y|Y|n|N>: \"y\" or \"Y\" for building test binaries [default \"y\" if this option is not specified].
\"n\" or \"N\" for not to build.
Expand Down Expand Up @@ -74,7 +74,7 @@ function build_portgenerator()

function build_tidb_server()
{
tidb_server="./explaintest_tidb-server"
tidb_server="./integrationtest_tidb-server"
echo "building tidb-server binary: $tidb_server"
rm -rf $tidb_server
if [ "${TIDB_TEST_STORE_NAME}" = "tikv" ]; then
Expand Down Expand Up @@ -169,7 +169,7 @@ if [ $build -eq 1 ]; then
build_mysql_tester
else
if [ -z "$tidb_server" ]; then
tidb_server="./explaintest_tidb-server"
tidb_server="./integrationtest_tidb-server"
if [[ ! -f "$tidb_server" ]]; then
build_tidb_server
else
Expand Down Expand Up @@ -239,9 +239,9 @@ function run_mysql_tester()
fi
else
if [ -z "$tests" ]; then
echo "run all explain test cases ($coll_msg)"
echo "run all integration test cases ($coll_msg)"
else
echo "run explain test cases($coll_msg): $tests"
echo "run integration test cases($coll_msg): $tests"
fi
$mysql_tester -port "$port" --collation-disable=$coll_disabled $tests
fi
Expand Down Expand Up @@ -285,4 +285,4 @@ if [[ $collation_opt = 1 || $collation_opt = 2 ]]; then
check_data_race
fi

echo "explaintest passed!"
echo "integrationtest passed!"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.