示例#1
0
    def test_logged_call(self):
        if os.path.exists(
                os.path.join(_Config.ROOT_DIR, 'log.tmp')
        ):
            os.remove(
                os.path.join(_Config.ROOT_DIR, 'log.tmp')
            )

        e1 = Executor(
            _Config.ROOT_DIR
        )

        e1.logged_call(
            'echo THOR',
            logfile='log.tmp'
        )

        with open(os.path.join(_Config.ROOT_DIR, 'log.tmp'), 'r') as f:
            self.assertEqual(
                f.readline().strip('\n'),
                'THOR'
            )

        os.remove(
            os.path.join(_Config.ROOT_DIR, 'log.tmp')
        )
示例#2
0
文件: UNIX.py 项目: adyasha/dune
    def optimize(self) -> int:
        executor = Executor(
            cwd=self.work_dir
        )

        executor.logged_call(
            cmd='strip ./main.native',
            logfile='strip.log'
        )

        return executor.pid
示例#3
0
文件: UNIX.py 项目: adyasha/dune
    def compile(self) -> int:
        # TODO: Need better exception handling
        executor = Executor(
            cwd=self.work_dir
        )

        executor.logged_call(
            cmd='make',
            logfile='compile.log'
        )

        return executor.pid
示例#4
0
文件: UNIX.py 项目: adyasha/dune
    def configure(self) -> int:
        # TODO: Need better exception handling
        executor = Executor(
            cwd=self.work_dir
        )

        executor.logged_call(
            cmd='mirage configure --unix',
            logfile='configure.log'
        )

        return executor.pid
示例#5
0
文件: UNIX.py 项目: adyasha/dune
    def start(self) -> int:
        executor = Executor(
            cwd=self.work_dir
        )

        executor.logged_call(
            cmd='./main.native',
            logfile='stdout.log',
            stderr=True  # FIXME: Mirage console prints to stderr by default
        )

        Status.set(
            self._id,
            executor.probe_status()
        )

        return executor.pid