diff options
| author | Alon Zakai <alonzakai@gmail.com> | 2013-11-05 17:52:22 -0800 | 
|---|---|---|
| committer | Alon Zakai <alonzakai@gmail.com> | 2013-11-05 17:52:22 -0800 | 
| commit | c0f26e65da33a6437a04d1adba19966f98fd79cb (patch) | |
| tree | 7da5b925b27a3a45f22d3de42aafcf2a6962e922 /tests | |
| parent | 21997d53d6cf2269cf215689e9673a1fe8ab719f (diff) | |
use __proto__ when available for new streams, otherwise do a full copy; fixes #1759, #1760
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test_other.py | 43 | 
1 files changed, 43 insertions, 0 deletions
| diff --git a/tests/test_other.py b/tests/test_other.py index 86e0eadf..584f6714 100644 --- a/tests/test_other.py +++ b/tests/test_other.py @@ -2010,6 +2010,49 @@ a(int [32], char [5]*)      try_delete(path_from_root('tests', 'Module-exports', 'test.js'))      try_delete(path_from_root('tests', 'Module-exports', 'test.js.map')) +  def test_fs_stream_proto(self): +    open('src.cpp', 'w').write(r''' +#include <stdio.h> +#include <fcntl.h> +#include <unistd.h> +#include <sys/stat.h> +#include <errno.h> +#include <string.h> + +int main() +{ +    int file_size = 0; +    int h = open("src.cpp", O_RDONLY, 0666); +    if (0 != h) +    { +        FILE* file = fdopen(h, "rb"); +        if (0 != file) +        { +            fseek(file, 0, SEEK_END); +            file_size = ftell(file); +            fseek(file, 0, SEEK_SET); +        } +        else +        { +            printf("fdopen() failed: %s\n", strerror(errno)); +            return 10; +        } +        close(h); +        printf("File size: %d\n", file_size); +    } +    else +    { +        printf("open() failed: %s\n", strerror(errno)); +        return 10; +    } +    return 0; +} +    ''') +    Popen([PYTHON, EMCC, 'src.cpp', '--embed-file', 'src.cpp']).communicate() +    for engine in JS_ENGINES: +      out = run_js('a.out.js', engine=engine, stderr=PIPE, full_output=True) +      self.assertContained('File size: 722', out) +    def test_simd(self):      self.clear()      Popen([PYTHON, EMCC, path_from_root('tests', 'linpack.c'), '-O2', '-DSP', '--llvm-opts', '''['-O3', '-vectorize', '-vectorize-loops', '-bb-vectorize-vector-bits=128', '-force-vector-width=4']''']).communicate() | 
