Skip to content

Commit

Permalink
docs(quickstart): add stonedb-8.0 compiling guide stoneatom#1449
Browse files Browse the repository at this point in the history
  • Loading branch information
Double0101 committed Apr 11, 2023
1 parent 8146e9b commit 656e636
Show file tree
Hide file tree
Showing 8 changed files with 908 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Check if  `git` has been installed. If not, install it first.
1. Issue report: Open a regular [StoneDB issue](https://github.com/stoneatom/stonedb/issues/new/choose) to bind your pull request.<br />For more details about creating github issue concepts, see: [create an github issue](https://docs.github.com/en/issues/tracking-your-work-with-issues/creating-an-issue)
2. Fork [StoneDB repo](https://github.com/stoneatom/stonedb) to your own account.
3. After add you own code, add unit test
4. Do *make mtr test*
4. Do *make mtr test* [How to add mtr test](https://stonedb.io/docs/getting-started/quick-add-mtr-test/)
5. After all test passed, use *clang-format* to formate your code according to [google c++ styleguide](https://google.github.io/styleguide/cppguide.html)
6. Submit a [Draft Pull Requests](https://github.blog/2019-02-14-introducing-draft-pull-requests/) and  [write your PR description](https://github.com/stoneatom/stonedb/blob/stonedb-5.7/.github/pull_request_template.md)<br />For more details about pr concepts, see [creating-a-pull-request-from-a-fork](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request-from-a-fork)<br />For more detail about draft pr concepts,  see [draft-pull-request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests#draft-pull-requests)
7. After all CI tests are passed, change the status to “Ready for review”.
Expand Down
101 changes: 101 additions & 0 deletions Docs/02-getting-started/quick-add-mtr-test.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
---
id: quick-add-mtr-test
sidebar_position: 3.6
---

# Qucik Add MTR Test

## Add and Run a MTR test

When you contribute your code into StoneDB, test your code in the meantime.

Test cases are in the path \${StoneDB-Source-DIR}/mysql-test/suite/tianmu/.

> \${StoneDB-Source-DIR} is your StoneDB source code directory.
>
> \${TEST-PATH}=\${StoneDB-Source-DIR}/mysql-test/suite/tianmu/ in the following context.
### Step 1. Write your test file and result file

Put your test file in the \${TEST-PATH}/t/ and result file in the \${TEST-PATH}/r/.

You can write your test cases like this.

issue736.test
```sql
--source include/have_tianmu.inc
use test;
CREATE TABLE t1(col1 INT, col2 CHAR(5))ENGINE=tianmu;
INSERT INTO t1 VALUES(NULL,''),(1,'a'),(1,'b'),(1,'c'),(2,'dd'),(3,'eee');
INSERT INTO t1 VALUES(8,UNHEX('CEB2'));
SELECT COUNT(DISTINCT col2) FROM t1;
SELECT COUNT(DISTINCT col1) FROM t1;
DROP TABLE t1;
```

Issue736.result
```sql
use test;
CREATE TABLE t1(col1 INT, col2 CHAR(5))ENGINE=tianmu;
INSERT INTO t1 VALUES(NULL,''),(1,'a'),(1,'b'),(1,'c'),(2,'dd'),(3,'eee');
INSERT INTO t1 VALUES(8,UNHEX('CEB2'));
SELECT COUNT(DISTINCT col2) FROM t1;
COUNT(DISTINCT col2)
7
SELECT COUNT(DISTINCT col1) FROM t1;
COUNT(DISTINCT col1)
4
DROP TABLE t1;

```

### Step 2. Compile your StoneDB.

In this example, I compile my StoneDB in \${StoneDB-Source-DIR}/build/mysql8/ and install in \${StoneDB-Source-DIR}/build/install8/

```shell
cd stonedb/build
mkdir mysql8 install8
# build your stonedb
.........
```

### Step 3. Run your test.

After installation, test cases will be moved into your installation directory.In this example, the path is \${StoneDB-Source-DIR}/build/install8/mysql-test

``` shell
cd install8/mysql-test
# run your test case. issue736 is my testcase.
# run one case.
./mtr --suite=tianmu testcase
# run all cases.
./mysql-test-run.pl --suite=tianmu --nowarnings --force --nocheck-testcases --parallel=10

### Execute the test in this example.
root@htap-dev-64-2:/stonedb/build/install8/mysql-test# ./mtr --suite=tianmu issue736
Logging: ./mtr --suite=tianmu issue736
MySQL Version 8.0.30
Checking supported features
- Binaries are debug compiled
Collecting tests
Checking leftover processes
Removing old var directory
Creating var directory '/stonedb/build/install8/mysql-test/var'
Installing system database
Using parallel: 1

==============================================================================
TEST NAME RESULT TIME (ms) COMMENT
------------------------------------------------------------------------------
worker[1] mysql-test-run: WARNING: running this script as _root_ will cause some tests to be skipped
[ 50%] tianmu.issue736 [ pass ] 78
[100%] shutdown_report [ pass ]
------------------------------------------------------------------------------
The servers were restarted 0 times
The servers were reinitialized 0 times
Spent 0.078 of 35 seconds executing testcases

Completed: All 2 tests were successful.

```
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
id: compile-using-docker
sidebar_position: 5.15
sidebar_position: 5.16
---

# Compile StoneDB in a Docker Container
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"position": 5.15,
"label": "Compile StoneDB 8.0 on Ubuntu22.04",
"collapsible": true
}
Loading

0 comments on commit 656e636

Please sign in to comment.