Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
dynamic-graph-python
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Guilhem Saurel
dynamic-graph-python
Commits
4c192704
Commit
4c192704
authored
11 years ago
by
Francois Keith
Browse files
Options
Downloads
Patches
Plain Diff
Add a working python file to test the interpreter.
parent
1d505bed
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
unitTesting/CMakeLists.txt
+2
-0
2 additions, 0 deletions
unitTesting/CMakeLists.txt
unitTesting/interpreter-test-runfile.cc
+28
-1
28 additions, 1 deletion
unitTesting/interpreter-test-runfile.cc
unitTesting/test_python_ok.py
+10
-0
10 additions, 0 deletions
unitTesting/test_python_ok.py
with
40 additions
and
1 deletion
unitTesting/CMakeLists.txt
+
2
−
0
View file @
4c192704
...
@@ -38,6 +38,8 @@ TARGET_LINK_LIBRARIES(${EXECUTABLE_NAME} dynamic-graph-python)
...
@@ -38,6 +38,8 @@ TARGET_LINK_LIBRARIES(${EXECUTABLE_NAME} dynamic-graph-python)
ADD_TEST
(
${
EXECUTABLE_NAME
}
${
EXECUTABLE_NAME
}
)
ADD_TEST
(
${
EXECUTABLE_NAME
}
${
EXECUTABLE_NAME
}
)
ADD_CUSTOM_COMMAND
(
TARGET interpreter-test-runfile POST_BUILD
ADD_CUSTOM_COMMAND
(
TARGET interpreter-test-runfile POST_BUILD
COMMAND
${
CMAKE_COMMAND
}
-E copy
${
CMAKE_SOURCE_DIR
}
/unitTesting/test_python_ok.py
${
CMAKE_BINARY_DIR
}
/unitTesting
COMMAND
${
CMAKE_COMMAND
}
-E copy
${
CMAKE_SOURCE_DIR
}
/unitTesting/test_python_error.py
COMMAND
${
CMAKE_COMMAND
}
-E copy
${
CMAKE_SOURCE_DIR
}
/unitTesting/test_python_error.py
${
CMAKE_BINARY_DIR
}
/unitTesting
${
CMAKE_BINARY_DIR
}
/unitTesting
)
)
...
...
This diff is collapsed.
Click to expand it.
unitTesting/interpreter-test-runfile.cc
+
28
−
1
View file @
4c192704
// The purpose of this unit test is to check the interpreter::runPythonFile method
// The purpose of this unit test is to check the interpreter::runPythonFile method
#include
<cstring>
#include
<iostream>
#include
"dynamic-graph/python/interpreter.hh"
#include
"dynamic-graph/python/interpreter.hh"
int
main
(
int
argc
,
char
**
argv
)
int
main
(
int
argc
,
char
**
argv
)
{
{
// execute numerous time the same file.
// execute numerous time the same file.
...
@@ -10,11 +14,34 @@ int main(int argc, char ** argv)
...
@@ -10,11 +14,34 @@ int main(int argc, char ** argv)
if
(
argc
>
1
)
if
(
argc
>
1
)
numTest
=
atoi
(
argv
[
1
]);
numTest
=
atoi
(
argv
[
1
]);
std
::
string
empty_err
=
""
;
dynamicgraph
::
python
::
Interpreter
interp
;
dynamicgraph
::
python
::
Interpreter
interp
;
for
(
int
i
=
0
;
i
<
numTest
;
++
i
)
for
(
int
i
=
0
;
i
<
numTest
;
++
i
)
{
{
interp
.
runPythonFile
(
"test_python_error.py"
);
interp
.
runPythonFile
(
"test_python_ok.py"
,
empty_err
);
if
(
empty_err
!=
""
)
{
std
::
cerr
<<
"At iteration "
<<
i
<<
", the error was not empty:"
<<
std
::
endl
;
std
::
cerr
<<
" err "
<<
empty_err
<<
std
::
endl
;
return
-
1
;
}
}
// check that the error remains the same, despite of the number of executions
std
::
string
old_err
;
interp
.
runPythonFile
(
"test_python_error.py"
,
old_err
);
std
::
string
new_err
=
old_err
;
for
(
int
i
=
0
;
i
<
numTest
;
++
i
)
{
interp
.
runPythonFile
(
"test_python_error.py"
,
new_err
);
if
(
old_err
!=
new_err
)
{
std
::
cerr
<<
"At iteration "
<<
i
<<
", the error changed:"
<<
std
::
endl
;
std
::
cerr
<<
" old "
<<
old_err
<<
std
::
endl
;
std
::
cerr
<<
" new "
<<
new_err
<<
std
::
endl
;
return
-
1
;
}
}
}
return
0
;
return
0
;
...
...
This diff is collapsed.
Click to expand it.
unitTesting/test_python_ok.py
0 → 100644
+
10
−
0
View file @
4c192704
import
sys
,
os
import
re
pkgConfigPath
=
os
.
environ
.
get
(
"
PKG_CONFIG_PATH
"
)
if
pkgConfigPath
==
None
:
pkgConfigPath
=
''
pathList
=
re
.
split
(
'
:
'
,
pkgConfigPath
)
print
pathList
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment