Index: tools/gn/ninja_action_target_writer_unittest.cc |
diff --git a/tools/gn/ninja_action_target_writer_unittest.cc b/tools/gn/ninja_action_target_writer_unittest.cc |
index 3e00c999eaa4195605f233be62ea73c793119350..21f3de15276ce99cda21a75b57d688e3adde33ae 100644 |
--- a/tools/gn/ninja_action_target_writer_unittest.cc |
+++ b/tools/gn/ninja_action_target_writer_unittest.cc |
@@ -169,8 +169,20 @@ TEST(NinjaActionTargetWriter, ActionWithSources) { |
TEST(NinjaActionTargetWriter, ForEach) { |
TestWithScope setup; |
setup.build_settings()->SetBuildDir(SourceDir("//out/Debug/")); |
+ |
+ // Some dependencies that the action can depend on. Use actions for these |
+ // so they have a nice platform-independent stamp file that can appear in the |
+ // output (rather than having to worry about how the current platform names |
+ // binaries). |
+ Target dep(setup.settings(), Label(SourceDir("//foo/"), "dep")); |
+ dep.set_output_type(Target::ACTION); |
+ Target datadep(setup.settings(), Label(SourceDir("//foo/"), "datadep")); |
+ datadep.set_output_type(Target::ACTION); |
+ |
Target target(setup.settings(), Label(SourceDir("//foo/"), "bar")); |
target.set_output_type(Target::ACTION_FOREACH); |
+ target.deps().push_back(LabelTargetPair(&dep)); |
+ target.datadeps().push_back(LabelTargetPair(&datadep)); |
target.sources().push_back(SourceFile("//foo/input1.txt")); |
target.sources().push_back(SourceFile("//foo/input2.txt")); |
@@ -203,7 +215,8 @@ TEST(NinjaActionTargetWriter, ForEach) { |
"\"--out=foo$ bar${source_name_part}.o\"\n" |
" description = ACTION //foo:bar()\n" |
" restat = 1\n" |
- "obj/foo/bar.inputdeps.stamp: stamp ../../foo/included.txt\n" |
+ "obj/foo/bar.inputdeps.stamp: " |
+ "stamp ../../foo/included.txt obj/foo/dep.stamp\n" |
"\n" |
"build input1.out: __foo_bar___rule ../../foo/input1.txt | " |
"obj/foo/bar.inputdeps.stamp\n" |
@@ -214,7 +227,8 @@ TEST(NinjaActionTargetWriter, ForEach) { |
" source = ../../foo/input2.txt\n" |
" source_name_part = input2\n" |
"\n" |
- "build obj/foo/bar.stamp: stamp input1.out input2.out\n"; |
+ "build obj/foo/bar.stamp: " |
+ "stamp input1.out input2.out obj/foo/datadep.stamp\n"; |
std::string out_str = out.str(); |
#if defined(OS_WIN) |
@@ -246,7 +260,8 @@ TEST(NinjaActionTargetWriter, ForEach) { |
" rspfile = __foo_bar___rule.$unique_name.rsp\n" |
" rspfile_content = C$:/python/python.exe ../../foo/script.py -i " |
"${source} \"--out=foo$ bar${source_name_part}.o\"\n" |
- "obj/foo/bar.inputdeps.stamp: stamp ../../foo/included.txt\n" |
+ "obj/foo/bar.inputdeps.stamp: " |
+ "stamp ../../foo/included.txt obj/foo/dep.stamp\n" |
"\n" |
"build input1.out: __foo_bar___rule ../../foo/input1.txt | " |
"obj/foo/bar.inputdeps.stamp\n" |
@@ -259,7 +274,8 @@ TEST(NinjaActionTargetWriter, ForEach) { |
" source = ../../foo/input2.txt\n" |
" source_name_part = input2\n" |
"\n" |
- "build obj/foo/bar.stamp: stamp input1.out input2.out\n"; |
+ "build obj/foo/bar.stamp: " |
+ "stamp input1.out input2.out obj/foo/datadep.stamp\n"; |
std::string out_str = out.str(); |
#if defined(OS_WIN) |
std::replace(out_str.begin(), out_str.end(), '\\', '/'); |