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

Unified Diff: tools/gn/target_unittest.cc

Issue 1690843002: gn: Add runtime_link_output to tool("solib") (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: e Created 4 years, 10 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/target.cc ('k') | tools/gn/tool.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/target_unittest.cc
diff --git a/tools/gn/target_unittest.cc b/tools/gn/target_unittest.cc
index c99ebe84757264d150022728dde53743b40fa103..8376fffcd5670eb69c752763f05d47ca744f4298 100644
--- a/tools/gn/target_unittest.cc
+++ b/tools/gn/target_unittest.cc
@@ -457,6 +457,46 @@ TEST(Target, LinkAndDepOutputs) {
EXPECT_EQ("./liba.so", target.link_output_file().value());
EXPECT_EQ("./liba.so.TOC", target.dependency_output_file().value());
+ EXPECT_EQ("./liba.so", target.runtime_link_output_file().value());
+}
+
+// Tests that runtime_link output works without an explicit link_output for
+// solink tools.
+TEST(Target, RuntimeLinkOuput) {
+ TestWithScope setup;
+ Err err;
+
+ Toolchain toolchain(setup.settings(), Label(SourceDir("//tc/"), "tc"));
+
+ scoped_ptr<Tool> solink_tool(new Tool());
+ solink_tool->set_output_prefix("");
+ solink_tool->set_default_output_extension(".dll");
+
+ const char kLibPattern[] =
+ "{{root_out_dir}}/{{target_output_name}}{{output_extension}}.lib";
+ SubstitutionPattern lib_output =
+ SubstitutionPattern::MakeForTest(kLibPattern);
+
+ const char kDllPattern[] =
+ "{{root_out_dir}}/{{target_output_name}}{{output_extension}}";
+ SubstitutionPattern dll_output =
+ SubstitutionPattern::MakeForTest(kDllPattern);
+
+ solink_tool->set_outputs(
+ SubstitutionList::MakeForTest(kLibPattern, kDllPattern));
+
+ solink_tool->set_runtime_link_output(dll_output);
+
+ toolchain.SetTool(Toolchain::TYPE_SOLINK, std::move(solink_tool));
+
+ Target target(setup.settings(), Label(SourceDir("//a/"), "a"));
+ target.set_output_type(Target::SHARED_LIBRARY);
+ target.SetToolchain(&toolchain);
+ ASSERT_TRUE(target.OnResolved(&err));
+
+ EXPECT_EQ("./a.dll.lib", target.link_output_file().value());
+ EXPECT_EQ("./a.dll.lib", target.dependency_output_file().value());
+ EXPECT_EQ("./a.dll", target.runtime_link_output_file().value());
}
// Shared libraries should be inherited across public shared liobrary
« no previous file with comments | « tools/gn/target.cc ('k') | tools/gn/tool.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698