~ubuntu-branches/ubuntu/vivid/emscripten/vivid

« back to all changes in this revision

Viewing changes to tests/test_benchmark.py

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2014-02-05 18:46:19 UTC
  • mfrom: (4.1.3 sid)
  • Revision ID: package-import@ubuntu.com-20140205184619-bmxq31rw0cd3ar4u
Tags: 1.10.0~20140205~ef1e460-1
* New snapshot release
* Also install cmake / emscripten files. Thanks to Daniele Di Proietto
  for the patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
51
51
      print
52
52
 
53
53
class NativeBenchmarker(Benchmarker):
54
 
  def __init__(self, name, cc, cxx):
 
54
  def __init__(self, name, cc, cxx, args=['-O2']):
55
55
    self.name = name
56
56
    self.cc = cc
57
57
    self.cxx = cxx
 
58
    self.args = args
58
59
 
59
60
  def build(self, parent, filename, args, shared_args, emcc_args, native_args, native_exec, lib_builder):
60
61
    self.parent = parent
61
62
    if lib_builder: native_args = native_args + lib_builder(self.name, native=True, env_init={ 'CC': self.cc, 'CXX': self.cxx })
62
63
    if not native_exec:
63
64
      compiler = self.cxx if filename.endswith('cpp') else self.cc
64
 
      process = Popen([compiler, '-O2', '-fno-math-errno', filename, '-o', filename+'.native'] + shared_args + native_args, stdout=PIPE, stderr=parent.stderr_redirect)
 
65
      process = Popen([compiler, '-fno-math-errno', filename, '-o', filename+'.native'] + self.args + shared_args + native_args, stdout=PIPE, stderr=parent.stderr_redirect)
65
66
      output = process.communicate()
66
67
      if process.returncode is not 0:
67
 
        print >> sys.stderr, "Building native executable with command '%s' failed with a return code %d!" % (' '.join([compiler, '-O2', filename, '-o', filename+'.native']), process.returncode)
 
68
        print >> sys.stderr, "Building native executable with command failed"
68
69
        print "Output: " + output[0]
69
70
    else:
70
71
      shutil.copyfile(native_exec, filename + '.native')
106
107
    final = os.path.dirname(filename) + os.path.sep + self.name+'_' + os.path.basename(filename) + '.js'
107
108
    try_delete(final)
108
109
    output = Popen([PYTHON, EMCC, filename, #'-O3',
109
 
                    '-O2', '-s', 'DOUBLE_MODE=0', '-s', 'PRECISE_I64_MATH=0',
 
110
                    '-O3', '-s', 'DOUBLE_MODE=0', '-s', 'PRECISE_I64_MATH=0',
110
111
                    '--memory-init-file', '0', '--js-transform', 'python hardcode.py',
111
112
                    '-s', 'TOTAL_MEMORY=128*1024*1024',
112
113
                    #'--closure', '1',
124
125
  benchmarkers = [
125
126
    #NativeBenchmarker('clang', CLANG_CC, CLANG),
126
127
    NativeBenchmarker('clang-3.2', os.path.join(LLVM_3_2, 'clang'), os.path.join(LLVM_3_2, 'clang++')),
 
128
    #NativeBenchmarker('clang-3.2-O3', os.path.join(LLVM_3_2, 'clang'), os.path.join(LLVM_3_2, 'clang++'), ['-O3']),
127
129
    #NativeBenchmarker('clang-3.3', os.path.join(LLVM_3_3, 'clang'), os.path.join(LLVM_3_3, 'clang++')),
128
130
    #NativeBenchmarker('clang-3.4', os.path.join(LLVM_3_4, 'clang'), os.path.join(LLVM_3_4, 'clang++')),
129
131
    #NativeBenchmarker('gcc', 'gcc', 'g++'),
472
474
  def lua(self, benchmark, expected, output_parser=None, args_processor=None):
473
475
    shutil.copyfile(path_from_root('tests', 'lua', benchmark + '.lua'), benchmark + '.lua')
474
476
    def lib_builder(name, native, env_init):
475
 
      ret = self.get_library('lua', [os.path.join('src', 'lua'), os.path.join('src', 'liblua.a')], make=['make', 'generic'], configure=None, native=native, cache_name_extra=name, env_init=env_init)
 
477
      ret = self.get_library('lua_native' if native else 'lua', [os.path.join('src', 'lua'), os.path.join('src', 'liblua.a')], make=['make', 'generic'], configure=None, native=native, cache_name_extra=name, env_init=env_init)
476
478
      if native: return ret
477
479
      shutil.copyfile(ret[0], ret[0] + '.bc')
478
480
      ret[0] += '.bc'