Skip to content

Commit 83706e8

Browse files
committed
move test_embed_file_large to other
1 parent 8024889 commit 83706e8

File tree

2 files changed

+27
-25
lines changed

2 files changed

+27
-25
lines changed

tests/test_core.py

-25
Original file line numberDiff line numberDiff line change
@@ -4233,31 +4233,6 @@ def test_fileno(self):
42334233
self.emcc_args += ['--embed-file', 'empty.txt']
42344234
self.do_run(src, '4\n3\n-1\n')
42354235

4236-
def test_file_large(self):
4237-
if self.emcc_args is None: return self.skip('requires emcc')
4238-
# If such long files are encoded on one line,
4239-
# they overflow the interpreter's limit
4240-
large_size = int(40e6)
4241-
open(os.path.join(self.get_dir(), 'large.txt'), 'w').write('x' * large_size)
4242-
src = r'''
4243-
#include <stdio.h>
4244-
#include <unistd.h>
4245-
int main()
4246-
{
4247-
FILE* fp = fopen("large.txt", "r");
4248-
if (fp) {
4249-
printf("%d\n", fp);
4250-
fseek(fp, 0L, SEEK_END);
4251-
printf("%d\n", ftell(fp));
4252-
} else {
4253-
printf("failed to open large file.txt\n");
4254-
}
4255-
return 0;
4256-
}
4257-
'''
4258-
self.emcc_args += ['--embed-file', 'large.txt']
4259-
self.do_run(src, '4\n' + str(large_size) + '\n')
4260-
42614236
def test_readdir(self):
42624237
src = open(path_from_root('tests', 'dirent', 'test_readdir.c'), 'r').read()
42634238
self.do_run(src, 'SIGILL: Illegal instruction\nsuccess', force_c=True)

tests/test_other.py

+27
Original file line numberDiff line numberDiff line change
@@ -3723,3 +3723,30 @@ def test_create_readonly(self):
37233723
Failed to open file for writing: /tmp/file; errno=13; Permission denied
37243724
''', run_js('a.out.js'))
37253725

3726+
def test_embed_file_large(self):
3727+
# If such long files are encoded on one line,
3728+
# they overflow the interpreter's limit
3729+
large_size = int(40e6)
3730+
open('large.txt', 'w').write('x' * large_size)
3731+
open('src.cpp', 'w').write(r'''
3732+
#include <stdio.h>
3733+
#include <unistd.h>
3734+
int main()
3735+
{
3736+
FILE* fp = fopen("large.txt", "r");
3737+
if (fp) {
3738+
printf("%d\n", fp);
3739+
fseek(fp, 0L, SEEK_END);
3740+
printf("%d\n", ftell(fp));
3741+
} else {
3742+
printf("failed to open large file.txt\n");
3743+
}
3744+
return 0;
3745+
}
3746+
''')
3747+
Popen([PYTHON, EMCC, 'src.cpp', '--embed-file', 'large.txt']).communicate()
3748+
for engine in JS_ENGINES:
3749+
if engine == V8_ENGINE: continue # ooms
3750+
print engine
3751+
self.assertContained('4\n' + str(large_size) + '\n', run_js('a.out.js', engine=engine))
3752+

0 commit comments

Comments
 (0)