This is an automated email from the ASF dual-hosted git repository. haibin pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git
The following commit(s) were added to refs/heads/master by this push: new a97a475 [MXNET-23] add README for test directory (#11390) a97a475 is described below commit a97a475df9243ebfadf4f4ca2c58bd4d90480fe0 Author: Alexander Zai <aza...@gmail.com> AuthorDate: Wed Jun 27 22:42:58 2018 -0700 [MXNET-23] add README for test directory (#11390) * add README for tests * update read me with relative path to test file * update test readme to include instructions for running with docker * retrigger * another retrigger --- tests/README.md | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/tests/README.md b/tests/README.md new file mode 100644 index 0000000..e528edf --- /dev/null +++ b/tests/README.md @@ -0,0 +1,58 @@ +# Testing MXNET + +## Running CPP Tests + +1. Install [cmake](https://cmake.org/install/) +1. Create a build directory in the root of the mxnet project + ``` + mkdir build + cd build + ``` +1. Generate your Makefile and build along with the tests with cmake (specify appropraite flags) + ``` + cmake -DUSE_CUDNN=ON -DUSE_CUDA=ON -DUSE_MKLDNN=ON -DBLAS=Open -DCMAKE_BUILD_TYPE=Debug .. && make + ``` +1. Run tests + ``` + ctest --verbose + ``` + +1. The following will run all the tests the in `cpp` directory. To run just your test file replace the following in your `tests/CMakeLists.txt` + ``` + file(GLOB_RECURSE UNIT_TEST_SOURCE "cpp/*.cc" "cpp/*.h") + ``` + with + ``` + file(GLOB_RECURSE UNIT_TEST_SOURCE "cpp/test_main.cc" "cpp/{RELATIVE_PATH_TO_TEST_FILE}") + ``` + +### Building with Ninja + +Ninja is a build tool (like make) that prioritizes building speed. If you will be building frequently, we recommend you use ninja + +1. Download Ninja via package manager or directly from [source](https://github.com/ninja-build/ninja) + ``` + apt-get install ninja-build + ``` +1. When running cmake, add the `-GNinja` flag to specify cmake to generate a Ninja build file + ``` + cmake -DUSE_CUDNN=ON -DUSE_CUDA=ON -DUSE_MKLDNN=ON -DBLAS=Open -GNinja -DCMAKE_BUILD_TYPE=Debug .. + ``` +1. Run the ninja build file with + ``` + ninja + ``` + +## Runing Python Tests Within Docker + +1. To run tests inside docker run the following comamdn + ``` + ci/build.py --platform {PLATFORM} /work/runtime_functions.sh {RUNTIME_FUNCTION} + ``` +An example for running python tests would be +``` +ci/build.py --platform build_ubuntu_cpu_mkldnn /work/runtime_functions.sh unittest_ubuntu_python3_cpu PYTHONPATH=./python/ nosetests-2.7 tests/python/unittest +``` + + +