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 <sstream> | 5 #include <sstream> |
6 | 6 |
7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
8 #include "tools/gn/ninja_binary_target_writer.h" | 8 #include "tools/gn/ninja_binary_target_writer.h" |
9 #include "tools/gn/test_with_scope.h" | 9 #include "tools/gn/test_with_scope.h" |
10 | 10 |
(...skipping 21 matching lines...) Expand all Loading... |
32 // TODO(brettw) I think we'll need to worry about backslashes here | 32 // TODO(brettw) I think we'll need to worry about backslashes here |
33 // depending if we're on actual Windows or Linux pretending to be Windows. | 33 // depending if we're on actual Windows or Linux pretending to be Windows. |
34 const char expected_win[] = | 34 const char expected_win[] = |
35 "defines =\n" | 35 "defines =\n" |
36 "includes =\n" | 36 "includes =\n" |
37 "cflags =\n" | 37 "cflags =\n" |
38 "cflags_c =\n" | 38 "cflags_c =\n" |
39 "cflags_cc =\n" | 39 "cflags_cc =\n" |
40 "cflags_objc =\n" | 40 "cflags_objc =\n" |
41 "cflags_objcc =\n" | 41 "cflags_objcc =\n" |
| 42 "target_name = bar\n" |
| 43 "target_out_dir = obj/foo\n" |
| 44 "root_out_dir = \n" |
42 "\n" | 45 "\n" |
43 "build obj/foo/bar.input1.obj: cxx ../../foo/input1.cc\n" | 46 "build obj/foo/bar.input1.obj: cxx ../../foo/input1.cc\n" |
44 "build obj/foo/bar.input2.obj: cxx ../../foo/input2.cc\n" | 47 "build obj/foo/bar.input2.obj: cxx ../../foo/input2.cc\n" |
45 "\n" | 48 "\n" |
46 "build obj/foo/bar.stamp: stamp obj/foo/bar.input1.obj " | 49 "build obj/foo/bar.stamp: stamp obj/foo/bar.input1.obj " |
47 "obj/foo/bar.input2.obj ../../foo/input3.o ../../foo/input4.obj\n"; | 50 "obj/foo/bar.input2.obj ../../foo/input3.o ../../foo/input4.obj\n"; |
48 std::string out_str = out.str(); | 51 std::string out_str = out.str(); |
49 #if defined(OS_WIN) | 52 #if defined(OS_WIN) |
50 std::replace(out_str.begin(), out_str.end(), '\\', '/'); | 53 std::replace(out_str.begin(), out_str.end(), '\\', '/'); |
51 #endif | 54 #endif |
(...skipping 14 matching lines...) Expand all Loading... |
66 // TODO(brettw) I think we'll need to worry about backslashes here | 69 // TODO(brettw) I think we'll need to worry about backslashes here |
67 // depending if we're on actual Windows or Linux pretending to be Windows. | 70 // depending if we're on actual Windows or Linux pretending to be Windows. |
68 const char expected_win[] = | 71 const char expected_win[] = |
69 "defines =\n" | 72 "defines =\n" |
70 "includes =\n" | 73 "includes =\n" |
71 "cflags =\n" | 74 "cflags =\n" |
72 "cflags_c =\n" | 75 "cflags_c =\n" |
73 "cflags_cc =\n" | 76 "cflags_cc =\n" |
74 "cflags_objc =\n" | 77 "cflags_objc =\n" |
75 "cflags_objcc =\n" | 78 "cflags_objcc =\n" |
| 79 "target_name = shlib\n" |
| 80 "target_out_dir = obj/foo\n" |
| 81 "root_out_dir = \n" |
76 "\n" | 82 "\n" |
77 "\n" | 83 "\n" |
78 "manifests = obj/foo/shlib.intermediate.manifest\n" | 84 "manifests = obj/foo/shlib.intermediate.manifest\n" |
79 "ldflags = /MANIFEST /ManifestFile:obj/foo/shlib.intermediate." | 85 "ldflags = /MANIFEST /ManifestFile:obj/foo/shlib.intermediate." |
80 "manifest\n" | 86 "manifest\n" |
81 "libs =\n" | 87 "libs =\n" |
82 // Ordering of the obj files here is arbitrary. Currently they're put | 88 // Ordering of the obj files here is arbitrary. Currently they're put |
83 // in a set and come out sorted. | 89 // in a set and come out sorted. |
84 "build shlib.dll shlib.dll.lib: solink ../../foo/input3.o " | 90 "build shlib.dll shlib.dll.lib: solink ../../foo/input3.o " |
85 "../../foo/input4.obj obj/foo/bar.input1.obj " | 91 "../../foo/input4.obj obj/foo/bar.input1.obj " |
(...skipping 23 matching lines...) Expand all Loading... |
109 // TODO(brettw) I think we'll need to worry about backslashes here | 115 // TODO(brettw) I think we'll need to worry about backslashes here |
110 // depending if we're on actual Windows or Linux pretending to be Windows. | 116 // depending if we're on actual Windows or Linux pretending to be Windows. |
111 const char expected_win[] = | 117 const char expected_win[] = |
112 "defines =\n" | 118 "defines =\n" |
113 "includes =\n" | 119 "includes =\n" |
114 "cflags =\n" | 120 "cflags =\n" |
115 "cflags_c =\n" | 121 "cflags_c =\n" |
116 "cflags_cc =\n" | 122 "cflags_cc =\n" |
117 "cflags_objc =\n" | 123 "cflags_objc =\n" |
118 "cflags_objcc =\n" | 124 "cflags_objcc =\n" |
| 125 "target_name = stlib\n" |
| 126 "target_out_dir = obj/foo\n" |
| 127 "root_out_dir = \n" |
119 "\n" | 128 "\n" |
120 "\n" | 129 "\n" |
121 "manifests = obj/foo/stlib.intermediate.manifest\n" | 130 "manifests = obj/foo/stlib.intermediate.manifest\n" |
122 "ldflags = /MANIFEST /ManifestFile:obj/foo/stlib.intermediate.manifest\n
" | 131 "ldflags = /MANIFEST /ManifestFile:obj/foo/stlib.intermediate.manifest\n
" |
123 "libs =\n" | 132 "libs =\n" |
124 // There are no sources so there are no params to alink. | 133 // There are no sources so there are no params to alink. |
125 "build obj/foo/stlib.lib: alink\n\n"; | 134 "build obj/foo/stlib.lib: alink\n\n"; |
126 std::string out_str = out.str(); | 135 std::string out_str = out.str(); |
127 #if defined(OS_WIN) | 136 #if defined(OS_WIN) |
128 std::replace(out_str.begin(), out_str.end(), '\\', '/'); | 137 std::replace(out_str.begin(), out_str.end(), '\\', '/'); |
(...skipping 23 matching lines...) Expand all Loading... |
152 // TODO(brettw) I think we'll need to worry about backslashes here | 161 // TODO(brettw) I think we'll need to worry about backslashes here |
153 // depending if we're on actual Windows or Linux pretending to be Windows. | 162 // depending if we're on actual Windows or Linux pretending to be Windows. |
154 const char expected[] = | 163 const char expected[] = |
155 "defines =\n" | 164 "defines =\n" |
156 "includes =\n" | 165 "includes =\n" |
157 "cflags =\n" | 166 "cflags =\n" |
158 "cflags_c =\n" | 167 "cflags_c =\n" |
159 "cflags_cc =\n" | 168 "cflags_cc =\n" |
160 "cflags_objc =\n" | 169 "cflags_objc =\n" |
161 "cflags_objcc =\n" | 170 "cflags_objcc =\n" |
| 171 "target_name = shlib\n" |
| 172 "target_out_dir = obj/foo\n" |
| 173 "root_out_dir = \n" |
162 "\n" | 174 "\n" |
163 "build obj/foo/shlib.input1.o: cxx ../../foo/input1.cc\n" | 175 "build obj/foo/shlib.input1.o: cxx ../../foo/input1.cc\n" |
164 "build obj/foo/shlib.input2.o: cxx ../../foo/input2.cc\n" | 176 "build obj/foo/shlib.input2.o: cxx ../../foo/input2.cc\n" |
165 "\n" | 177 "\n" |
166 "ldflags =\n" | 178 "ldflags =\n" |
167 "libs =\n" | 179 "libs =\n" |
168 "build lib/libshlib.so.6: solink obj/foo/shlib.input1.o " | 180 "build lib/libshlib.so.6: solink obj/foo/shlib.input1.o " |
169 "obj/foo/shlib.input2.o\n" | 181 "obj/foo/shlib.input2.o\n" |
170 " soname = libshlib.so.6\n" | 182 " soname = libshlib.so.6\n" |
171 " lib = lib/libshlib.so.6\n" | 183 " lib = lib/libshlib.so.6\n" |
(...skipping 26 matching lines...) Expand all Loading... |
198 // TODO(brettw) I think we'll need to worry about backslashes here | 210 // TODO(brettw) I think we'll need to worry about backslashes here |
199 // depending if we're on actual Windows or Linux pretending to be Windows. | 211 // depending if we're on actual Windows or Linux pretending to be Windows. |
200 const char expected[] = | 212 const char expected[] = |
201 "defines =\n" | 213 "defines =\n" |
202 "includes =\n" | 214 "includes =\n" |
203 "cflags =\n" | 215 "cflags =\n" |
204 "cflags_c =\n" | 216 "cflags_c =\n" |
205 "cflags_cc =\n" | 217 "cflags_cc =\n" |
206 "cflags_objc =\n" | 218 "cflags_objc =\n" |
207 "cflags_objcc =\n" | 219 "cflags_objcc =\n" |
| 220 "target_name = shlib\n" |
| 221 "target_out_dir = obj/foo\n" |
| 222 "root_out_dir = \n" |
208 "\n" | 223 "\n" |
209 "build obj/foo/shlib.input1.o: cxx ../../foo/input1.cc\n" | 224 "build obj/foo/shlib.input1.o: cxx ../../foo/input1.cc\n" |
210 "build obj/foo/shlib.input2.o: cxx ../../foo/input2.cc\n" | 225 "build obj/foo/shlib.input2.o: cxx ../../foo/input2.cc\n" |
211 "\n" | 226 "\n" |
212 "ldflags =\n" | 227 "ldflags =\n" |
213 "libs =\n" | 228 "libs =\n" |
214 "build lib/libshlib.so: solink obj/foo/shlib.input1.o " | 229 "build lib/libshlib.so: solink obj/foo/shlib.input1.o " |
215 "obj/foo/shlib.input2.o\n" | 230 "obj/foo/shlib.input2.o\n" |
216 " soname = libshlib.so\n" | 231 " soname = libshlib.so\n" |
217 " lib = lib/libshlib.so\n" | 232 " lib = lib/libshlib.so\n" |
218 "\n"; | 233 "\n"; |
219 | 234 |
220 std::string out_str = out.str(); | 235 std::string out_str = out.str(); |
221 #if defined(OS_WIN) | 236 #if defined(OS_WIN) |
222 std::replace(out_str.begin(), out_str.end(), '\\', '/'); | 237 std::replace(out_str.begin(), out_str.end(), '\\', '/'); |
223 #endif | 238 #endif |
224 EXPECT_EQ(expected, out_str); | 239 EXPECT_EQ(expected, out_str); |
225 } | 240 } |
OLD | NEW |