Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F1081440
PantsTestEngine.php
No One
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
cburroughs
Jan 29 2016, 7:09 PM
2016-01-29 19:09:27 (UTC+0)
Size
1 KB
Referenced Files
None
Subscribers
None
PantsTestEngine.php
View Options
<?php
final
class
PantsTestEngine
extends
ArcanistUnitTestEngine
{
public
function
getEngineConfigurationName
()
{
return
"pants"
;
}
public
function
run
()
{
$projectRoot
=
$this
->
getWorkingCopy
()->
getProjectRoot
();
$xunit_dir
=
Filesystem
::
createTemporaryDirectory
();
$future
=
$this
->
buildTestFuture
(
$xunit_dir
);
$future
->
setCWD
(
$projectRoot
);
list
(
$err
,
$stdout
,
$stderr
)
=
$future
->
resolve
();
$results
=
array
();
$xunit_files
=
glob
(
Filesystem
::
resolvePath
(
$xunit_dir
.
"/*.xml"
));
foreach
(
$xunit_files
as
$xunit_file
)
{
$results
[]
=
$this
->
parseTestResults
(
$xunit_file
);
}
Filesystem
::
remove
(
$xunit_dir
);
return
array_mergev
(
$results
);
}
public
function
buildTestFuture
(
$xunit_dir
)
{
$paths
=
$this
->
getPaths
();
$cmd_line
=
csprintf
(
'./pants test-changed --test-changed-include-dependees=transitive --test-changed-parent=origin/master --test-pytest-junit-xml-dir=%s'
,
$xunit_dir
);
return
new
ExecFuture
(
'%C'
,
$cmd_line
);
}
public
function
parseTestResults
(
$xunit_file
)
{
$parser
=
new
ArcanistXUnitTestResultParser
();
$results
=
$parser
->
parseTestResults
(
Filesystem
::
readFile
(
$xunit_file
));
return
$results
;
}
}
File Metadata
Details
Attached
Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33378
Default Alt Text
PantsTestEngine.php (1 KB)
Attached To
Mode
P1934 PantsTestEngine.php
Attached
Detach File
Event Timeline
Log In to Comment