Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <sstream> | 6 #include <sstream> |
| 7 | 7 |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 #include "tools/gn/file_template.h" | 9 #include "tools/gn/file_template.h" |
| 10 #include "tools/gn/ninja_script_target_writer.h" | 10 #include "tools/gn/ninja_script_target_writer.h" |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 84 // Posix. | 84 // Posix. |
| 85 { | 85 { |
| 86 setup.settings()->set_target_os(Settings::LINUX); | 86 setup.settings()->set_target_os(Settings::LINUX); |
| 87 | 87 |
| 88 std::ostringstream out; | 88 std::ostringstream out; |
| 89 NinjaScriptTargetWriter writer(&target, out); | 89 NinjaScriptTargetWriter writer(&target, out); |
| 90 writer.Run(); | 90 writer.Run(); |
| 91 | 91 |
| 92 const char expected_linux[] = | 92 const char expected_linux[] = |
| 93 "rule __foo_bar___rule\n" | 93 "rule __foo_bar___rule\n" |
| 94 " command = cd ../../foo; $pythonpath ../../foo/script.py -i ${source} \"--out=foo$ bar${source_name_part}.o\"\n" | 94 " command = $pythonpath ../../foo/script.py -i ${source} \"--out=foo$ b ar${source_name_part}.o\"\n" |
|
brettw
2013/10/23 16:27:05
I guess you'll have to update this, maybe you'll n
koz (OOO until 15th September)
2013/10/24 05:56:28
Done.
| |
| 95 " description = CUSTOM //foo:bar()\n" | 95 " description = CUSTOM //foo:bar()\n" |
| 96 " restat = 1\n" | 96 " restat = 1\n" |
| 97 "\n" | 97 "\n" |
| 98 "build input1.out: __foo_bar___rule../../foo/input1.txt | ../../foo/incl uded.txt\n" | 98 "build input1.out: __foo_bar___rule ../../foo/input1.txt | ../../foo/inc luded.txt\n" |
| 99 " source = ../../foo/input1.txt\n" | 99 " source = ../../foo/input1.txt\n" |
| 100 " source_name_part = input1\n" | 100 " source_name_part = input1\n" |
| 101 "build input2.out: __foo_bar___rule../../foo/input2.txt | ../../foo/incl uded.txt\n" | 101 "build input2.out: __foo_bar___rule ../../foo/input2.txt | ../../foo/inc luded.txt\n" |
| 102 " source = ../../foo/input2.txt\n" | 102 " source = ../../foo/input2.txt\n" |
| 103 " source_name_part = input2\n" | 103 " source_name_part = input2\n" |
| 104 "\n" | 104 "\n" |
| 105 "build obj/foo/bar.stamp: tc_stamp input1.out input2.out\n"; | 105 "build obj/foo/bar.stamp: tc_stamp input1.out input2.out\n"; |
| 106 | 106 |
| 107 std::string out_str = out.str(); | 107 std::string out_str = out.str(); |
| 108 #if defined(OS_WIN) | 108 #if defined(OS_WIN) |
| 109 std::replace(out_str.begin(), out_str.end(), '\\', '/'); | 109 std::replace(out_str.begin(), out_str.end(), '\\', '/'); |
| 110 #endif | 110 #endif |
| 111 EXPECT_EQ(expected_linux, out_str); | 111 EXPECT_EQ(expected_linux, out_str); |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 127 // depending if we're on actual Windows or Linux pretending to be Windows. | 127 // depending if we're on actual Windows or Linux pretending to be Windows. |
| 128 const char expected_win[] = | 128 const char expected_win[] = |
| 129 "arch = environment.x86\n" | 129 "arch = environment.x86\n" |
| 130 "rule __foo_bar___rule\n" | 130 "rule __foo_bar___rule\n" |
| 131 " command = C:/python/python.exe gyp-win-tool action-wrapper $arch __fo o_bar___rule.$unique_name.rsp\n" | 131 " command = C:/python/python.exe gyp-win-tool action-wrapper $arch __fo o_bar___rule.$unique_name.rsp\n" |
| 132 " description = CUSTOM //foo:bar()\n" | 132 " description = CUSTOM //foo:bar()\n" |
| 133 " restat = 1\n" | 133 " restat = 1\n" |
| 134 " rspfile = __foo_bar___rule.$unique_name.rsp\n" | 134 " rspfile = __foo_bar___rule.$unique_name.rsp\n" |
| 135 " rspfile_content = C:/python/python.exe ../../foo/script.py -i ${sourc e} \"--out=foo$ bar${source_name_part}.o\"\n" | 135 " rspfile_content = C:/python/python.exe ../../foo/script.py -i ${sourc e} \"--out=foo$ bar${source_name_part}.o\"\n" |
| 136 "\n" | 136 "\n" |
| 137 "build input1.out: __foo_bar___rule../../foo/input1.txt | ../../foo/incl uded.txt\n" | 137 "build input1.out: __foo_bar___rule ../../foo/input1.txt | ../../foo/inc luded.txt\n" |
| 138 " unique_name = 0\n" | 138 " unique_name = 0\n" |
| 139 " source = ../../foo/input1.txt\n" | 139 " source = ../../foo/input1.txt\n" |
| 140 " source_name_part = input1\n" | 140 " source_name_part = input1\n" |
| 141 "build input2.out: __foo_bar___rule../../foo/input2.txt | ../../foo/incl uded.txt\n" | 141 "build input2.out: __foo_bar___rule ../../foo/input2.txt | ../../foo/inc luded.txt\n" |
| 142 " unique_name = 1\n" | 142 " unique_name = 1\n" |
| 143 " source = ../../foo/input2.txt\n" | 143 " source = ../../foo/input2.txt\n" |
| 144 " source_name_part = input2\n" | 144 " source_name_part = input2\n" |
| 145 "\n" | 145 "\n" |
| 146 "build obj/foo/bar.stamp: tc_stamp input1.out input2.out\n"; | 146 "build obj/foo/bar.stamp: tc_stamp input1.out input2.out\n"; |
| 147 std::string out_str = out.str(); | 147 std::string out_str = out.str(); |
| 148 #if defined(OS_WIN) | 148 #if defined(OS_WIN) |
| 149 std::replace(out_str.begin(), out_str.end(), '\\', '/'); | 149 std::replace(out_str.begin(), out_str.end(), '\\', '/'); |
| 150 #endif | 150 #endif |
| 151 EXPECT_EQ(expected_win, out_str); | 151 EXPECT_EQ(expected_win, out_str); |
| 152 } | 152 } |
| 153 } | 153 } |
| OLD | NEW |