diff options
author | Alon Zakai <alonzakai@gmail.com> | 2012-11-20 14:12:05 +0100 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2012-11-20 14:12:05 +0100 |
commit | 9fb4f9c30b4cdbb971f1e189b0eb89045e553184 (patch) | |
tree | 153879b03f145f7781b42fae3810a43653ae04a6 /tests | |
parent | 165962f18b43f4893d1941a847a4b22c6d089532 (diff) |
warn on very large structural types that slow us down
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/runner.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/runner.py b/tests/runner.py index bea617d6..ba5ec148 100755 --- a/tests/runner.py +++ b/tests/runner.py @@ -8139,6 +8139,33 @@ f.close() output = Popen(['python', EMCC, os.path.join(self.get_dir(), 'main.cpp')], stderr=PIPE).communicate() self.assertNotContained('Unresolved symbol: _something\n', output[1]) + def test_toobig(self): + open(os.path.join(self.get_dir(), 'main.cpp'), 'w').write(r''' + #include <stdio.h> + + #define BYTES 100*1024*1024 + + int main(int argc, char **argv) { + if (argc == 100) { + static char buf[BYTES]; + static char buf2[BYTES]; + for (int i = 0; i < BYTES; i++) { + buf[i] = i*i; + buf2[i] = i/3; + } + for (int i = 0; i < BYTES; i++) { + buf[i] = buf2[i/2]; + buf2[i] = buf[i/3]; + } + printf("%d\n", buf[10] + buf2[20]); + } + return 0; + } + ''') + output = Popen(['python', EMCC, os.path.join(self.get_dir(), 'main.cpp')], stderr=PIPE).communicate()[1] + assert 'Emscripten failed' in output, output + assert 'warning: very large fixed-size structural type' in output, output + def test_prepost(self): open(os.path.join(self.get_dir(), 'main.cpp'), 'w').write(''' #include <stdio.h> |