Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
lukka
CMake
Commits
1166aa5c
Commit
1166aa5c
authored
Mar 05, 2019
by
Gregor Jasny
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ctest: refactor some code
parent
451d3907
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
21 deletions
+18
-21
Source/CTest/cmCTestRunTest.cxx
Source/CTest/cmCTestRunTest.cxx
+10
-17
Source/CTest/cmProcess.cxx
Source/CTest/cmProcess.cxx
+6
-1
Source/CTest/cmProcess.h
Source/CTest/cmProcess.h
+2
-3
No files found.
Source/CTest/cmCTestRunTest.cxx
View file @
1166aa5c
...
...
@@ -432,32 +432,26 @@ bool cmCTestRunTest::StartTest(size_t completed, size_t total)
this
->
ProcessOutput
.
clear
();
this
->
TestResult
.
Properties
=
this
->
TestProperties
;
this
->
TestResult
.
ExecutionTime
=
cmDuration
::
zero
();
this
->
TestResult
.
CompressOutput
=
false
;
this
->
TestResult
.
ReturnValue
=
-
1
;
this
->
TestResult
.
TestCount
=
this
->
TestProperties
->
Index
;
this
->
TestResult
.
Name
=
this
->
TestProperties
->
Name
;
this
->
TestResult
.
Path
=
this
->
TestProperties
->
Directory
;
// Return immediately if test is disabled
if
(
this
->
TestProperties
->
Disabled
)
{
this
->
TestResult
.
Properties
=
this
->
TestProperties
;
this
->
TestResult
.
ExecutionTime
=
cmDuration
::
zero
();
this
->
TestResult
.
CompressOutput
=
false
;
this
->
TestResult
.
ReturnValue
=
-
1
;
this
->
TestResult
.
CompletionStatus
=
"Disabled"
;
this
->
TestResult
.
Status
=
cmCTestTestHandler
::
NOT_RUN
;
this
->
TestResult
.
TestCount
=
this
->
TestProperties
->
Index
;
this
->
TestResult
.
Name
=
this
->
TestProperties
->
Name
;
this
->
TestResult
.
Path
=
this
->
TestProperties
->
Directory
;
this
->
TestProcess
=
cm
::
make_unique
<
cmProcess
>
(
*
this
);
this
->
TestResult
.
Output
=
"Disabled"
;
this
->
TestResult
.
FullCommandLine
.
clear
();
return
false
;
}
this
->
TestResult
.
Properties
=
this
->
TestProperties
;
this
->
TestResult
.
ExecutionTime
=
cmDuration
::
zero
();
this
->
TestResult
.
CompressOutput
=
false
;
this
->
TestResult
.
ReturnValue
=
-
1
;
this
->
TestResult
.
CompletionStatus
=
"Failed to start"
;
this
->
TestResult
.
Status
=
cmCTestTestHandler
::
BAD_COMMAND
;
this
->
TestResult
.
TestCount
=
this
->
TestProperties
->
Index
;
this
->
TestResult
.
Name
=
this
->
TestProperties
->
Name
;
this
->
TestResult
.
Path
=
this
->
TestProperties
->
Directory
;
// Check for failed fixture dependencies before we even look at the command
// arguments because if we are not going to run the test, the command and
...
...
@@ -635,9 +629,8 @@ bool cmCTestRunTest::ForkProcess(cmDuration testTimeOut, bool explicitTimeout,
{
this
->
TestProcess
=
cm
::
make_unique
<
cmProcess
>
(
*
this
);
this
->
TestProcess
->
SetId
(
this
->
Index
);
this
->
TestProcess
->
SetWorkingDirectory
(
this
->
TestProperties
->
Directory
.
c_str
());
this
->
TestProcess
->
SetCommand
(
this
->
ActualCommand
.
c_str
());
this
->
TestProcess
->
SetWorkingDirectory
(
this
->
TestProperties
->
Directory
);
this
->
TestProcess
->
SetCommand
(
this
->
ActualCommand
);
this
->
TestProcess
->
SetCommandArguments
(
this
->
Arguments
);
// determine how much time we have
...
...
Source/CTest/cmProcess.cxx
View file @
1166aa5c
...
...
@@ -73,7 +73,7 @@ cmProcess::cmProcess(cmCTestRunTest& runner)
cmProcess
::~
cmProcess
()
=
default
;
void
cmProcess
::
SetCommand
(
const
char
*
command
)
void
cmProcess
::
SetCommand
(
std
::
string
const
&
command
)
{
this
->
Command
=
command
;
}
...
...
@@ -83,6 +83,11 @@ void cmProcess::SetCommandArguments(std::vector<std::string> const& args)
this
->
Arguments
=
args
;
}
void
cmProcess
::
SetWorkingDirectory
(
std
::
string
const
&
dir
)
{
this
->
WorkingDirectory
=
dir
;
}
bool
cmProcess
::
StartProcess
(
uv_loop_t
&
loop
,
std
::
vector
<
size_t
>*
affinity
)
{
this
->
ProcessState
=
cmProcess
::
State
::
Error
;
...
...
Source/CTest/cmProcess.h
View file @
1166aa5c
...
...
@@ -28,10 +28,9 @@ class cmProcess
public:
explicit
cmProcess
(
cmCTestRunTest
&
runner
);
~
cmProcess
();
const
char
*
GetCommand
()
{
return
this
->
Command
.
c_str
();
}
void
SetCommand
(
const
char
*
command
);
void
SetCommand
(
std
::
string
const
&
command
);
void
SetCommandArguments
(
std
::
vector
<
std
::
string
>
const
&
arg
);
void
SetWorkingDirectory
(
const
char
*
dir
)
{
this
->
WorkingDirectory
=
dir
;
}
void
SetWorkingDirectory
(
std
::
string
const
&
dir
)
;
void
SetTimeout
(
cmDuration
t
)
{
this
->
Timeout
=
t
;
}
void
ChangeTimeout
(
cmDuration
t
);
void
ResetStartTime
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment