tAdded valgrind and cuda-memcheck tests for memory leaks - sphere - GPU-based 3… | |
git clone git://src.adamsgaard.dk/sphere | |
Log | |
Files | |
Refs | |
LICENSE | |
--- | |
commit a2dc863676d9ddd731528d2c330be10b1aec48f2 | |
parent bcfb542fb89e6971ab9b34fd4cacf8d2843d505b | |
Author: Anders Damsgaard <[email protected]> | |
Date: Fri, 22 Feb 2013 21:46:41 +0100 | |
Added valgrind and cuda-memcheck tests for memory leaks | |
Diffstat: | |
M tests/CMakeLists.txt | 3 +++ | |
A tests/memcheck_tests.py | 27 +++++++++++++++++++++++++++ | |
2 files changed, 30 insertions(+), 0 deletions(-) | |
--- | |
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt | |
t@@ -6,3 +6,6 @@ add_test(io_tests ${PYTHON_EXECUTABLE} | |
add_test(porosity_tests ${PYTHON_EXECUTABLE} | |
${CMAKE_CURRENT_BINARY_DIR}/porosity_tests.py) | |
+ | |
+add_test(memory_tests ${PYTHON_EXECUTABLE} | |
+ ${CMAKE_CURRENT_BINARY_DIR}/memcheck_tests.py) | |
diff --git a/tests/memcheck_tests.py b/tests/memcheck_tests.py | |
t@@ -0,0 +1,27 @@ | |
+#!/usr/bin/env python | |
+from pytestutils import * | |
+ | |
+#### Input/output tests #### | |
+print("### Memory tests ###") | |
+ | |
+# Generate data in python | |
+orig = Spherebin(np = 100, nw = 1, sid = "test-initgrid") | |
+orig.generateRadii(histogram = False) | |
+orig.defaultParams() | |
+orig.initRandomGridPos(g = numpy.zeros(orig.nd)) | |
+orig.initTemporal(current = 0.0, total = 0.0) | |
+orig.time_total = 2.0*orig.time_dt; | |
+orig.time_file_dt = orig.time_dt; | |
+orig.writebin(verbose=False) | |
+ | |
+# Test C++ routines | |
+print("Valgrind: C++ routines") | |
+orig.run(verbose=False, hideinputfile=True, valgrind=True) | |
+ | |
+ | |
+# Test CUDA routines | |
+print("cuda-memcheck: CUDA routines") | |
+orig.run(verbose=False, hideinputfile=True, cudamemcheck=True) | |
+ | |
+# Remove temporary files | |
+cleanup(orig) |