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

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

Issue 279023002: Add GN function get_label_info (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review comment Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « tools/gn/BUILD.gn ('k') | tools/gn/filesystem_utils.h » ('j') | 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/builder.h" 6 #include "tools/gn/builder.h"
7 #include "tools/gn/loader.h" 7 #include "tools/gn/loader.h"
8 #include "tools/gn/target.h" 8 #include "tools/gn/target.h"
9 #include "tools/gn/test_with_scope.h" 9 #include "tools/gn/test_with_scope.h"
10 #include "tools/gn/toolchain.h" 10 #include "tools/gn/toolchain.h"
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 EXPECT_TRUE(a_record->waiting_on_resolution().empty()); 171 EXPECT_TRUE(a_record->waiting_on_resolution().empty());
172 EXPECT_TRUE(b_record->waiting_on_resolution().empty()); 172 EXPECT_TRUE(b_record->waiting_on_resolution().empty());
173 EXPECT_TRUE(c_record->waiting_on_resolution().empty()); 173 EXPECT_TRUE(c_record->waiting_on_resolution().empty());
174 } 174 }
175 175
176 // Tests that the should generate bit is set and propogated properly. 176 // Tests that the should generate bit is set and propogated properly.
177 TEST_F(BuilderTest, ShouldGenerate) { 177 TEST_F(BuilderTest, ShouldGenerate) {
178 DefineToolchain(); 178 DefineToolchain();
179 179
180 // Define a secondary toolchain. 180 // Define a secondary toolchain.
181 Settings settings2(&build_settings_, "secondary"); 181 Settings settings2(&build_settings_, "secondary/");
182 Label toolchain_label2(SourceDir("//tc/"), "secondary"); 182 Label toolchain_label2(SourceDir("//tc/"), "secondary");
183 settings2.set_toolchain_label(toolchain_label2); 183 settings2.set_toolchain_label(toolchain_label2);
184 Toolchain* tc2 = new Toolchain(&settings2, toolchain_label2); 184 Toolchain* tc2 = new Toolchain(&settings2, toolchain_label2);
185 builder_->ItemDefined(scoped_ptr<Item>(tc2)); 185 builder_->ItemDefined(scoped_ptr<Item>(tc2));
186 186
187 // Construct a dependency chain: A -> B. A is in the default toolchain, B 187 // Construct a dependency chain: A -> B. A is in the default toolchain, B
188 // is not. 188 // is not.
189 Label a_label(SourceDir("//foo/"), "a", 189 Label a_label(SourceDir("//foo/"), "a",
190 settings_.toolchain_label().dir(), "a"); 190 settings_.toolchain_label().dir(), "a");
191 Label b_label(SourceDir("//foo/"), "b", 191 Label b_label(SourceDir("//foo/"), "b",
(...skipping 14 matching lines...) Expand all
206 a->set_output_type(Target::EXECUTABLE); 206 a->set_output_type(Target::EXECUTABLE);
207 builder_->ItemDefined(scoped_ptr<Item>(a)); 207 builder_->ItemDefined(scoped_ptr<Item>(a));
208 208
209 // A should have the generate bit set since it's in the default toolchain. 209 // A should have the generate bit set since it's in the default toolchain.
210 BuilderRecord* a_record = builder_->GetRecord(a_label); 210 BuilderRecord* a_record = builder_->GetRecord(a_label);
211 EXPECT_TRUE(a_record->should_generate()); 211 EXPECT_TRUE(a_record->should_generate());
212 212
213 // It should have gotten pushed to B. 213 // It should have gotten pushed to B.
214 EXPECT_TRUE(b_record->should_generate()); 214 EXPECT_TRUE(b_record->should_generate());
215 } 215 }
OLDNEW
« no previous file with comments | « tools/gn/BUILD.gn ('k') | tools/gn/filesystem_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698