Skip to content

Commit

Permalink
Correct dependencies to ignore platforms in tests.
Browse files Browse the repository at this point in the history
Work towards platform-based flags: bazelbuild#19409.

PiperOrigin-RevId: 621936486
Change-Id: Ib5bf2fed705a1c1bd68de3e08d38a8cdf9be9986
  • Loading branch information
katre authored and Kila2 committed May 13, 2024
1 parent 506a7bc commit 35d1db9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ public void testConfig_configHash() throws Exception {
// setting --universe_scope we ensure only the transitioned version exists.
helper.setUniverseScope("//test:buildme");
helper.setQuerySettings(Setting.ONLY_TARGET_DEPS, Setting.NO_IMPLICIT_DEPS);
Set<CqueryNode> result = eval("deps(//test:buildme, 1)");
Set<CqueryNode> result = eval("deps(//test:buildme, 1)" + getDependencyCorrection());
assertThat(result).hasSize(2);

ImmutableList<CqueryNode> stableOrderList = ImmutableList.copyOf(result);
Expand Down Expand Up @@ -531,7 +531,7 @@ public void testConfig_exprArgumentFailure() throws Exception {
public void testExecTransitionNotFilteredByNoToolDeps() throws Exception {
createConfigRulesAndBuild();
helper.setQuerySettings(Setting.ONLY_TARGET_DEPS, Setting.NO_IMPLICIT_DEPS);
assertThat(evalToListOfStrings("deps(//test:my_rule)"))
assertThat(evalToListOfStrings("deps(//test:my_rule)" + getDependencyCorrection()))
.containsExactly("//test:my_rule", "//test:target_dep", "//test:dep");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public final void setUpCqueryOptions() {
this.reporter = new Reporter(new EventBus(), events::add);
}

private List<String> getOutput(String queryExpression) throws Exception {
private ImmutableList<String> getOutput(String queryExpression) throws Exception {
QueryExpression expression = QueryParser.parse(queryExpression, getDefaultFunctions());
Set<String> targetPatternSet = new LinkedHashSet<>();
expression.collectTargetPatterns(targetPatternSet);
Expand All @@ -88,7 +88,7 @@ private List<String> getOutput(String queryExpression) throws Exception {
ct -> env.getFwdDeps(ImmutableList.of(ct)),
LabelPrinter.legacy());
env.evaluateQuery(expression, callback);
return Arrays.asList(output.toString().split(System.lineSeparator()));
return ImmutableList.copyOf(output.toString().split(System.lineSeparator()));
}

/** Convenience method for easily injecting a config hash into an expected output sequence. */
Expand Down Expand Up @@ -207,12 +207,12 @@ public void nullAndToolDeps() throws Exception {
simple_rule(name = "tool_dep")
""");
writeFile("test/file.src");
List<String> output = getOutput("deps(//test:a)");
ImmutableList<String> output = getOutput("deps(//test:a)" + getDependencyCorrection());
String firstNode = output.get(2);
String configHash = firstNode.substring(firstNode.indexOf("(") + 1, firstNode.length() - 2);
String toolNode = output.get(6);
String execConfigHash = toolNode.substring(toolNode.indexOf("(") + 1, toolNode.length() - 2);
assertThat(getOutput("deps(//test:a)"))
assertThat(output)
.isEqualTo(
withConfigHash(
configHash,
Expand Down

0 comments on commit 35d1db9

Please sign in to comment.