Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(288)

Unified Diff: tools/gn/ninja_target_writer_unittest.cc

Issue 350743004: Allow dependencies of toolchains in GN. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/gn/ninja_target_writer.cc ('k') | tools/gn/toolchain.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/ninja_target_writer_unittest.cc
diff --git a/tools/gn/ninja_target_writer_unittest.cc b/tools/gn/ninja_target_writer_unittest.cc
index 741c410f0fb5dab6f163b8bd9c6cd35a4afd1442..fe4c9a6d9340426c843ffec5c44dd5bb2de594c2 100644
--- a/tools/gn/ninja_target_writer_unittest.cc
+++ b/tools/gn/ninja_target_writer_unittest.cc
@@ -97,3 +97,31 @@ TEST(NinjaTargetWriter, WriteInputDepsStampAndGetDep) {
stream.str());
}
}
+
+// Tests WriteInputDepsStampAndGetDep when toolchain deps are present.
+TEST(NinjaTargetWriter, WriteInputDepsStampAndGetDepWithToolchainDeps) {
+ TestWithScope setup;
+
+ // Toolchain dependency. Here we make a target in the same toolchain for
+ // simplicity, but in real life (using the Builder) this would be rejected
+ // because it would be a circular dependency (the target depends on its
+ // toolchain, and the toolchain depends on this target).
+ Target toolchain_dep_target(setup.settings(),
+ Label(SourceDir("//foo/"), "setup"));
+ toolchain_dep_target.set_output_type(Target::ACTION);
+ setup.toolchain()->deps().push_back(LabelTargetPair(&toolchain_dep_target));
+
+ // Make a binary target
+ Target target(setup.settings(), Label(SourceDir("//foo/"), "target"));
+ target.set_output_type(Target::EXECUTABLE);
+
+ std::ostringstream stream;
+ TestingNinjaTargetWriter writer(&target, setup.toolchain(), stream);
+ std::string dep =
+ writer.WriteInputDepsStampAndGetDep(std::vector<const Target*>());
+
+ EXPECT_EQ(" | obj/foo/target.inputdeps.stamp", dep);
+ EXPECT_EQ("build obj/foo/target.inputdeps.stamp: stamp "
+ "obj/foo/setup.stamp\n",
+ stream.str());
+}
« no previous file with comments | « tools/gn/ninja_target_writer.cc ('k') | tools/gn/toolchain.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698