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; |