diff options
| author | Alon Zakai <alonzakai@gmail.com> | 2011-12-21 16:01:33 -0800 | 
|---|---|---|
| committer | Alon Zakai <alonzakai@gmail.com> | 2011-12-21 16:01:33 -0800 | 
| commit | 2762b895286b4c7b15d9108d3d4fc56b07eb4d45 (patch) | |
| tree | 944cc69a2ed6724b16cbaa345d6f414209477fff | |
| parent | e974325393b583d561125e52111dba5d97db4a77 (diff) | |
remove closure test, enable closure in test_files to achieve the same goal in a more emcc compatible way
| -rw-r--r-- | tests/runner.py | 50 | 
1 files changed, 3 insertions, 47 deletions
diff --git a/tests/runner.py b/tests/runner.py index 2f52d6a3..286f9f14 100644 --- a/tests/runner.py +++ b/tests/runner.py @@ -2961,6 +2961,9 @@ at function.:blag        self.do_run(src, expected, extra_emscripten_args=['-H', 'libc/langinfo.h'])      def test_files(self): +      if self.emcc_args is not None and '-O2' in self.emcc_args: +        self.emcc_args += ['--closure', '1'] # Use closure here, to test we don't break FS stuff +        Settings.CORRECT_SIGNS = 1 # Just so our output is what we expect. Can flip them both.        post = '''  def process(filename): @@ -4480,53 +4483,6 @@ def process(filename):      ### Tests for tools -    def test_closure_compiler(self): -      src = ''' -        #include<stdio.h> -        int main() { -          printf("*closured*\\n"); - -          FILE *file = fopen("somefile.binary", "rb"); -          char buffer[1024]; -          size_t read = fread(buffer, 1, 4, file); -          printf("data: %d", buffer[0]); -          for (int i = 1; i < 4; i++) -            printf(",%d", buffer[i]); -          printf("\\n"); - -          return 0; -        } -      ''' - -      post = ''' -def process(filename): -  import re, shutil -  from subprocess import Popen, PIPE, STDOUT -  import tools.shared as shared - -  src = open(filename, 'r').read().replace( -    '// {{PRE_RUN_ADDITIONS}}', -    \'\'\' -      FS.createDataFile('/', 'somefile.binary', [100, 1, 50, 25, 10, 77, 123], true, false); -    \'\'\' -  ) -  open(filename, 'w').write(src) - -  Popen(['java', '-jar', shared.CLOSURE_COMPILER, -                 '--compilation_level', 'ADVANCED_OPTIMIZATIONS', -                 '--formatting', 'PRETTY_PRINT', -                 '--variable_map_output_file', filename + '.vars', -                 '--js', filename, '--js_output_file', filename + '.cc.js'], stdout=PIPE, stderr=STDOUT).communicate() -  assert not re.search('function \w\(', open(filename, 'r').read()) # closure generates this kind of stuff - functions with single letters. Normal doesn't. -  src = open(filename + '.cc.js', 'r').read() -  assert re.search('function \w\(', src) # see before -  assert 'function _main()' not in src # closure should have wiped it out -  shutil.move(filename, filename + '.old.js') -  open(filename, 'w').write(src) -''' - -      self.do_run(src, '*closured*\ndata: 100,1,50,25\n', post_build=post) -      def test_safe_heap(self):        if not Settings.SAFE_HEAP: return self.skip('We need SAFE_HEAP to test SAFE_HEAP')        if Settings.USE_TYPED_ARRAYS == 2: return self.skip('It is ok to violate the load-store assumption with TA2')  | 
