diff options
author | Alon Zakai <alonzakai@gmail.com> | 2014-01-18 18:12:00 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2014-01-18 18:12:00 -0800 |
commit | fd08013827a5fec461b374b9e0605b4ebabf7fe1 (patch) | |
tree | 45f1e8c649f3af1ed8a3cfac9a2ae30955667229 | |
parent | 514455525bf4f8e4e72ccdef7d3f88b26fbc77e5 (diff) | |
parent | 8762f317490f82ddadf8257d29f8dc2b074b2683 (diff) |
Merge pull request #2030 from waywardmonkeys/updates4
Updates 4
-rw-r--r-- | src/library.js | 41 | ||||
-rw-r--r-- | tests/core/test_exceptions_2.in (renamed from tests/core/test_exception_2.in) | 0 | ||||
-rw-r--r-- | tests/core/test_exceptions_2.out (renamed from tests/core/test_exception_2.out) | 0 | ||||
-rw-r--r-- | tests/core/test_exceptions_multi.in (renamed from tests/core/test_multiexception.in) | 6 | ||||
-rw-r--r-- | tests/core/test_exceptions_multi.out (renamed from tests/core/test_multiexception.out) | 0 | ||||
-rw-r--r-- | tests/core/test_exceptions_std.in (renamed from tests/core/test_std_exception.in) | 0 | ||||
-rw-r--r-- | tests/core/test_exceptions_std.out (renamed from tests/core/test_std_exception.out) | 0 | ||||
-rw-r--r-- | tests/core/test_exceptions_typed.in (renamed from tests/exceptions/typed.cpp) | 0 | ||||
-rw-r--r-- | tests/core/test_exceptions_typed.out (renamed from tests/exceptions/output.txt) | 0 | ||||
-rw-r--r-- | tests/core/test_exceptions_white_list.in (renamed from tests/core/test_white_list_exception.in) | 0 | ||||
-rw-r--r-- | tests/core/test_exceptions_white_list.out (renamed from tests/core/test_white_list_exception.out) | 0 | ||||
-rw-r--r-- | tests/core/test_nl_types.in | 8 | ||||
-rw-r--r-- | tests/core/test_nl_types.out | 1 | ||||
-rw-r--r-- | tests/test_core.py | 44 |
14 files changed, 58 insertions, 42 deletions
diff --git a/src/library.js b/src/library.js index d2adbf24..b38a74bf 100644 --- a/src/library.js +++ b/src/library.js @@ -225,7 +225,6 @@ LibraryManager.library = { var result = ___libgenSplitName(path); return result[0] + result[1] + 1; }, - __xpg_basename: 'basename', dirname__deps: ['__libgenSplitName'], dirname: function(path) { // char *dirname(char *path); @@ -393,9 +392,6 @@ LibraryManager.library = { _umask.cmask = newMask; return oldMask; }, - stat64: 'stat', - fstat64: 'fstat', - lstat64: 'lstat', // ========================================================================== // sys/statvfs.h @@ -562,6 +558,25 @@ LibraryManager.library = { }, // ========================================================================== + // nl_types.h + // ========================================================================== + + catopen: function(name, oflag) { + // nl_catd catopen (const char *name, int oflag) + return -1; + }, + + catgets: function(catd, set_id, msg_id, s) { + // char *catgets (nl_catd catd, int set_id, int msg_id, const char *s) + return s; + }, + + catclose: function(catd) { + // int catclose (nl_catd catd) + return 0; + }, + + // ========================================================================== // poll.h // ========================================================================== @@ -1556,9 +1571,6 @@ LibraryManager.library = { if (bytes != 0) self.alloc(bytes); return ret; // Previous break location. }, - open64: 'open', - lseek64: 'lseek', - ftruncate64: 'ftruncate', // ========================================================================== // stdio.h @@ -2554,7 +2566,6 @@ LibraryManager.library = { return 0; }, fseeko: 'fseek', - fseeko64: 'fseek', fsetpos__deps: ['$FS', 'lseek', '__setErrNo', '$ERRNO_CODES'], fsetpos: function(stream, pos) { // int fsetpos(FILE *stream, const fpos_t *pos); @@ -2591,7 +2602,6 @@ LibraryManager.library = { } }, ftello: 'ftell', - ftello64: 'ftell', fwrite__deps: ['$FS', 'write'], fwrite: function(ptr, size, nitems, stream) { // size_t fwrite(const void *restrict ptr, size_t size, size_t nitems, FILE *restrict stream); @@ -2883,17 +2893,6 @@ LibraryManager.library = { }, #endif - fopen64: 'fopen', - __isoc99_fscanf: 'fscanf', - // TODO: Check if any other aliases are needed. - _IO_getc: 'getc', - _IO_putc: 'putc', - _ZNSo3putEc: 'putchar', - _ZNSo5flushEv__deps: ['fflush', 'stdout'], - _ZNSo5flushEv: function() { - _fflush({{{ makeGetValue(makeGlobalUse('_stdout'), '0', 'void*') }}}); - }, - // ========================================================================== // sys/mman.h // ========================================================================== @@ -9175,7 +9174,7 @@ function autoAddDeps(object, name) { } // Add aborting stubs for various libc stuff needed by libc++ -['pthread_cond_signal', 'pthread_equal', 'pthread_join', 'pthread_detach', 'catgets', 'catopen', 'catclose'].forEach(function(aborter) { +['pthread_cond_signal', 'pthread_equal', 'pthread_join', 'pthread_detach'].forEach(function(aborter) { LibraryManager.library[aborter] = function aborting_stub() { throw 'TODO: ' + aborter }; }); diff --git a/tests/core/test_exception_2.in b/tests/core/test_exceptions_2.in index 2eae3198..2eae3198 100644 --- a/tests/core/test_exception_2.in +++ b/tests/core/test_exceptions_2.in diff --git a/tests/core/test_exception_2.out b/tests/core/test_exceptions_2.out index aa89c67d..aa89c67d 100644 --- a/tests/core/test_exception_2.out +++ b/tests/core/test_exceptions_2.out diff --git a/tests/core/test_multiexception.in b/tests/core/test_exceptions_multi.in index 46acbbf3..5453d11c 100644 --- a/tests/core/test_multiexception.in +++ b/tests/core/test_exceptions_multi.in @@ -22,9 +22,9 @@ void setjmp_func(jmp_state* s, int level) { s->jmp = c_jmp; setjmp_func(s, level + 1); } - catch (int catched_eid) { - printf("caught %d\n", catched_eid); - if (catched_eid == c_jmp) { + catch (int caught_eid) { + printf("caught %d\n", caught_eid); + if (caught_eid == c_jmp) { printf("setjmp exception execution path, level: %d, prev_jmp: %d\n", level, prev_jmp); if (prev_jmp != -1) { diff --git a/tests/core/test_multiexception.out b/tests/core/test_exceptions_multi.out index 33efe46e..33efe46e 100644 --- a/tests/core/test_multiexception.out +++ b/tests/core/test_exceptions_multi.out diff --git a/tests/core/test_std_exception.in b/tests/core/test_exceptions_std.in index 4b5905d8..4b5905d8 100644 --- a/tests/core/test_std_exception.in +++ b/tests/core/test_exceptions_std.in diff --git a/tests/core/test_std_exception.out b/tests/core/test_exceptions_std.out index c1660de4..c1660de4 100644 --- a/tests/core/test_std_exception.out +++ b/tests/core/test_exceptions_std.out diff --git a/tests/exceptions/typed.cpp b/tests/core/test_exceptions_typed.in index a2b77fee..a2b77fee 100644 --- a/tests/exceptions/typed.cpp +++ b/tests/core/test_exceptions_typed.in diff --git a/tests/exceptions/output.txt b/tests/core/test_exceptions_typed.out index 718f189a..718f189a 100644 --- a/tests/exceptions/output.txt +++ b/tests/core/test_exceptions_typed.out diff --git a/tests/core/test_white_list_exception.in b/tests/core/test_exceptions_white_list.in index 2944f9fe..2944f9fe 100644 --- a/tests/core/test_white_list_exception.in +++ b/tests/core/test_exceptions_white_list.in diff --git a/tests/core/test_white_list_exception.out b/tests/core/test_exceptions_white_list.out index 62e1a81c..62e1a81c 100644 --- a/tests/core/test_white_list_exception.out +++ b/tests/core/test_exceptions_white_list.out diff --git a/tests/core/test_nl_types.in b/tests/core/test_nl_types.in new file mode 100644 index 00000000..666920ee --- /dev/null +++ b/tests/core/test_nl_types.in @@ -0,0 +1,8 @@ +#include <nl_types.h> +#include <stdio.h> + +int main(int argc, char ** argv) { + nl_catd c = catopen("none", 0); + printf("Hello, %s.\n", catgets(c, 0, 0, "world")); + return catclose(c); +} diff --git a/tests/core/test_nl_types.out b/tests/core/test_nl_types.out new file mode 100644 index 00000000..f75ba05f --- /dev/null +++ b/tests/core/test_nl_types.out @@ -0,0 +1 @@ +Hello, world. diff --git a/tests/test_core.py b/tests/test_core.py index f5d18e45..b1e1ffe6 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -1269,7 +1269,7 @@ class T(RunnerCore): # Short name, to make it more fun to use manually on the co } catch (MyException & e) { - std::cout << "Catched..."; + std::cout << "Caught..."; } try @@ -1278,7 +1278,7 @@ class T(RunnerCore): # Short name, to make it more fun to use manually on the co } catch (MyException e) { - std::cout << "Catched..."; + std::cout << "Caught..."; } return 0; @@ -1288,26 +1288,26 @@ class T(RunnerCore): # Short name, to make it more fun to use manually on the co Settings.DISABLE_EXCEPTION_CATCHING = 0 if '-O2' in self.emcc_args: self.emcc_args.pop() ; self.emcc_args.pop() # disable closure to work around a closure bug - self.do_run(src, 'Throw...Construct...Catched...Destruct...Throw...Construct...Copy...Catched...Destruct...Destruct...') + self.do_run(src, 'Throw...Construct...Caught...Destruct...Throw...Construct...Copy...Caught...Destruct...Destruct...') - def test_exception_2(self): + def test_exceptions_2(self): if self.emcc_args is None: return self.skip('need emcc to add in libcxx properly') Settings.DISABLE_EXCEPTION_CATCHING = 0 - test_path = path_from_root('tests', 'core', 'test_exception_2') + test_path = path_from_root('tests', 'core', 'test_exceptions_2') src, output = (test_path + s for s in ('.in', '.out')) self.do_run_from_file(src, output) - def test_white_list_exception(self): + def test_exceptions_white_list(self): if os.environ.get('EMCC_FAST_COMPILER') == '1': return self.skip('todo in fastcomp') Settings.DISABLE_EXCEPTION_CATCHING = 2 Settings.EXCEPTION_CATCHING_WHITELIST = ["__Z12somefunctionv"] Settings.INLINING_LIMIT = 50 # otherwise it is inlined and not identified - test_path = path_from_root('tests', 'core', 'test_white_list_exception') + test_path = path_from_root('tests', 'core', 'test_exceptions_white_list') src, output = (test_path + s for s in ('.in', '.out')) self.do_run_from_file(src, output) @@ -1315,7 +1315,7 @@ class T(RunnerCore): # Short name, to make it more fun to use manually on the co Settings.DISABLE_EXCEPTION_CATCHING = 0 Settings.EXCEPTION_CATCHING_WHITELIST = [] - def test_uncaught_exception(self): + def test_exceptions_uncaught(self): if self.emcc_args is None: return self.skip('no libcxx inclusion without emcc') Settings.DISABLE_EXCEPTION_CATCHING = 0 @@ -1354,29 +1354,31 @@ class T(RunnerCore): # Short name, to make it more fun to use manually on the co ''' self.do_run(src, 'success') - def test_typed_exceptions(self): - Settings.DISABLE_EXCEPTION_CATCHING = 0 - Settings.SAFE_HEAP = 0 # Throwing null will cause an ignorable null pointer access. - src = open(path_from_root('tests', 'exceptions', 'typed.cpp'), 'r').read() - expected = open(path_from_root('tests', 'exceptions', 'output.txt'), 'r').read() - self.do_run(src, expected) + def test_exceptions_typed(self): + Settings.DISABLE_EXCEPTION_CATCHING = 0 + Settings.SAFE_HEAP = 0 # Throwing null will cause an ignorable null pointer access. - def test_multiexception(self): + test_path = path_from_root('tests', 'core', 'test_exceptions_typed') + src, output = (test_path + s for s in ('.in', '.out')) + + self.do_run_from_file(src, output) + + def test_exceptions_multi(self): if os.environ.get('EMCC_FAST_COMPILER') == '1': return self.skip('todo in fastcomp') Settings.DISABLE_EXCEPTION_CATCHING = 0 - test_path = path_from_root('tests', 'core', 'test_multiexception') + test_path = path_from_root('tests', 'core', 'test_exceptions_multi') src, output = (test_path + s for s in ('.in', '.out')) self.do_run_from_file(src, output) - def test_std_exception(self): + def test_exceptions_std(self): if self.emcc_args is None: return self.skip('requires emcc') Settings.DISABLE_EXCEPTION_CATCHING = 0 self.emcc_args += ['-s', 'SAFE_HEAP=0'] - test_path = path_from_root('tests', 'core', 'test_std_exception') + test_path = path_from_root('tests', 'core', 'test_exceptions_std') src, output = (test_path + s for s in ('.in', '.out')) self.do_run_from_file(src, output) @@ -4292,6 +4294,12 @@ def process(filename): self.do_run_from_file(src, output) + def test_nl_types(self): + test_path = path_from_root('tests', 'core', 'test_nl_types') + src, output = (test_path + s for s in ('.in', '.out')) + + self.do_run_from_file(src, output) + def test_799(self): src = open(path_from_root('tests', '799.cpp'), 'r').read() self.do_run(src, '''Set PORT family: 0, port: 3979 |