You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add more comprehensive documentation on testing and benchmarking to CONTRIBUTING.md (#5478)
* Add more testing and benchmarking documentation
* remove extra line
* Add benchmarking information
---------
Co-authored-by: Clide Stefani <[email protected]>
From here on, this is a pure Rust project and `cargo` can be used to run tests, benchmarks, docs and examples as usual.
94
94
95
-
###Running the tests
95
+
## Running the tests
96
96
97
97
Run tests using the Rust standard `cargo test` command:
98
98
99
99
```bash
100
-
# run all tests.
100
+
# run all unit and integration tests
101
101
cargo test
102
102
103
-
104
-
# run only tests for the arrow crate
103
+
# run tests for the arrow crate
105
104
cargo test -p arrow
106
105
```
107
106
107
+
For some changes, you may want to run additional tests. You can find up-to-date information on the current CI tests in [.github/workflows](https://github.com/apache/arrow-rs/tree/master/.github/workflows). Here are some examples of additional tests you may want to run:
108
+
109
+
```bash
110
+
# run tests for the parquet crate
111
+
cargo test -p parquet
112
+
113
+
# run arrow tests with all features enabled
114
+
cargo test -p arrow --all-features
115
+
116
+
# run the doc tests
117
+
cargo test --doc
118
+
```
119
+
108
120
## Code Formatting
109
121
110
122
Our CI uses `rustfmt` to check code formatting. Before submitting a
We recommend using `clippy` for checking lints during development. While we do not yet enforce `clippy` checks, we recommend not introducing new `clippy` errors or warnings.
120
132
121
-
Run the following to check for clippy lints.
133
+
Run the following to check for `clippy` lints:
122
134
123
135
```bash
136
+
# run clippy with default settings
124
137
cargo clippy
138
+
139
+
```
140
+
141
+
More comprehensive `clippy` checks can be run by adding flags:
142
+
143
+
```bash
144
+
# run clippy on the arrow crate with all features enabled, targeting all tests, examples, and benchmarks
If you use Visual Studio Code with the `rust-analyzer` plugin, you can enable `clippy` to run each time you save a file. See https://users.rust-lang.org/t/how-to-use-clippy-in-vs-code-with-rust-analyzer/41881.
@@ -134,6 +155,33 @@ Search for `allow(clippy::` in the codebase to identify lints that are ignored/a
134
155
- If you have several lints on a function or module, you may disable the lint on the function or module.
135
156
- If a lint is pervasive across multiple modules, you may disable it at the crate level.
136
157
158
+
## Running Benchmarks
159
+
160
+
Running benchmarks are a good way to test the performance of a change. As benchmarks usually take a long time to run, we recommend running targeted tests instead of the full suite.
161
+
162
+
```bash
163
+
# run all benchmarks
164
+
cargo bench
165
+
166
+
# run arrow benchmarks
167
+
cargo bench -p arrow
168
+
169
+
# run benchmark for the parse_time function within the arrow-cast crate
170
+
cargo bench -p arrow-cast --bench parse_time
171
+
```
172
+
173
+
To set the baseline for your benchmarks, use the --save-baseline flag:
We can use [git pre-commit hook](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks) to automate various kinds of git pre-commit checking/formatting.
0 commit comments