public abstract class CxxTest extends AbstractBuildRuleWithDeclaredAndExtraDeps implements TestRule, HasRuntimeDeps, BinaryBuildRule, ExternalTestRunnerRule
BuildRule which houses the logic to run and form the results for C/C++ tests.TestRule.TestReportingCallbackNOOP_REPORTING_CALLBACK| Constructor and Description |
|---|
CxxTest(BuildTarget buildTarget,
ProjectFilesystem projectFilesystem,
BuildRuleParams params,
BuildRule binary,
Tool executable,
com.google.common.collect.ImmutableMap<String,Arg> env,
com.google.common.collect.ImmutableList<Arg> args,
com.google.common.collect.ImmutableSortedSet<? extends SourcePath> resources,
com.google.common.collect.ImmutableSet<SourcePath> additionalCoverageTargets,
java.util.function.Function<SourcePathRuleFinder,com.google.common.collect.ImmutableSortedSet<BuildRule>> additionalDepsSupplier,
com.google.common.collect.ImmutableSet<String> labels,
com.google.common.collect.ImmutableSet<String> contacts,
boolean runTestSeparately,
Optional<Long> testRuleTimeoutMs,
com.facebook.buck.cxx.CxxTestType cxxTestType) |
| Modifier and Type | Method and Description |
|---|---|
protected com.google.common.collect.ImmutableSet<SourcePath> |
getAdditionalCoverageTargets() |
protected com.google.common.collect.ImmutableList<Arg> |
getArgs() |
com.google.common.collect.ImmutableList<Step> |
getBuildSteps(BuildContext context,
BuildableContext buildableContext) |
com.google.common.collect.ImmutableSet<String> |
getContacts() |
protected com.google.common.collect.ImmutableMap<String,String> |
getEnv(SourcePathResolverAdapter pathResolver) |
Tool |
getExecutableCommand(OutputLabel outputLabel)
Command to execute the output of this rule.
|
ExternalTestSpec |
getExternalTestRunnerSpec(ExecutionContext executionContext,
TestRunningOptions testRunningOptions,
BuildContext buildContext) |
com.google.common.collect.ImmutableSet<String> |
getLabels() |
protected Path |
getPathToTestExitCode() |
protected Path |
getPathToTestOutput() |
Path |
getPathToTestOutputDirectory() |
protected Path |
getPathToTestResults() |
java.util.stream.Stream<BuildTarget> |
getRuntimeDeps(BuildRuleResolver buildRuleResolver) |
protected abstract com.google.common.collect.ImmutableList<String> |
getShellCommand(SourcePathResolverAdapter pathResolver,
Path output) |
SourcePath |
getSourcePathToOutput() |
Callable<TestResults> |
interpretTestResults(ExecutionContext executionContext,
SourcePathResolverAdapter pathResolver,
boolean isUsingTestSelectors) |
protected abstract com.google.common.collect.ImmutableList<TestResultSummary> |
parseResults(Path exitCode,
Path output,
Path results) |
com.google.common.collect.ImmutableList<Step> |
runTests(ExecutionContext executionContext,
TestRunningOptions options,
BuildContext buildContext,
TestRule.TestReportingCallback testReportingCallback)
Returns the commands required to run the tests.
|
boolean |
runTestSeparately() |
boolean |
supportsStreamingTests() |
deprecatedGetExtraDeps, getBuildDeps, getDeclaredDeps, getTargetGraphOnlyDepsequals, getBuildTarget, getDependencies, getProjectFilesystem, getSourcePathOutputs, getType, hasBuildSteps, hashCode, injectFields, isCacheable, toString, updateBuildRuleResolverclone, finalize, getClass, notify, notifyAll, wait, wait, waitonPreTestcompareTo, getBuildDeps, getBuildTarget, getFullyQualifiedName, getProjectFilesystem, hasBuildSteps, isCacheable, outputFileCanBeCopied, shouldRespectInputSizeLimitForRemoteExecution, toString, updateBuildRuleResolvergetDependencies, getSourcePathOutputsgetTypepublic CxxTest(BuildTarget buildTarget, ProjectFilesystem projectFilesystem, BuildRuleParams params, BuildRule binary, Tool executable, com.google.common.collect.ImmutableMap<String,Arg> env, com.google.common.collect.ImmutableList<Arg> args, com.google.common.collect.ImmutableSortedSet<? extends SourcePath> resources, com.google.common.collect.ImmutableSet<SourcePath> additionalCoverageTargets, java.util.function.Function<SourcePathRuleFinder,com.google.common.collect.ImmutableSortedSet<BuildRule>> additionalDepsSupplier, com.google.common.collect.ImmutableSet<String> labels, com.google.common.collect.ImmutableSet<String> contacts, boolean runTestSeparately, Optional<Long> testRuleTimeoutMs, com.facebook.buck.cxx.CxxTestType cxxTestType)
public SourcePath getSourcePathToOutput()
getSourcePathToOutput in interface BuildRulepublic Tool getExecutableCommand(OutputLabel outputLabel)
BinaryBuildRulegetExecutableCommand in interface BinaryBuildRuleoutputLabel - associated with the executablepublic final com.google.common.collect.ImmutableList<Step> getBuildSteps(BuildContext context, BuildableContext buildableContext)
getBuildSteps in interface BuildRuleprotected Path getPathToTestExitCode()
protected Path getPathToTestOutput()
protected Path getPathToTestResults()
protected abstract com.google.common.collect.ImmutableList<String> getShellCommand(SourcePathResolverAdapter pathResolver, Path output)
public com.google.common.collect.ImmutableList<Step> runTests(ExecutionContext executionContext, TestRunningOptions options, BuildContext buildContext, TestRule.TestReportingCallback testReportingCallback)
TestRuleNote: This method may be run without BuildEngine.build(com.facebook.buck.core.build.engine.BuildEngineBuildContext,
ExecutionContext, BuildRule) having been run. This happens if the user has built [and ran] the
test previously and then re-runs it using the --debug flag.
protected abstract com.google.common.collect.ImmutableList<TestResultSummary> parseResults(Path exitCode, Path output, Path results) throws Exception
Exceptionpublic Callable<TestResults> interpretTestResults(ExecutionContext executionContext, SourcePathResolverAdapter pathResolver, boolean isUsingTestSelectors)
interpretTestResults in interface TestRulepublic com.google.common.collect.ImmutableSet<String> getLabels()
public com.google.common.collect.ImmutableSet<String> getContacts()
getContacts in interface TestRuleprotected com.google.common.collect.ImmutableSet<SourcePath> getAdditionalCoverageTargets()
public Path getPathToTestOutputDirectory()
getPathToTestOutputDirectory in interface TestRulepublic boolean runTestSeparately()
runTestSeparately in interface TestRulepublic boolean supportsStreamingTests()
supportsStreamingTests in interface TestRulerunTests() on this rule invokes the callbacks in testReportingCallback as the tests run, false otherwise.public java.util.stream.Stream<BuildTarget> getRuntimeDeps(BuildRuleResolver buildRuleResolver)
getRuntimeDeps in interface HasRuntimeDepspublic ExternalTestSpec getExternalTestRunnerSpec(ExecutionContext executionContext, TestRunningOptions testRunningOptions, BuildContext buildContext)
getExternalTestRunnerSpec in interface ExternalTestRunnerRuleprotected com.google.common.collect.ImmutableMap<String,String> getEnv(SourcePathResolverAdapter pathResolver)
protected com.google.common.collect.ImmutableList<Arg> getArgs()