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

Side by Side Diff: ports/ninja/nacl.patch

Issue 1417223003: Switch from using 'nacl_main' to 'main' entry point (Closed) Base URL: https://chromium.googlesource.com/external/naclports.git@master
Patch Set: Created 5 years, 1 month 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
OLDNEW
1 diff --git a/configure.py b/configure.py 1 diff --git a/configure.py b/configure.py
2 --- a/configure.py 2 --- a/configure.py
3 +++ b/configure.py 3 +++ b/configure.py
4 @@ -28,7 +28,9 @@ import string 4 @@ -28,7 +28,9 @@ import string
5 import subprocess 5 import subprocess
6 import sys 6 import sys
7 7
8 -sys.path.insert(0, 'misc') 8 -sys.path.insert(0, 'misc')
9 +SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) 9 +SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
10 +sys.path.insert(0, os.path.join(SCRIPT_DIR, 'misc')) 10 +sys.path.insert(0, os.path.join(SCRIPT_DIR, 'misc'))
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 +++ b/src/manifest_parser_perftest.cc 163 +++ b/src/manifest_parser_perftest.cc
164 @@ -99,7 +99,7 @@ int main(int argc, char* argv[]) { 164 @@ -99,7 +99,7 @@ int main(int argc, char* argv[]) {
165 } 165 }
166 166
167 if (chdir(kManifestDir) < 0) 167 if (chdir(kManifestDir) < 0)
168 - Fatal("chdir: %s", strerror(errno)); 168 - Fatal("chdir: %s", strerror(errno));
169 + Fatal("chdir %s: %s", kManifestDir, strerror(errno)); 169 + Fatal("chdir %s: %s", kManifestDir, strerror(errno));
170 170
171 const int kNumRepetitions = 5; 171 const int kNumRepetitions = 5;
172 vector<int> times; 172 vector<int> times;
173 diff --git a/src/ninja.cc b/src/ninja.cc
174 --- a/src/ninja.cc
175 +++ b/src/ninja.cc
176 @@ -42,6 +42,11 @@
177 #include "util.h"
178 #include "version.h"
179
180 +#if defined(__native_client__)
181 +# include "nacl_main.h"
182 +# define main nacl_main
183 +#endif
184 +
185 #ifdef _MSC_VER
186 // Defined in msvc_helper_main-win32.cc.
187 int MSVCHelperMain(int argc, char** argv);
188 diff --git a/src/ninja_test.cc b/src/ninja_test.cc 173 diff --git a/src/ninja_test.cc b/src/ninja_test.cc
189 --- a/src/ninja_test.cc 174 --- a/src/ninja_test.cc
190 +++ b/src/ninja_test.cc 175 +++ b/src/ninja_test.cc
191 @@ -14,6 +14,7 @@ 176 @@ -14,6 +14,7 @@
192 177
193 #include <stdarg.h> 178 #include <stdarg.h>
194 #include <stdio.h> 179 #include <stdio.h>
195 +#include <stdlib.h> 180 +#include <stdlib.h>
196 181
197 #ifdef _WIN32 182 #ifdef _WIN32
198 #include "getopt.h" 183 #include "getopt.h"
199 @@ -21,6 +22,14 @@ 184 @@ -21,6 +22,12 @@
200 #include <getopt.h> 185 #include <getopt.h>
201 #endif 186 #endif
202 187
203 +#if defined(__native_client__) 188 +#if defined(__native_client__)
204 +#include <sys/stat.h> 189 +#include <sys/stat.h>
205 +#include <sys/mount.h> 190 +#include <sys/mount.h>
206 +#include "nacl_main.h"
207 +#include "nacl_io/nacl_io.h" 191 +#include "nacl_io/nacl_io.h"
208 +#define main nacl_main
209 +#endif 192 +#endif
210 + 193 +
211 #include "test.h" 194 #include "test.h"
212 #include "line_printer.h" 195 #include "line_printer.h"
213 196
214 @@ -123,6 +132,16 @@ bool testing::Test::Check(bool condition, const char* file, int line, 197 @@ -123,6 +130,16 @@ bool testing::Test::Check(bool condition, const char* file, int line,
215 } 198 }
216 199
217 int main(int argc, char **argv) { 200 int main(int argc, char **argv) {
218 +#ifdef __native_client__ 201 +#ifdef __native_client__
219 + // ninja tests require fcntl() and other functions which are not 202 + // ninja tests require fcntl() and other functions which are not
220 + // available under sel_ldr, so we configure nacl_io and run the tests 203 + // available under sel_ldr, so we configure nacl_io and run the tests
221 + // in a memfs. 204 + // in a memfs.
222 + nacl_io_init(); 205 + nacl_io_init();
223 + umount("/"); 206 + umount("/");
224 + mount("", "/", "memfs", 0, NULL); 207 + mount("", "/", "memfs", 0, NULL);
225 + mkdir("/tmp", 0777); 208 + mkdir("/tmp", 0777);
226 + chdir("/"); 209 + chdir("/");
227 +#endif 210 +#endif
228 int tests_started = 0; 211 int tests_started = 0;
229 212
230 const char* test_filter = "*"; 213 const char* test_filter = "*";
231 @@ -152,5 +171,8 @@ int main(int argc, char **argv) { 214 @@ -152,5 +169,8 @@ int main(int argc, char **argv) {
232 } 215 }
233 216
234 printer.PrintOnNewLine(passed ? "passed\n" : "failed\n"); 217 printer.PrintOnNewLine(passed ? "passed\n" : "failed\n");
235 +#ifdef __native_client__ 218 +#ifdef __native_client__
236 + nacl_io_uninit(); 219 + nacl_io_uninit();
237 +#endif 220 +#endif
238 return passed ? EXIT_SUCCESS : EXIT_FAILURE; 221 return passed ? EXIT_SUCCESS : EXIT_FAILURE;
239 } 222 }
240 diff --git a/src/subprocess-posix.cc b/src/subprocess-posix.cc 223 diff --git a/src/subprocess-posix.cc b/src/subprocess-posix.cc
241 --- a/src/subprocess-posix.cc 224 --- a/src/subprocess-posix.cc
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 +#ifdef __native_client__ 430 +#ifdef __native_client__
448 +int getloadavg(double loadavg[], int nelem) { 431 +int getloadavg(double loadavg[], int nelem) {
449 + errno = ENOSYS; 432 + errno = ENOSYS;
450 + return -1; 433 + return -1;
451 +} 434 +}
452 +#endif 435 +#endif
453 + 436 +
454 void Fatal(const char* msg, ...) { 437 void Fatal(const char* msg, ...) {
455 va_list ap; 438 va_list ap;
456 fprintf(stderr, "ninja: fatal: "); 439 fprintf(stderr, "ninja: fatal: ");
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698