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

Side by Side Diff: tools/gn/target_unittest.cc

Issue 583363003: GN: Fix dependency output file handling. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 unified diff | Download patch
« no previous file with comments | « tools/gn/target.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "testing/gtest/include/gtest/gtest.h" 5 #include "testing/gtest/include/gtest/gtest.h"
6 #include "tools/gn/build_settings.h" 6 #include "tools/gn/build_settings.h"
7 #include "tools/gn/config.h" 7 #include "tools/gn/config.h"
8 #include "tools/gn/settings.h" 8 #include "tools/gn/settings.h"
9 #include "tools/gn/target.h" 9 #include "tools/gn/target.h"
10 #include "tools/gn/test_with_scope.h" 10 #include "tools/gn/test_with_scope.h"
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 // Depending on the forward target should apply the config. 472 // Depending on the forward target should apply the config.
473 Target dep_on_forward(setup.settings(), Label(SourceDir("//a/"), "dof")); 473 Target dep_on_forward(setup.settings(), Label(SourceDir("//a/"), "dof"));
474 dep_on_forward.set_output_type(Target::SOURCE_SET); 474 dep_on_forward.set_output_type(Target::SOURCE_SET);
475 dep_on_forward.visibility().SetPublic(); 475 dep_on_forward.visibility().SetPublic();
476 dep_on_forward.SetToolchain(setup.toolchain()); 476 dep_on_forward.SetToolchain(setup.toolchain());
477 dep_on_forward.private_deps().push_back(LabelTargetPair(&forward)); 477 dep_on_forward.private_deps().push_back(LabelTargetPair(&forward));
478 ASSERT_TRUE(dep_on_forward.OnResolved(&err)); 478 ASSERT_TRUE(dep_on_forward.OnResolved(&err));
479 ASSERT_EQ(1u, dep_on_forward.configs().size()); 479 ASSERT_EQ(1u, dep_on_forward.configs().size());
480 EXPECT_EQ(&pub_config, dep_on_forward.configs()[0].ptr); 480 EXPECT_EQ(&pub_config, dep_on_forward.configs()[0].ptr);
481 } 481 }
482
483 // Tests that different link/depend outputs work for solink tools.
484 TEST(Target, LinkAndDepOutputs) {
485 TestWithScope setup;
486 Err err;
487
488 Toolchain toolchain(setup.settings(), Label(SourceDir("//tc/"), "tc"));
489
490 scoped_ptr<Tool> solink_tool(new Tool());
491 solink_tool->set_output_prefix("lib");
492 solink_tool->set_default_output_extension(".so");
493
494 const char kLinkPattern[] =
495 "{{root_out_dir}}/{{target_output_name}}{{output_extension}}";
496 SubstitutionPattern link_output = SubstitutionPattern::MakeForTest(
497 kLinkPattern);
498 solink_tool->set_link_output(link_output);
499
500 const char kDependPattern[] =
501 "{{root_out_dir}}/{{target_output_name}}{{output_extension}}.TOC";
502 SubstitutionPattern depend_output = SubstitutionPattern::MakeForTest(
503 kDependPattern);
504 solink_tool->set_depend_output(depend_output);
505
506 solink_tool->set_outputs(SubstitutionList::MakeForTest(
507 kLinkPattern, kDependPattern));
508
509 toolchain.SetTool(Toolchain::TYPE_SOLINK, solink_tool.Pass());
510
511 Target target(setup.settings(), Label(SourceDir("//a/"), "a"));
512 target.set_output_type(Target::SHARED_LIBRARY);
513 target.SetToolchain(&toolchain);
514 ASSERT_TRUE(target.OnResolved(&err));
515
516 EXPECT_EQ("./liba.so", target.link_output_file().value());
517 EXPECT_EQ("./liba.so.TOC", target.dependency_output_file().value());
518 }
OLDNEW
« no previous file with comments | « tools/gn/target.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698