diff options
author | Alon Zakai <alonzakai@gmail.com> | 2012-01-31 14:13:43 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2012-01-31 14:13:43 -0800 |
commit | 632b89aa0d4742ff621c40a20619e73c59c694f6 (patch) | |
tree | aa8e964b25cb0858eedf605e11d83a65fc239e5a | |
parent | 2761fe8d19002c94aa25d92246fc9968ba7c2cac (diff) | |
parent | a0da7bd948f3c88d0b9164994179277b72f3758c (diff) |
Merge pull request #200 from ehsan/openjpeg_test
Make test_openjpeg pass on Mac
-rw-r--r-- | system/include/libc/sys/types.h | 2 | ||||
-rwxr-xr-x | tests/runner.py | 18 | ||||
-rw-r--r-- | tests/systypes/output.txt | 1 | ||||
-rw-r--r-- | tests/systypes/src.c | 20 |
4 files changed, 38 insertions, 3 deletions
diff --git a/system/include/libc/sys/types.h b/system/include/libc/sys/types.h index 734004e7..ab6e895b 100644 --- a/system/include/libc/sys/types.h +++ b/system/include/libc/sys/types.h @@ -134,7 +134,7 @@ typedef unsigned long ino_t; /* XXX Emscripten */ #endif #endif /*__CYGWIN__*/ -#ifdef __MS_types__ +#if defined(__MS_types__) || defined(EMSCRIPTEN) typedef unsigned long vm_offset_t; typedef unsigned long vm_size_t; diff --git a/tests/runner.py b/tests/runner.py index 4bf8f008..6620250d 100755 --- a/tests/runner.py +++ b/tests/runner.py @@ -14,7 +14,7 @@ will use 4 processes. To install nose do something like ''' from subprocess import Popen, PIPE, STDOUT -import os, unittest, tempfile, shutil, time, inspect, sys, math, glob, tempfile, re, difflib, webbrowser, hashlib, BaseHTTPServer, threading +import os, unittest, tempfile, shutil, time, inspect, sys, math, glob, tempfile, re, difflib, webbrowser, hashlib, BaseHTTPServer, threading, platform # Setup @@ -70,6 +70,15 @@ class RunnerCore(unittest.TestCase): def get_dir(self): return self.working_dir + def get_shared_library_name(self, linux_name): + if platform.system() == 'Linux': + return linux_name + elif platform.system() == 'Darwin': + return linux_name.replace('.so', '') + '.dylib' + else: + print >> sys.stderr, 'get_shared_library_name needs to be implemented on %s' % platform.system() + return linux_name + def get_stdout_path(self): return os.path.join(self.get_dir(), 'stdout') @@ -3843,6 +3852,11 @@ def process(filename): expected = open(path_from_root('tests', 'env', 'output.txt'), 'r').read() self.do_run(src, expected) + def test_systypes(self): + src = open(path_from_root('tests', 'systypes', 'src.c'), 'r').read() + expected = open(path_from_root('tests', 'systypes', 'output.txt'), 'r').read() + self.do_run(src, expected) + def test_getloadavg(self): src = r''' #include <stdio.h> @@ -4352,7 +4366,7 @@ def process(filename): shutil.copy(path_from_root('tests', 'openjpeg', 'opj_config.h'), self.get_dir()) lib = self.get_library('openjpeg', - [os.path.join('bin', 'libopenjpeg.so.1.4.0'), + [os.path.join('bin', self.get_shared_library_name('libopenjpeg.so.1.4.0')), os.path.sep.join('codec/CMakeFiles/j2k_to_image.dir/index.c.o'.split('/')), os.path.sep.join('codec/CMakeFiles/j2k_to_image.dir/convert.c.o'.split('/')), os.path.sep.join('codec/CMakeFiles/j2k_to_image.dir/__/common/color.c.o'.split('/')), diff --git a/tests/systypes/output.txt b/tests/systypes/output.txt new file mode 100644 index 00000000..2e9ba477 --- /dev/null +++ b/tests/systypes/output.txt @@ -0,0 +1 @@ +success diff --git a/tests/systypes/src.c b/tests/systypes/src.c new file mode 100644 index 00000000..a01ed578 --- /dev/null +++ b/tests/systypes/src.c @@ -0,0 +1,20 @@ +#include <sys/types.h> + +// Declare puts manually, we don't want to include any other headers here +#ifdef __cplusplus +extern "C" +#endif +int puts(const char*); + +int main() { + int8_t i8 = 0; + u_int8_t ui8 = 0; + int16_t i16 = 0; + u_int16_t ui16 = 0; + int32_t i32 = 0; + u_int32_t ui32 = 0; + int64_t i64 = 0; + u_int64_t ui64 = 0; + puts("success"); + return 0; +} |