OLD | NEW |
1 diff --git a/CMakeLists.txt b/CMakeLists.txt | 1 diff --git a/CMakeLists.txt b/CMakeLists.txt |
2 index ac1032a..a238fbb 100644 | 2 index 6f1a97e..664d3f4 100644 |
3 --- a/CMakeLists.txt | 3 --- a/CMakeLists.txt |
4 +++ b/CMakeLists.txt | 4 +++ b/CMakeLists.txt |
5 @@ -72,14 +72,21 @@ SET(LIB_INSTALL_DIR lib CACHE PATH "Where to install librari
es to.") | 5 @@ -91,6 +91,10 @@ FUNCTION(TARGET_OS_LIBRARIES target) |
6 SET(INCLUDE_INSTALL_DIR include CACHE PATH "Where to install headers to.") | 6 » » TARGET_LINK_LIBRARIES(${target} rt) |
| 7 » » SET(LIBGIT2_PC_LIBS "${LIBGIT2_PC_LIBS} -lrt" PARENT_SCOPE) |
| 8 » ENDIF() |
| 9 +» IF("$ENV{NACL_LIBC}" STREQUAL "newlib") |
| 10 +» » TARGET_LINK_LIBRARIES(${target} glibc-compat) |
| 11 +» » SET(LIBGIT2_PC_LIBS "${LIBGIT2_PC_LIBS} -lglibc-compat" PARENT_S
COPE) |
| 12 +» ENDIF() |
7 | 13 |
8 FUNCTION(TARGET_OS_LIBRARIES target) | 14 » IF(THREADSAFE) |
9 +» MESSAGE(">>>>>>> Libc = $ENV{NACL_LIBC}") | 15 » » TARGET_LINK_LIBRARIES(${target} ${CMAKE_THREAD_LIBS_INIT}) |
10 + | 16 @@ -364,6 +368,8 @@ FILE(GLOB SRC_H include/git2.h include/git2/*.h include/git2
/sys/*.h) |
11 » IF(WIN32) | 17 IF (WIN32 AND NOT CYGWIN) |
12 » » TARGET_LINK_LIBRARIES(${target} ws2_32) | 18 » ADD_DEFINITIONS(-DWIN32 -D_WIN32_WINNT=0x0501) |
13 » ELSEIF(CMAKE_SYSTEM_NAME MATCHES "(Solaris|SunOS)") | 19 » FILE(GLOB SRC_OS src/win32/*.c src/win32/*.h) |
14 » » TARGET_LINK_LIBRARIES(${target} socket nsl) | 20 +ELSEIF (NACL) |
15 » » SET(LIBGIT2_PC_LIBS "${LIBGIT2_PC_LIBS} -lsocket -lnsl" PARENT_S
COPE) | 21 +» ADD_DEFINITIONS(-DNO_MMAP) |
16 » ELSEIF(CMAKE_SYSTEM_NAME MATCHES "Linux") | 22 ELSEIF (AMIGA) |
17 -» » TARGET_LINK_LIBRARIES(${target} rt) | 23 » ADD_DEFINITIONS(-DNO_ADDRINFO -DNO_READDIR_R -DNO_MMAP) |
18 -» » SET(LIBGIT2_PC_LIBS "${LIBGIT2_PC_LIBS} -lrt" PARENT_SCOPE) | 24 ELSE() |
19 +» » IF($ENV{NACL_LIBC} STREQUAL "newlib") | |
20 +» » » TARGET_LINK_LIBRARIES(${target} glibc-compat) | |
21 +» » » SET(LIBGIT2_PC_LIBS "${LIBGIT2_PC_LIBS} -lglibc-compat"
PARENT_SCOPE) | |
22 +» » ELSE() | |
23 +» » » TARGET_LINK_LIBRARIES(${target} rt) | |
24 +» » » SET(LIBGIT2_PC_LIBS "${LIBGIT2_PC_LIBS} -lrt" PARENT_SCO
PE) | |
25 +» » ENDIF() | |
26 » ENDIF() | |
27 | |
28 » IF(USE_ICONV) | |
29 diff --git a/src/pool.c b/src/pool.c | 25 diff --git a/src/pool.c b/src/pool.c |
30 index d484769..287e08e 100644 | 26 index a516ff9..b1c2bfe 100644 |
31 --- a/src/pool.c | 27 --- a/src/pool.c |
32 +++ b/src/pool.c | 28 +++ b/src/pool.c |
33 @@ -313,7 +313,7 @@ uint32_t git_pool__system_page_size(void) | 29 @@ -312,7 +312,7 @@ uint32_t git_pool__system_page_size(void) |
34 #elif defined(__amigaos4__) | 30 #elif defined(__amigaos4__) |
35 size = (uint32_t)4096; /* 4K as there is no global value we can
query */ | 31 size = (uint32_t)4096; /* 4K as there is no global value we can
query */ |
36 #else | 32 #else |
37 - size = (uint32_t)sysconf(_SC_PAGE_SIZE); | 33 - size = (uint32_t)sysconf(_SC_PAGE_SIZE); |
38 + size = (uint32_t)sysconf(_SC_PAGESIZE); | 34 + size = (uint32_t)sysconf(_SC_PAGESIZE); |
39 #endif | 35 #endif |
40 | 36 |
41 size -= 2 * sizeof(void *); /* allow space for malloc overhead *
/ | 37 size -= 2 * sizeof(void *); /* allow space for malloc overhead *
/ |
42 diff --git a/tests/blame/buffer.c b/tests/blame/buffer.c | 38 diff --git a/src/posix.h b/src/posix.h |
43 index 912ee98..340b1dc 100644 | 39 index 965cd98..eb93cde 100644 |
44 --- a/tests/blame/buffer.c | 40 --- a/src/posix.h |
45 +++ b/tests/blame/buffer.c | 41 +++ b/src/posix.h |
46 @@ -1,7 +1,7 @@ | 42 @@ -12,6 +12,10 @@ |
47 #include "blame_helpers.h" | 43 #include <time.h> |
| 44 #include "fnmatch.h" |
48 | 45 |
49 -git_repository *g_repo; | 46 +#if defined(__native_client__) && defined(_NEWLIB_VERSION) |
50 -git_blame *g_fileblame, *g_bufferblame; | 47 +mode_t umask(mode_t cmask); |
51 +static git_repository *g_repo; | 48 +#endif |
52 +static git_blame *g_fileblame, *g_bufferblame; | 49 + |
| 50 #ifndef S_IFGITLINK |
| 51 #define S_IFGITLINK 0160000 |
| 52 #define S_ISGITLINK(m) (((m) & S_IFMT) == S_IFGITLINK) |
| 53 diff --git a/tests/clar.c b/tests/clar.c |
| 54 index 1546447..839f7f3 100644 |
| 55 --- a/tests/clar.c |
| 56 +++ b/tests/clar.c |
| 57 @@ -222,7 +222,7 @@ static void |
| 58 clar_run_suite(const struct clar_suite *suite, const char *filter) |
| 59 { |
| 60 » const struct clar_func *test = suite->tests; |
| 61 -» size_t i, matchlen; |
| 62 +» size_t i, matchlen = 0; |
53 | 63 |
54 void test_blame_buffer__initialize(void) | 64 » if (!suite->enabled) |
55 { | 65 » » return; |
56 diff --git a/tests/clar/fs.h b/tests/clar/fs.h | 66 diff --git a/tests/clar/fs.h b/tests/clar/fs.h |
57 index b7a1ff9..1d508a3 100644 | 67 index 7c7dde6..e37aec1 100644 |
58 --- a/tests/clar/fs.h | 68 --- a/tests/clar/fs.h |
59 +++ b/tests/clar/fs.h | 69 +++ b/tests/clar/fs.h |
60 @@ -250,7 +250,250 @@ cl_fs_cleanup(void) | 70 @@ -250,6 +250,249 @@ cl_fs_cleanup(void) |
61 fs_rm(fixture_path(_clar_path, "*")); | 71 fs_rm(fixture_path(_clar_path, "*")); |
62 } | 72 } |
63 | 73 |
64 +#elif defined(__native_client__) | 74 +#elif defined(__native_client__) |
65 + | 75 + |
66 +#include <dirent.h> | 76 +#include <dirent.h> |
67 +#include <errno.h> | 77 +#include <errno.h> |
68 +#include <limits.h> | 78 +#include <limits.h> |
69 +#include <sys/stat.h> | 79 +#include <sys/stat.h> |
70 + | 80 + |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 + | 136 + |
127 +cleanup: | 137 +cleanup: |
128 + closedir(src_dir); | 138 + closedir(src_dir); |
129 + return result; | 139 + return result; |
130 +} | 140 +} |
131 + | 141 + |
132 +static int fs_copy_file(const char* source, const char* dest) { | 142 +static int fs_copy_file(const char* source, const char* dest) { |
133 + const size_t buffer_size = 8192; | 143 + const size_t buffer_size = 8192; |
134 + char buffer[buffer_size]; | 144 + char buffer[buffer_size]; |
135 + int result = 1; | 145 + int result = 1; |
| 146 + FILE* dst_file = NULL; |
136 + | 147 + |
137 + FILE* src_file = fopen(source, "r"); | 148 + FILE* src_file = fopen(source, "r"); |
138 + if (src_file == NULL) { | 149 + if (src_file == NULL) { |
139 + fprintf(stderr, "Error opening file %s for reading: %s\n", | 150 + fprintf(stderr, "Error opening file %s for reading: %s\n", |
140 + source, strerror(errno)); | 151 + source, strerror(errno)); |
141 + goto error; | 152 + goto error; |
142 + } | 153 + } |
143 + | 154 + |
144 + FILE* dst_file = fopen(dest, "w"); | 155 + dst_file = fopen(dest, "w"); |
145 + if (dst_file == NULL) { | 156 + if (dst_file == NULL) { |
146 + fprintf(stderr, "Error opening file %s for writing: %s\n", | 157 + fprintf(stderr, "Error opening file %s for writing: %s\n", |
147 + dest, strerror(errno)); | 158 + dest, strerror(errno)); |
148 + goto error; | 159 + goto error; |
149 + } | 160 + } |
150 + | 161 + |
151 + while (!feof(src_file)) { | 162 + while (!feof(src_file)) { |
152 + ssize_t bytes_read = fread(&buffer[0], 1, buffer_size, src_file); | 163 + ssize_t bytes_read = fread(&buffer[0], 1, buffer_size, src_file); |
153 + ssize_t bytes_written; | 164 + ssize_t bytes_written; |
154 + if (bytes_read < 0) { | 165 + if (bytes_read < 0) { |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 + if (unlink(source) != 0) { | 275 + if (unlink(source) != 0) { |
265 + fprintf(stderr, "Error removing file %s: %s\n", source, strerror(errno)); | 276 + fprintf(stderr, "Error removing file %s: %s\n", source, strerror(errno)); |
266 + return 0; | 277 + return 0; |
267 + } | 278 + } |
268 + | 279 + |
269 + return 1; | 280 + return 1; |
270 +} | 281 +} |
271 + | 282 + |
272 +static int fs_rm_helper(const char* source) { | 283 +static int fs_rm_helper(const char* source) { |
273 + struct stat statbuf; | 284 + struct stat statbuf; |
274 + if (stat(source, &statbuf) != 0) { | 285 + if (lstat(source, &statbuf) != 0) { |
275 + fprintf(stderr, "Error stat'ing file %s: %s\n", source, strerror(errno)); | 286 + fprintf(stderr, "Error stat'ing file %s: %s\n", source, strerror(errno)); |
276 + return 0; | 287 + return 0; |
277 + } | 288 + } |
278 + | 289 + |
279 + if (S_ISDIR(statbuf.st_mode)) { | 290 + if (S_ISDIR(statbuf.st_mode)) { |
280 + if (!fs_rm_dir(source)) | 291 + if (!fs_rm_dir(source)) |
281 + return 0; | 292 + return 0; |
282 + } else { | 293 + } else { |
283 + if (!fs_rm_file(source)) | 294 + if (!fs_rm_file(source)) |
284 + return 0; | 295 + return 0; |
(...skipping 12 matching lines...) Expand all Loading... |
297 +} | 308 +} |
298 + | 309 + |
299 +void | 310 +void |
300 +cl_fs_cleanup(void) | 311 +cl_fs_cleanup(void) |
301 +{ | 312 +{ |
302 + clar_unsandbox(); | 313 + clar_unsandbox(); |
303 + clar_sandbox(); | 314 + clar_sandbox(); |
304 +} | 315 +} |
305 + | 316 + |
306 #else | 317 #else |
307 + | 318 |
308 static int | 319 #include <errno.h> |
309 shell_out(char * const argv[]) | 320 diff --git a/tests/clar/sandbox.h b/tests/clar/sandbox.h |
| 321 index a44e291..a6aea62 100644 |
| 322 --- a/tests/clar/sandbox.h |
| 323 +++ b/tests/clar/sandbox.h |
| 324 @@ -110,8 +110,21 @@ static int build_sandbox_path(void) |
| 325 » » return -1; |
| 326 #else |
| 327 » if (mkdtemp(_clar_path) == NULL) |
| 328 +#if defined(__native_client__) |
| 329 +» { |
| 330 +» » // Under sel_ldr mkdtemp currently always fails. For now |
| 331 +» » // fake it. |
| 332 +» » struct stat buf; |
| 333 +» » strcpy(_clar_path + strlen(_clar_path) - 6, "123456"); |
| 334 +» » if (stat(_clar_path, &buf) == 0) |
| 335 +» » » fs_rm(_clar_path); |
| 336 +» » if (mkdir(_clar_path, 0700) != 0) |
| 337 +» » » return -1; |
| 338 +» } |
| 339 +#else |
| 340 » » return -1; |
| 341 #endif |
| 342 +#endif |
| 343 |
| 344 » return 0; |
| 345 } |
| 346 diff --git a/tests/commit/parse.c b/tests/commit/parse.c |
| 347 index 41e1624..f27bada 100644 |
| 348 --- a/tests/commit/parse.c |
| 349 +++ b/tests/commit/parse.c |
| 350 @@ -119,8 +119,8 @@ passing_signature_test_case passing_signature_cases[] = { |
| 351 » {"author Vicent Marti <tanoku@gmail.com> 1234567890 \n", "author ", "Vic
ent Marti", "tanoku@gmail.com", 1234567890, 0}, |
| 352 » {"author Vicent Marti <tanoku@gmail.com> 2147483647 \n", "author ", "Vic
ent Marti", "tanoku@gmail.com", 0x7fffffff, 0}, |
| 353 » {"author Vicent Marti <tanoku@gmail.com> 4294967295 \n", "author ", "Vic
ent Marti", "tanoku@gmail.com", 0xffffffff, 0}, |
| 354 -» {"author Vicent Marti <tanoku@gmail.com> 4294967296 \n", "author ", "Vic
ent Marti", "tanoku@gmail.com", 4294967296, 0}, |
| 355 -» {"author Vicent Marti <tanoku@gmail.com> 8589934592 \n", "author ", "Vic
ent Marti", "tanoku@gmail.com", 8589934592, 0}, |
| 356 +» {"author Vicent Marti <tanoku@gmail.com> 4294967296 \n", "author ", "Vic
ent Marti", "tanoku@gmail.com", 4294967296ll, 0}, |
| 357 +» {"author Vicent Marti <tanoku@gmail.com> 8589934592 \n", "author ", "Vic
ent Marti", "tanoku@gmail.com", 8589934592ll, 0}, |
| 358 |
| 359 » {NULL,NULL,NULL,NULL,0,0} |
| 360 }; |
| 361 diff --git a/tests/config/read.c b/tests/config/read.c |
| 362 index 2567272..2db4b3d 100644 |
| 363 --- a/tests/config/read.c |
| 364 +++ b/tests/config/read.c |
| 365 @@ -477,7 +477,7 @@ void test_config_read__simple_read_from_specific_level(void) |
310 { | 366 { |
311 diff --git a/tests/index/addall.c b/tests/index/addall.c | 367 » git_config *cfg, *cfg_specific; |
312 index 44c5127..abc84b2 100644 | 368 » int i; |
313 --- a/tests/index/addall.c | 369 -» int64_t l, expected = +9223372036854775803; |
314 +++ b/tests/index/addall.c | 370 +» int64_t l, expected = +9223372036854775803ll; |
315 @@ -3,7 +3,7 @@ | 371 » const char *s; |
316 #include "posix.h" | |
317 #include "fileops.h" | |
318 | 372 |
319 -git_repository *g_repo = NULL; | 373 » cl_git_pass(git_config_new(&cfg)); |
320 +static git_repository *g_repo = NULL; | 374 diff --git a/tests/config/write.c b/tests/config/write.c |
| 375 index 0f11ae8..675f7f4 100644 |
| 376 --- a/tests/config/write.c |
| 377 +++ b/tests/config/write.c |
| 378 @@ -18,7 +18,7 @@ void test_config_write__replace_value(void) |
| 379 { |
| 380 » git_config *cfg; |
| 381 » int i; |
| 382 -» int64_t l, expected = +9223372036854775803; |
| 383 +» int64_t l, expected = +9223372036854775803ll; |
321 | 384 |
322 void test_index_addall__initialize(void) | 385 » /* By freeing the config, we make sure we flush the values */ |
| 386 » cl_git_pass(git_config_open_ondisk(&cfg, "config9")); |
| 387 @@ -179,7 +179,7 @@ void test_config_write__add_value_at_specific_level(void) |
323 { | 388 { |
| 389 git_config *cfg, *cfg_specific; |
| 390 int i; |
| 391 - int64_t l, expected = +9223372036854775803; |
| 392 + int64_t l, expected = +9223372036854775803ll; |
| 393 const char *s; |
| 394 |
| 395 // open config15 as global level config file |
OLD | NEW |