how_to_run_tests.md 1.6 KB
Newer Older
L
Liangliang He 已提交
1
How to run tests
L
liutuo 已提交
2
=================
L
Liangliang He 已提交
3

L
liuqi 已提交
4
To run tests, you need to first cross compile the code, push the binary
L
Liangliang He 已提交
5 6 7
into the device and then execute the binary. To automate this process,
MACE provides `tools/bazel_adb_run.py` tool.

8
You need to make sure your device has been connected to your dev pc before running tests.
L
Liangliang He 已提交
9 10

Run unit tests
L
liutuo 已提交
11
---------------
L
Liangliang He 已提交
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51

MACE use [gtest](https://github.com/google/googletest) for unit tests.

* Run all unit tests defined in a Bazel target, for example, run `ops_test`:

  ```sh
  python tools/bazel_adb_run.py --target="//mace/ops:ops_test" \
                                --run_target=True
  ```

* Run unit tests with [gtest](https://github.com/google/googletest) filter,
for example, run `Conv2dOpTest` unit tests:

  ```sh
  python tools/bazel_adb_run.py --target="//mace/ops:ops_test" \
                                --run_target=True \
                                --args="--gtest_filter=Conv2dOpTest*"
  ```

Run micro benchmarks
--------------------

MACE provides a micro benchmark framework for performance tuning.

* Run all micro benchmarks defined in a Bazel target, for example, run all
`ops_benchmark` micro benchmarks:

  ```sh
  python tools/bazel_adb_run.py --target="//mace/ops:ops_benchmark" \
                                --run_target=True
  ```

* Run micro benchmarks with regex filter, for example, run all `CONV_2D` GPU
micro benchmarks:

  ```sh
  python tools/bazel_adb_run.py --target="//mace/ops:ops_benchmark" \
                                --run_target=True \
                                --args="--filter=MACE_BM_CONV_2D_.*_GPU"
  ```