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

Unified Diff: tools/gn/target_unittest.cc

Issue 1607423002: Allow .o files for GN generated inputs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comment fix Created 4 years, 11 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') | no next file » | 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 4d9b1da8b8fa56c14cf1cac8d12ed9fa9621768d..c59f44c0717de4f6f19fb14df8f18eea98ea5220 100644
--- a/tools/gn/target_unittest.cc
+++ b/tools/gn/target_unittest.cc
@@ -587,6 +587,31 @@ TEST(Target, WriteFileGeneratedInputs) {
EXPECT_TRUE(scheduler.GetUnknownGeneratedInputs().empty());
}
+// Tests that intermediate object files generated by binary targets are also
+// considered generated for the purposes of input checking. Above, we tested
+// the failure cases for generated inputs, so here only test .o files that are
+// present.
+TEST(Target, ObjectGeneratedInputs) {
+ Scheduler scheduler;
+ TestWithScope setup;
+ Err err;
+
+ // This target compiles the source.
+ SourceFile source_file("//source.cc");
+ TestTarget source_generator(setup, "//:source_target", Target::SOURCE_SET);
+ source_generator.sources().push_back(source_file);
+ EXPECT_TRUE(source_generator.OnResolved(&err));
+
+ // This is the object file that the test toolchain generates for the source.
+ SourceFile object_file("//out/Debug/obj/source_target.source.o");
+
+ TestTarget final_target(setup, "//:final", Target::ACTION);
+ final_target.inputs().push_back(object_file);
+ EXPECT_TRUE(final_target.OnResolved(&err));
+
+ AssertSchedulerHasOneUnknownFileMatching(&final_target, object_file);
+}
+
TEST(Target, ResolvePrecompiledHeaders) {
TestWithScope setup;
Err err;
« 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