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

Unified Diff: tools/gn/ninja_copy_target_writer_unittest.cc

Issue 693443002: Make the gn copy() tool honor dependencies. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix formatting Created 6 years, 2 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_copy_target_writer.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/ninja_copy_target_writer_unittest.cc
diff --git a/tools/gn/ninja_copy_target_writer_unittest.cc b/tools/gn/ninja_copy_target_writer_unittest.cc
index 56942db2f84165a8436e65e146e50c80c59671b1..12496bf0f82ba0c7faba18242664eaa7bbcd821f 100644
--- a/tools/gn/ninja_copy_target_writer_unittest.cc
+++ b/tools/gn/ninja_copy_target_writer_unittest.cc
@@ -10,7 +10,7 @@
#include "tools/gn/target.h"
#include "tools/gn/test_with_scope.h"
-// Tests mutliple files with an output pattern and no toolchain dependency.
+// Tests multiple files with an output pattern and no toolchain dependency.
TEST(NinjaCopyTargetWriter, Run) {
TestWithScope setup;
Err err;
@@ -71,3 +71,33 @@ TEST(NinjaCopyTargetWriter, ToolchainDeps) {
std::string out_str = out.str();
EXPECT_EQ(expected_linux, out_str);
}
+
+TEST(NinjaCopyTargetWriter, OrderOnlyDeps) {
+ TestWithScope setup;
+ Err err;
+
+ setup.settings()->set_target_os(Settings::LINUX);
+ setup.build_settings()->SetBuildDir(SourceDir("//out/Debug/"));
+
+ Target target(setup.settings(), Label(SourceDir("//foo/"), "bar"));
+ target.set_output_type(Target::COPY_FILES);
+ target.sources().push_back(SourceFile("//foo/input1.txt"));
+ target.action_values().outputs() =
+ SubstitutionList::MakeForTest("//out/Debug/{{source_name_part}}.out");
+ target.inputs().push_back(SourceFile("//foo/script.py"));
+ target.SetToolchain(setup.toolchain());
+ ASSERT_TRUE(target.OnResolved(&err));
+
+ std::ostringstream out;
+ NinjaCopyTargetWriter writer(&target, out);
+ writer.Run();
+
+ const char expected_linux[] =
+ "build obj/foo/bar.inputdeps.stamp: stamp ../../foo/script.py\n"
+ "build input1.out: copy ../../foo/input1.txt || "
+ "obj/foo/bar.inputdeps.stamp\n"
+ "\n"
+ "build obj/foo/bar.stamp: stamp input1.out\n";
+ std::string out_str = out.str();
+ EXPECT_EQ(expected_linux, out_str);
+}
« no previous file with comments | « tools/gn/ninja_copy_target_writer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698