Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Alchemy Viewer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Silent mode is enabled
All outbound communications are blocked.
Learn more
.
Show more breadcrumbs
Alchemy Viewer
Alchemy Viewer
Commits
d4f887e4
Commit
d4f887e4
authored
13 years ago
by
Nat Goodspeed
Browse files
Options
Downloads
Patches
Plain Diff
Add unit tests for LLProcess::Status functionality.
parent
0f2882ec
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
indra/llcommon/tests/llprocess_test.cpp
+44
-2
44 additions, 2 deletions
indra/llcommon/tests/llprocess_test.cpp
with
44 additions
and
2 deletions
indra/llcommon/tests/llprocess_test.cpp
+
44
−
2
View file @
d4f887e4
...
...
@@ -555,6 +555,41 @@ namespace tut
template
<
>
template
<
>
void
object
::
test
<
4
>
()
{
set_test_name
(
"exit(0)"
);
PythonProcessLauncher
py
(
"exit(0)"
,
"import sys
\n
"
"sys.exit(0)
\n
"
);
py
.
run
();
ensure_equals
(
"Status.mState"
,
py
.
mPy
->
getStatus
().
mState
,
LLProcess
::
EXITED
);
ensure_equals
(
"Status.mData"
,
py
.
mPy
->
getStatus
().
mData
,
0
);
}
template
<
>
template
<
>
void
object
::
test
<
5
>
()
{
set_test_name
(
"exit(2)"
);
PythonProcessLauncher
py
(
"exit(2)"
,
"import sys
\n
"
"sys.exit(2)
\n
"
);
py
.
run
();
ensure_equals
(
"Status.mState"
,
py
.
mPy
->
getStatus
().
mState
,
LLProcess
::
EXITED
);
ensure_equals
(
"Status.mData"
,
py
.
mPy
->
getStatus
().
mData
,
2
);
}
template
<
>
template
<
>
void
object
::
test
<
6
>
()
{
set_test_name
(
"syntax_error:"
);
PythonProcessLauncher
py
(
"syntax_error:"
,
"syntax_error:
\n
"
);
py
.
run
();
ensure_equals
(
"Status.mState"
,
py
.
mPy
->
getStatus
().
mState
,
LLProcess
::
EXITED
);
ensure_equals
(
"Status.mData"
,
py
.
mPy
->
getStatus
().
mData
,
1
);
}
template
<
>
template
<
>
void
object
::
test
<
7
>
()
{
set_test_name
(
"explicit kill()"
);
PythonProcessLauncher
py
(
"kill()"
,
...
...
@@ -588,6 +623,13 @@ namespace tut
{
sleep
(
1
);
}
#if LL_WINDOWS
ensure_equals
(
"Status.mState"
,
py
.
mPy
->
getStatus
().
mState
,
LLProcess
::
EXITED
);
ensure_equals
(
"Status.mData"
,
py
.
mPy
->
getStatus
().
mData
,
-
1
);
#else
ensure_equals
(
"Status.mState"
,
py
.
mPy
->
getStatus
().
mState
,
LLProcess
::
KILLED
);
ensure_equals
(
"Status.mData"
,
py
.
mPy
->
getStatus
().
mData
,
SIGTERM
);
#endif
// If kill() failed, the script would have woken up on its own and
// overwritten the file with 'bad'. But if kill() succeeded, it should
// not have had that chance.
...
...
@@ -595,7 +637,7 @@ namespace tut
}
template
<
>
template
<
>
void
object
::
test
<
5
>
()
void
object
::
test
<
8
>
()
{
set_test_name
(
"implicit kill()"
);
NamedTempFile
out
(
"out"
,
"not started"
);
...
...
@@ -641,7 +683,7 @@ namespace tut
}
template
<
>
template
<
>
void
object
::
test
<
6
>
()
void
object
::
test
<
9
>
()
{
set_test_name
(
"autokill=false"
);
NamedTempFile
from
(
"from"
,
"not started"
);
...
...
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