-
Notifications
You must be signed in to change notification settings - Fork 284
OCE Testing Suite
The OCE testing suite is powered by CMake/CTest/CDash.
From the cmake-gui frontend, check OCE_TESTING, then
$makeas usual to build the project.
To run the tests, just enter:
$make test
You should get the following output:
$ make test Running tests... Test project /Users/thomas/Devel/oce/cmake-build Start 1: BRepAlgoAPITestSuite.testCutBox 1/17 Test #1: BRepAlgoAPITestSuite.testCutBox .............. Passed 0.05 sec Start 2: BRepAlgoAPITestSuite.testCutCylSphere 2/17 Test #2: BRepAlgoAPITestSuite.testCutCylSphere ........ Passed 0.04 sec Start 3: BRepGPropTestSuite.testComputeBoxVolume 3/17 Test #3: BRepGPropTestSuite.testComputeBoxVolume ...... Passed 0.02 sec Start 4: BRepGPropTestSuite.testComputeBoxSurface 4/17 Test #4: BRepGPropTestSuite.testComputeBoxSurface ..... Passed 0.02 sec Start 5: BRepGPropTestSuite.testComputeSphereVolume 5/17 Test #5: BRepGPropTestSuite.testComputeSphereVolume ... Passed 0.02 sec Start 6: BRepOffsetAPITestSuite.testEvolvedShape 6/17 Test #6: BRepOffsetAPITestSuite.testEvolvedShape ...... Passed 0.04 sec Start 7: BRepPrimAPITestSuite.testCreateBox 7/17 Test #7: BRepPrimAPITestSuite.testCreateBox ........... Passed 0.02 sec Start 8: BRepPrimAPITestSuite.testCreateFlatBox 8/17 Test #8: BRepPrimAPITestSuite.testCreateFlatBox ....... Passed 0.02 sec Start 9: BRepPrimAPITestSuite.testCreateSmallestBox 9/17 Test #9: BRepPrimAPITestSuite.testCreateSmallestBox ... Passed 0.02 sec Start 10: gpTestSuite.testgp_PntConstruct 10/17 Test #10: gpTestSuite.testgp_PntConstruct .............. Passed 0.01 sec Start 11: gpTestSuite.testgp_PntDistance 11/17 Test #11: gpTestSuite.testgp_PntDistance ............... Passed 0.01 sec Start 12: gpTestSuite.testBuildThousandsPoints 12/17 Test #12: gpTestSuite.testBuildThousandsPoints ......... Passed 0.01 sec Start 13: TestSuite.testNullPointer 13/17 Test #13: TestSuite.testNullPointer .................... Passed 0.00 sec Start 14: TestSuite.testFloatEq 14/17 Test #14: TestSuite.testFloatEq ........................ Passed 0.00 sec Start 15: TestSuite.testFloatNeq 15/17 Test #15: TestSuite.testFloatNeq ....................... Passed 0.01 sec Start 16: TestSuite.testBoolean 16/17 Test #16: TestSuite.testBoolean ........................ Passed 0.00 sec Start 17: TestSuite.testIntegerLighter 17/17 Test #17: TestSuite.testIntegerLighter ................. Passed 0.00 sec 100% tests passed, 0 tests failed out of 17 Total Test time (real) = 0.68 sec
You can then check that all tests pass, or if any of the test fails. In such a case, it may be handy to set CTEST_OUTPUT_ON_FAILURE=1 to display error messages:
$ CTEST_OUTPUT_ON_FAILURE=1 make test Running tests...
CTest provides a nice feature called 'code coverage'. It tells which lines or the OCE library were executed by the testing suite. It can then allows to figure out 'holes' in the testing suite, and new tests to develop in order to fill in blanks. For that:
$make ExperimentalCoverage
The use of CTest with a dynamic code analyzer enables going deeper into the test results, and study memory usage: potential memory leaks, confirmed memory leaks etc. In order to use this feature, you must have either Valgrind (http://valgrind.org/) or (TODO: which other software?) installed. Then:
$make ExperimentalMemCheck
You should get an output like this:
$ make ExperimentalMemCheck Site: macbook-pro-de-thomas-paviot.local Build name: Darwin-clang++ Memory check project /Users/thomas/Devel/oce/cmake-build Start 1: BRepAlgoAPITestSuite.testCutBox 1/17 MemCheck #1: BRepAlgoAPITestSuite.testCutBox .............. Passed 9.69 sec Start 2: BRepAlgoAPITestSuite.testCutCylSphere 2/17 MemCheck #2: BRepAlgoAPITestSuite.testCutCylSphere ........ Passed 9.39 sec Start 3: BRepGPropTestSuite.testComputeBoxVolume 3/17 MemCheck #3: BRepGPropTestSuite.testComputeBoxVolume ...... Passed 5.02 sec Start 4: BRepGPropTestSuite.testComputeBoxSurface 4/17 MemCheck #4: BRepGPropTestSuite.testComputeBoxSurface ..... Passed 5.01 sec Start 5: BRepGPropTestSuite.testComputeSphereVolume 5/17 MemCheck #5: BRepGPropTestSuite.testComputeSphereVolume ... Passed 5.00 sec Start 6: BRepOffsetAPITestSuite.testEvolvedShape 6/17 MemCheck #6: BRepOffsetAPITestSuite.testEvolvedShape ...... Passed 9.51 sec Start 7: BRepPrimAPITestSuite.testCreateBox 7/17 MemCheck #7: BRepPrimAPITestSuite.testCreateBox ........... Passed 4.92 sec Start 8: BRepPrimAPITestSuite.testCreateFlatBox 8/17 MemCheck #8: BRepPrimAPITestSuite.testCreateFlatBox ....... Passed 4.68 sec Start 9: BRepPrimAPITestSuite.testCreateSmallestBox 9/17 MemCheck #9: BRepPrimAPITestSuite.testCreateSmallestBox ... Passed 4.90 sec Start 10: gpTestSuite.testgp_PntConstruct 10/17 MemCheck #10: gpTestSuite.testgp_PntConstruct .............. Passed 2.82 sec Start 11: gpTestSuite.testgp_PntDistance 11/17 MemCheck #11: gpTestSuite.testgp_PntDistance ............... Passed 2.82 sec Start 12: gpTestSuite.testBuildThousandsPoints 12/17 MemCheck #12: gpTestSuite.testBuildThousandsPoints ......... Passed 2.83 sec Start 13: TestSuite.testNullPointer 13/17 MemCheck #13: TestSuite.testNullPointer .................... Passed 1.07 sec Start 14: TestSuite.testFloatEq 14/17 MemCheck #14: TestSuite.testFloatEq ........................ Passed 1.07 sec Start 15: TestSuite.testFloatNeq 15/17 MemCheck #15: TestSuite.testFloatNeq ....................... Passed 1.08 sec Start 16: TestSuite.testBoolean 16/17 MemCheck #16: TestSuite.testBoolean ........................ Passed 1.09 sec Start 17: TestSuite.testIntegerLighter 17/17 MemCheck #17: TestSuite.testIntegerLighter ................. Passed 1.07 sec 100% tests passed, 0 tests failed out of 17 Total Test time (real) = 72.34 sec -- Processing memory checking output: ################ Memory checking results: Mismatched deallocation - 2 Memory Leak - 1 Potential Memory Leak - 1749 Built target ExperimentalMemCheck
One of another useful CTest feature is that you can share your test results with other developers. This dashboard is managed by CDash. CDash is reponsible for gathering the tests/coverage/dynamic analysis results, formatting them, and upload them to a webserver so that they can be browsed. The OCE team registered an free account at myCDash.org: http://my.cdash.org/index.php?project=OCE. To upload your results to this webpage, nothing easier:
$ make ExperimentalSubmit
Official CMake/CTest wiki : http://www.vtk.org/Wiki/CMake_Testing_With_CTest