Beispiel #1
0
 def execute_makefile(self, path_to_makefile, extra_opts=[]):
     if isinstance(path_to_makefile, GnuMakefile):
         path = path_to_makefile.makefile_dir
     else:
         path = path_to_makefile
     log.execute("make %s in %s" % (" ".join(extra_opts), path))
     returncode, stdout, stderr = _run_subprocess(self.make_cmd, ["-C", str(path)] + extra_opts)
     self._handle_error(returncode, stdout, stderr, path.join("make"))
Beispiel #2
0
 def execute_makefile(self, path_to_makefile, extra_opts=[]):
     if isinstance(path_to_makefile, GnuMakefile):
         path = path_to_makefile.makefile_dir
     else:
         path = path_to_makefile
     log.execute('make %s in %s' % (" ".join(extra_opts), path))
     returncode, stdout, stderr = _run_subprocess(
         self.make_cmd, ['-C', str(path)] + extra_opts)
     self._handle_error(returncode, stdout, stderr, path.join('make'))
Beispiel #3
0
 def execute_makefile(self, path_to_makefile, extra_opts=[]):
     if isinstance(path_to_makefile, GnuMakefile):
         path = path_to_makefile.makefile_dir
     else:
         path = path_to_makefile
     log.execute('make %s in %s' % (" ".join(extra_opts), path))
     returncode, stdout, stderr = _run_subprocess(
         '/scratchbox/login', ['make', '-C', str(path)] + extra_opts)
     self._handle_error(returncode, stdout, stderr, path.join('make'))
Beispiel #4
0
 def execute_makefile(self, path_to_makefile, extra_opts=[]):
     if isinstance(path_to_makefile, GnuMakefile):
         path = path_to_makefile.makefile_dir
     else:
         path = path_to_makefile
     log.execute('sb2 %s make %s in %s' % (' '.join(SB2ARGS), " ".join(extra_opts), path))
     returncode, stdout, stderr = _run_subprocess(
         'sb2', SB2ARGS + ['make', '-C', str(path)] + extra_opts)
     self._handle_error(returncode, stdout, stderr, path.join('make'))
Beispiel #5
0
 def execute_makefile(self, path_to_makefile, extra_opts=[]):
     if isinstance(path_to_makefile, GnuMakefile):
         path = path_to_makefile.makefile_dir
     else:
         path = path_to_makefile
     log.execute('make %s in %s' % (" ".join(extra_opts), path))
     env = os.environ.copy()
     returncode, stdout, stderr = _run_subprocess(
         self.make_cmd, ['-C', str(path)] + extra_opts, env=env)
     self._handle_error(returncode, stdout, stderr, path.join('make'))
Beispiel #6
0
def test_PyPy():
    pypy_dir = py.path.local(
        os.environ.get(
            'PYPY_MU',
            str(py.path.local(__file__).join('..', 'mu-client-pypy'))))

    python = os.environ.get('PYTHON', 'pypy')  # by default use pypy
    target = bin_dir.join('pypy-zebu')

    cmd = [pypy_dir.join('rpython/bin/rpython')]
    flags = [
        '-O3', '--no-shared', '--backend=mu', '--mu-impl=zebu', '--mu-vmargs',
        '--gc-immixspace-size=10737418240',
        '--mu-suplibdir=%(bin_dir)s' % globals()
    ]
    # flags = ['-O3', '--no-shared', '--backend=c', '--no-profopt']
    args = ['--no-allworkingmodules']
    cmd.extend(flags)

    cmd.extend(['--output=%s' % target])

    cmd.append(pypy_dir.join('pypy', 'goal', 'targetpypystandalone.py'))
    cmd.extend(args)

    cmd = map(str, cmd)

    log_platform.execute(' '.join([python] + cmd))
    res = platform.execute(python, map(str, cmd))
    assert res.returncode == 0, res.err

    fib_py = bin_dir.join('fib.py')
    with fib_py.open('w') as fp:
        fp.write("""
def fib(n):
    if n in (0, 1):
        return n
    return fib(n - 1) + fib(n - 2)

def main(argv):
    print fib(int(argv[1]))

if __name__ == "__main__":
    import sys
    main(sys.argv)
""")

    log_platform.execute(' '.join([str(target), str(fib_py), '10']))
    res = platform.execute(str(target), [str(fib_py), '10'])
    assert res.returncode == 0, res.err
    assert res.out == "55\n"
Beispiel #7
0
    def execute_makefile(self, path_to_makefile, extra_opts=[]):
        if isinstance(path_to_makefile, NMakefile):
            path = path_to_makefile.makefile_dir
        else:
            path = path_to_makefile
        log.execute("make %s in %s" % (" ".join(extra_opts), path))
        oldcwd = path.chdir()
        try:
            returncode, stdout, stderr = _run_subprocess(
                "nmake", ["/nologo", "/f", str(path.join("Makefile"))] + extra_opts, env=self.c_environ
            )
        finally:
            oldcwd.chdir()

        self._handle_error(returncode, stdout, stderr, path.join("make"))
Beispiel #8
0
    def execute_makefile(self, path_to_makefile, extra_opts=[]):
        if isinstance(path_to_makefile, NMakefile):
            path = path_to_makefile.makefile_dir
        else:
            path = path_to_makefile
        log.execute('make %s in %s' % (" ".join(extra_opts), path))
        oldcwd = path.chdir()
        try:
            returncode, stdout, stderr = _run_subprocess(
                'nmake',
                ['/nologo', '/f', str(path.join('Makefile'))] + extra_opts)
        finally:
            oldcwd.chdir()

        self._handle_error(returncode, stdout, stderr, path.join('make'))
Beispiel #9
0
    def execute_makefile(self, path_to_makefile, extra_opts=[]):
        if isinstance(path_to_makefile, NMakefile):
            path = path_to_makefile.makefile_dir
        else:
            path = path_to_makefile
        log.execute('%s %s in %s' % (self.make, " ".join(extra_opts), path))
        oldcwd = path.chdir()
        try:
            returncode, stdout, stderr = _run_subprocess(
                self.make,
                ['/nologo', '/f', str(path.join('Makefile'))] + extra_opts,
                env=self.c_environ)
        finally:
            oldcwd.chdir()

        self._handle_error(returncode, stdout, stderr, path.join('make'))
Beispiel #10
0
 def spawn_and_log(cmd, *args, **kwds):
     log.execute(' '.join(cmd))
     return spawn(cmd, *args, **kwds)
Beispiel #11
0
 def _execute_c_compiler(self, cc, args, outname):
     log.execute('/scratchbox/login ' + cc + ' ' + ' '.join(args))
     args = [cc] + args
     returncode, stdout, stderr = _run_subprocess('/scratchbox/login', args)
     self._handle_error(returncode, stdout, stderr, outname)
Beispiel #12
0
 def _execute_c_compiler(self, cc, args, outname, cwd=None):
     log.execute('sb2 ' + ' '.join(SB2ARGS) + ' ' + cc + ' ' + ' '.join(args))
     args = SB2ARGS + [cc] + args
     returncode, stdout, stderr = _run_subprocess('sb2', args)
     self._handle_error(returncode, stderr, stdout, outname)
Beispiel #13
0
 def _execute_c_compiler(self, cc, args, outname):
     log.execute('/scratchbox/login ' + cc + ' ' + ' '.join(args))
     args = [cc] + args
     returncode, stdout, stderr = _run_subprocess('/scratchbox/login', args)
     self._handle_error(returncode, stdout, stderr, outname)
Beispiel #14
0
 def _execute_c_compiler(self, cc, args, outname, cwd=None):
     log.execute('sb2 ' + ' '.join(SB2ARGS) + ' ' + cc + ' ' + ' '.join(args))
     args = SB2ARGS + [cc] + args
     returncode, stdout, stderr = _run_subprocess('sb2', args)
     self._handle_error(returncode, stderr, stdout, outname)
Beispiel #15
0
 def spawn_and_log(cmd, *args, **kwds):
     log.execute(' '.join(cmd))
     return spawn(cmd, *args, **kwds)