Skip to content
Snippets Groups Projects
Commit 4e4d7eef authored by Francois Keith's avatar Francois Keith
Browse files

Add another 'unit test' for the interpreter.

This unit test shows that after a given number of run
of the same file, the error changes.
Unfortunately, this can not be automatically verified, since
the result is printed in the python error stream, and cannot be
redirected.
parent 4038b10c
No related branches found
No related tags found
No related merge requests found
......@@ -26,10 +26,19 @@ ADD_DEFINITIONS(${DYNAMIC_GRAPH_CFLAGS})
SET(EXECUTABLE_NAME interpreter-test)
ADD_EXECUTABLE(${EXECUTABLE_NAME} interpreter-test.cc)
TARGET_LINK_LIBRARIES(${EXECUTABLE_NAME} dynamic-graph-python)
TARGET_LINK_LIBRARIES(${EXECUTABLE_NAME} ${DYNAMIC_GRAPH_LIBRARIES} -lpthread -ldl -lutil)
ADD_TEST(${EXECUTABLE_NAME} ${EXECUTABLE_NAME})
## Test runfile
SET(EXECUTABLE_NAME interpreter-test-runfile)
ADD_EXECUTABLE(${EXECUTABLE_NAME} interpreter-test-runfile.cc)
TARGET_LINK_LIBRARIES(${EXECUTABLE_NAME} dynamic-graph-python)
ADD_TEST(${EXECUTABLE_NAME} ${EXECUTABLE_NAME})
ADD_CUSTOM_COMMAND(TARGET interpreter-test-runfile POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/unitTesting/test_python_error.py
${CMAKE_BINARY_DIR}/unitTesting
)
// The purpose of this unit test is to check the interpreter::runPythonFile method
#include "dynamic-graph/python/interpreter.hh"
int main(int argc, char ** argv)
{
// execute numerous time the same file.
// While running 1025, we can notice a change in the error.
// unfortunately, it can not be shown using a redirection of the streams
int numTest = 1025;
if (argc > 1)
numTest = atoi(argv[1]);
dynamicgraph::python::Interpreter interp;
for (int i=0; i<numTest; ++i)
{
interp.runPythonFile("test_python_error.py");
}
return 0;
}
import sys, os
pkgConfigPath = os.environ.get("PKG_CONFIG_PATH")
if pkgConfigPath == None:
pkgConfigPath = ''
pathList = re.split(':', pkgConfigPath)
print pathList
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment