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

Side by Side Diff: tools/gn/ninja_script_target_writer_unittest.cc

Issue 26267003: Add the concept of a source set to GN. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tools/gn/ninja_helper.cc ('k') | tools/gn/ninja_target_writer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
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);
112 } 112 }
113 113
114 // Windows. 114 // Windows.
115 { 115 {
116 // Note: we use forward slashes here so that the output will be the same on
117 // Linux and Windows.
118 setup.build_settings()->set_python_path(base::FilePath(FILE_PATH_LITERAL(
119 "C:/python/python.exe")));
116 setup.settings()->set_target_os(Settings::WIN); 120 setup.settings()->set_target_os(Settings::WIN);
117 121
118 std::ostringstream out; 122 std::ostringstream out;
119 NinjaScriptTargetWriter writer(&target, out); 123 NinjaScriptTargetWriter writer(&target, out);
120 writer.Run(); 124 writer.Run();
121 125
122 // TODO(brettw) I think we'll need to worry about backslashes here 126 // TODO(brettw) I think we'll need to worry about backslashes here
123 // 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.
124 const char expected_win[] = 128 const char expected_win[] =
125 "arch = environment.x86\n" 129 "arch = environment.x86\n"
126 "rule __foo_bar___rule\n" 130 "rule __foo_bar___rule\n"
127 " command = $pythonpath gyp-win-tool action-wrapper $arch __foo_bar___r ule.$unique_name.rsp\n" 131 " command = C:/python/python.exe gyp-win-tool action-wrapper $arch __fo o_bar___rule.$unique_name.rsp\n"
128 " description = CUSTOM //foo:bar()\n" 132 " description = CUSTOM //foo:bar()\n"
129 " restat = 1\n" 133 " restat = 1\n"
130 " rspfile = __foo_bar___rule.$unique_name.rsp\n" 134 " rspfile = __foo_bar___rule.$unique_name.rsp\n"
131 " rspfile_content = $pythonpath ../../foo/script.py -i ${source} \"--ou t=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"
132 "\n" 136 "\n"
133 "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/incl uded.txt\n"
134 " unique_name = 0\n" 138 " unique_name = 0\n"
135 " source = ../../foo/input1.txt\n" 139 " source = ../../foo/input1.txt\n"
136 " source_name_part = input1\n" 140 " source_name_part = input1\n"
137 "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/incl uded.txt\n"
138 " unique_name = 1\n" 142 " unique_name = 1\n"
139 " source = ../../foo/input2.txt\n" 143 " source = ../../foo/input2.txt\n"
140 " source_name_part = input2\n" 144 " source_name_part = input2\n"
141 "\n" 145 "\n"
142 "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";
143 std::string out_str = out.str(); 147 std::string out_str = out.str();
144 #if defined(OS_WIN) 148 #if defined(OS_WIN)
145 std::replace(out_str.begin(), out_str.end(), '\\', '/'); 149 std::replace(out_str.begin(), out_str.end(), '\\', '/');
146 #endif 150 #endif
147 EXPECT_EQ(expected_win, out_str); 151 EXPECT_EQ(expected_win, out_str);
148 } 152 }
149 } 153 }
OLDNEW
« no previous file with comments | « tools/gn/ninja_helper.cc ('k') | tools/gn/ninja_target_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698