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

Unified Diff: tools/gn/ninja_action_target_writer_unittest.cc

Issue 1358803002: Add ninja console pool support to GN (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update action/action_foreach doc Created 5 years, 3 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_action_target_writer.cc ('k') | tools/gn/variables.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/ninja_action_target_writer_unittest.cc
diff --git a/tools/gn/ninja_action_target_writer_unittest.cc b/tools/gn/ninja_action_target_writer_unittest.cc
index 74f155baea35b58ee7ee835f9bd6eb2ba270115c..99adf1f7c0a1240fd6a03b1821e598566ca6416c 100644
--- a/tools/gn/ninja_action_target_writer_unittest.cc
+++ b/tools/gn/ninja_action_target_writer_unittest.cc
@@ -76,6 +76,49 @@ TEST(NinjaActionTargetWriter, ActionNoSources) {
EXPECT_EQ(expected, out.str());
}
+
+// Tests an action with no sources and console = true
+TEST(NinjaActionTargetWriter, ActionNoSourcesConsole) {
+ TestWithScope setup;
+ Err err;
+
+ setup.build_settings()->SetBuildDir(SourceDir("//out/Debug/"));
+ Target target(setup.settings(), Label(SourceDir("//foo/"), "bar"));
+ target.set_output_type(Target::ACTION);
+
+ target.action_values().set_script(SourceFile("//foo/script.py"));
+ target.inputs().push_back(SourceFile("//foo/included.txt"));
+
+ target.action_values().outputs() =
+ SubstitutionList::MakeForTest("//out/Debug/foo.out");
+ target.action_values().set_console(true);
+
+ target.SetToolchain(setup.toolchain());
+ ASSERT_TRUE(target.OnResolved(&err));
+
+ setup.settings()->set_target_os(Settings::LINUX);
+ setup.build_settings()->set_python_path(base::FilePath(FILE_PATH_LITERAL(
+ "/usr/bin/python")));
+
+ std::ostringstream out;
+ NinjaActionTargetWriter writer(&target, out);
+ writer.Run();
+
+ const char expected[] =
+ "rule __foo_bar___rule\n"
+ " command = /usr/bin/python ../../foo/script.py\n"
+ " description = ACTION //foo:bar()\n"
+ " restat = 1\n"
+ "build obj/foo/bar.inputdeps.stamp: stamp ../../foo/script.py "
+ "../../foo/included.txt\n"
+ "\n"
+ "build foo.out: __foo_bar___rule | obj/foo/bar.inputdeps.stamp\n"
+ " pool = console\n"
+ "\n"
+ "build obj/foo/bar.stamp: stamp foo.out\n";
+ EXPECT_EQ(expected, out.str());
+}
+
// Makes sure that we write sources as input dependencies for actions with
// both sources and inputs (ACTION_FOREACH treats the sources differently).
TEST(NinjaActionTargetWriter, ActionWithSources) {
« no previous file with comments | « tools/gn/ninja_action_target_writer.cc ('k') | tools/gn/variables.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698