예제 #1
0
    def _build_jerryscript(self, profile, extra_flags):
        '''
        Build JerryScript for TizenRT target.
        '''
        tizenrt = self.env['modules']['tizenrt']
        jerry = self.env['modules']['jerryscript']

        profiles = {
            'minimal': jerry['paths']['minimal-profile'],
            'target': jerry['paths']['es2015-subset-profile']
        }

        build_flags = [
            '--clean', '--lto=OFF', '--jerry-cmdline=OFF', '--jerry-libc=OFF',
            '--jerry-libm=ON', '--all-in-one=OFF', '--mem-heap=70',
            '--profile=%s' % profiles[profile],
            '--toolchain=%s' % jerry['paths']['artik053-toolchain'],
            '--compile-flag=-isystem %s' % tizenrt['paths']['include']
        ] + extra_flags

        if self.env['info']['buildtype'] == 'debug':
            build_flags.append('--debug')

        # TizenRT requires the path of the used JerryScript folder.
        utils.define_environment('JERRYSCRIPT_ROOT_DIR', jerry['src'])

        utils.execute(jerry['src'], 'tools/build.py', build_flags)
예제 #2
0
    def _build_jerryscript(self, profile, extra_flags):
        '''
        Build JerryScript for NuttX target.
        '''
        nuttx = self.env['modules']['nuttx']
        jerry = self.env['modules']['jerryscript']

        profiles = {
            'minimal': jerry['paths']['minimal-profile'],
            'target': jerry['paths']['es2015-subset-profile']
        }

        build_flags = [
            '--clean', '--lto=OFF', '--jerry-cmdline=OFF', '--jerry-libc=OFF',
            '--jerry-libm=ON', '--all-in-one=OFF', '--mem-heap=70',
            '--profile=%s' % profiles[profile],
            '--toolchain=%s' % jerry['paths']['stm32f4dis-toolchain'],
            '--compile-flag=-I%s' % jerry['paths']['stm32f4dis-target'],
            '--compile-flag=-isystem %s' % nuttx['paths']['include']
        ] + extra_flags

        # NuttX requires the path of the used JerryScript folder.
        utils.define_environment('JERRYSCRIPT_ROOT_DIR', jerry['src'])

        utils.execute(jerry['src'], 'tools/build.py', build_flags)
예제 #3
0
    def build(self, app, buildtype, buildoptions, maketarget):
        '''
        Build the operating system.
        '''
        app_name = app.get_name()
        if app_name == 'iotjs':
            build_options = ['IOTJS_ROOT_DIR=' + paths.IOTJS_PATH]
            build_options.append('IOTJS_BUILD_OPTION=' +
                                 ' '.join(buildoptions))

            if buildtype == 'release':
                # Override the config file for release build.
                utils.copy_file(
                    utils.join(paths.CONFIG_PATH,
                               'iotjs-tizenrt-release.config'),
                    utils.join(paths.TIZENRT_OS_PATH, '.config'))

            tizenrt_patch = utils.join(paths.PATCHES_PATH,
                                       'iotjs-tizenrt-%s.diff' % buildtype)
            utils.patch(paths.IOTJS_PATH, tizenrt_patch, False)

            utils.execute(paths.TIZENRT_OS_PATH, 'make', build_options)

            utils.patch(paths.IOTJS_PATH, tizenrt_patch, True)

        elif app_name == 'jerryscript':
            utils.execute(paths.TIZENRT_OS_PATH, 'make')
예제 #4
0
    def _build_iotjs(self, profile, extra_flags):
        '''
        Build IoT.js for NuttX target.
        '''
        iotjs = self.env['modules']['iotjs']
        nuttx = self.env['modules']['nuttx']

        profiles = {
            'minimal': iotjs['paths']['minimal-profile'],
            'target': iotjs['paths']['nuttx-profile']
        }

        build_flags = [
            '--clean', '--no-parallel-build', '--no-init-submodule',
            '--target-arch=arm', '--target-os=nuttx',
            '--target-board=stm32f4dis', '--jerry-heaplimit=64',
            '--profile=%s' % profiles[profile],
            '--buildtype=%s' % self.env['info']['buildtype'],
            '--nuttx-home=%s' % nuttx['src']
        ] + extra_flags

        # NuttX requires the path of the used IoT.js folder.
        utils.define_environment('IOTJS_ROOT_DIR', iotjs['src'])

        utils.execute(iotjs['src'], 'tools/build.py', build_flags)
예제 #5
0
    def _build_iotjs(self, profile, extra_flags):
        '''
        Build IoT.js for Tizen target.
        '''
        iotjs = self.env['modules']['iotjs']

        profiles = {
            'minimal': 'profiles/minimal.profile',
            'target': 'test/profiles/tizen.profile'
        }

        build_flags = [
            '--clean', '--no-parallel-build', '--no-init-submodule',
            '--target-arch=noarch', '--target-os=tizen', '--target-board=rpi3',
            '--profile=%s' % profiles[profile],
            '--buildtype=%s' % self.env['info']['buildtype']
        ] + extra_flags

        iotjs_build_options = ' '.join(build_flags)
        # Note: these values should be defined for GBS, because
        #       it will compile the IoT.js itself.
        utils.define_environment('IOTJS_BUILD_OPTION', iotjs_build_options)

        args = ['--clean']

        if self.env['info']['buildtype'] == 'debug':
            args.append('--debug')

        utils.execute(iotjs['src'], 'config/tizen/gbsbuild.sh', args)

        tizen_build_dir = utils.join(paths.GBS_IOTJS_PATH, 'build')
        iotjs_build_dir = utils.join(iotjs['src'], 'build')
        # Copy the GBS created binaries to the iotjs build folder.
        # Note: GBS compiles iotjs in the GBS folder.
        utils.copy(tizen_build_dir, iotjs_build_dir)
예제 #6
0
    def install_dependencies(self):
        '''
        Install dependencies of the board.
        '''
        if utils.exists(utils.join(paths.STLINK_BUILD_PATH, 'st-flash')):
            return

        utils.execute(paths.STLINK_PATH, 'make', ['release'])
예제 #7
0
    def flash(self, app):
        '''
        Flash the given operating system to the board.
        '''
        os = self.get_os()
        options = ['write', os.get_image(), '0x8000000']

        utils.execute(paths.STLINK_BUILD_PATH, './st-flash', options)
예제 #8
0
    def reset(self):
        '''
        Reset the board.
        '''
        utils.execute(paths.STLINK_BUILD_PATH, './st-flash', ['reset'], quiet=True)

        # Wait a moment to boot the device.
        time.sleep(5)
예제 #9
0
 def __apply_patches(self, app):
     '''
     Apply patch file.
     '''
     patch = utils.join(paths.PATCHES_PATH,
                        'tizenrt-%s.diff' % app.get_name())
     utils.execute(paths.TIZENRT_PATH, 'git', ['reset', '--hard'])
     utils.execute(paths.TIZENRT_PATH, 'git', ['apply', patch])
예제 #10
0
    def prebuild(self, app, buildtype='release'):
        self.__copy_app_files(app)
        self.__apply_patches(app)
        self.__copy_test_files(app)

        utils.execute(paths.TIZENRT_OS_PATH, 'make', ['distclean'])
        utils.execute(paths.TIZENRT_OS_PATH, 'make', ['clean'])

        self.__configure(app)
예제 #11
0
    def initialize(self):
        '''
        Flash the device.
        '''
        if self.env['info']['no_flash']:
            return

        tizenrt = self.env['modules']['tizenrt']
        utils.execute(tizenrt['paths']['os'], 'make', ['download', 'ALL'])
예제 #12
0
    def __configure(self, app):
        '''
        Configuring TizenRT.
        '''

        # FIXME: now it supports artik053 device only
        configure_name = utils.join('artik053', app.get_name())
        utils.execute(paths.TIZENRT_TOOLS_PATH, './configure.sh',
                      [configure_name])
예제 #13
0
    def reset(self):
        '''
        Reset the device to create clean environment.
        '''
        flags = ['download', 'reset']

        utils.execute(self.tizenrt['paths']['os'], 'make', flags, quiet=True)
        # Wait a moment to boot the device.
        time.sleep(2)
예제 #14
0
    def reset(self):
        '''
        Reset the device to create clean environment.
        '''
        flasher = self.stlink['paths']['st-flash']

        utils.execute('.', flasher, ['reset'], quiet=True)
        # Wait a moment to boot the device.
        time.sleep(5)
예제 #15
0
    def flash(self, app):
        '''
        Send the application and the testsuite to the device with SFTP.
        '''
        lpath_app = app.get_image()
        lpath_app_stack = app.get_image_stack()
        lpath_testsuite = utils.make_archive(app.get_test_dir(), 'tar')

        rpath_app = utils.join(self.remote_path, app.get_cmd())
        rpath_app_stack = utils.join(self.remote_path, app.get_cmd_stack())
        rpath_testsuite = utils.join(self.remote_path, 'test.tar')

        # Freya cross build.
        utils.copy_file(utils.join(paths.TOOLS_PATH, 'freya-cross-build.sh'),
                        paths.FREYA_PATH)
        utils.execute(paths.FREYA_PATH, './freya-cross-build.sh')

        freya_dir = utils.join(paths.FREYA_PATH, 'valgrind_freya')
        lpath_freya = utils.make_archive(freya_dir, 'tar')
        rpath_freya = utils.join(self.remote_path, 'valgrind_freya.tar')

        lpath_resources = utils.make_archive(paths.RESOURCES_PATH, 'tar')
        rpath_resources = utils.join(self.remote_path, 'resources.tar')

        self.ssh.open()

        # Clean up in the remote folder.
        self.ssh.exec_command('rm -f ' + rpath_app)
        self.ssh.exec_command('rm -f ' + rpath_testsuite)
        self.ssh.exec_command('rm -f ' + rpath_freya)
        self.ssh.exec_command('rm -f ' + rpath_resources)
        self.ssh.exec_command('rm -rf ' + self.get_test_path())

        # Send the application, the testsuite, the valgrind and the resource files.
        self.ssh.send_file(lpath_app, rpath_app)
        self.ssh.send_file(lpath_testsuite, rpath_testsuite)
        self.ssh.send_file(lpath_freya, rpath_freya)
        self.ssh.send_file(lpath_resources, rpath_resources)

        # Let the iotjs to be runnable and extract the tests and valgrind files.
        self.ssh.exec_command('chmod 770 ' + rpath_app)
        self.ssh.exec_command('mkdir ' + self.get_test_path())
        self.ssh.exec_command('mkdir ' +
                              utils.join(self.remote_path, 'valgrind_freya'))
        self.ssh.exec_command('tar -xmf ' + rpath_testsuite + ' -C ' +
                              self.get_test_path())
        self.ssh.exec_command('tar -xmf ' + rpath_freya + ' -C ' +
                              utils.join(self.remote_path, 'valgrind_freya'))
        self.ssh.exec_command('tar -xmf ' + rpath_resources + ' -C ' +
                              self.remote_path)

        # Note: stack measurement is only supported for iotjs.
        if app.get_name() == 'iotjs':
            self.ssh.exec_command('rm -f ' + rpath_app_stack)
            self.ssh.send_file(lpath_app_stack, rpath_app_stack)
            self.ssh.exec_command('chmod 770 ' + rpath_app_stack)
예제 #16
0
    def __configure(self, app):
        '''
        Configuring NuttX.
        '''
        utils.execute(paths.NUTTX_TOOLS_PATH, './configure.sh',
                      ['stm32f4discovery/netnsh'])

        # Override the default config file with a prepared one.
        utils.copy_file(app.get_config_file(),
                        utils.join(paths.NUTTX_PATH, '.config'))
예제 #17
0
    def reset(self):
        '''
        Reset the board.
        '''
        utils.execute(paths.TIZENRT_OS_PATH,
                      'make', ['download', 'reset'],
                      quiet=True)

        # Wait a moment to boot the device.
        time.sleep(2)
예제 #18
0
    def __copy_test_files(self, app):
        '''
        Copy sample files into the NuttX apps.
        '''
        if utils.exists(paths.TIZENRT_ROMFS_CONTENTS_PATH):
            utils.execute(paths.TIZENRT_FS_PATH, 'rm', ['-rf', 'contents'])

        utils.execute(
            paths.ROOT_FOLDER, 'cp',
            [app.get_test_dir(), paths.TIZENRT_ROMFS_CONTENTS_PATH, '-r'])
예제 #19
0
    def _build_tizenrt(self):
        '''
        Build the TizenRT operating system.
        '''
        tizenrt = self.env['modules']['tizenrt']

        # Provide test files as ROMFS content.
        self._append_testfiles()

        utils.execute(tizenrt['paths']['os'], 'make', ['-j1'])
예제 #20
0
    def initialize(self):
        '''
        Flash the device.
        '''
        if self.env['info']['no_flash']:
            return

        target_app = self.env['modules']['app']
        build_path = self.env['paths']['build']

        test_src = target_app['paths']['tests']
        test_dst = utils.join(build_path, 'tests')

        # 1. Copy all the necessary files.
        # Copy applicaiton RPM package file.
        rpm_package_path = self.env['paths']['tizen-rpm-package']
        utils.copy(rpm_package_path, build_path)

        # Copy all the tests into the build folder.
        utils.copy(test_src, test_dst)

        utils.copy(paths.FREYA_TESTER, build_path)

        if not self.env['info']['no_memstat']:
            utils.copy(paths.FREYA_CONFIG, build_path)

            # Resolve the iotjs-dirname macro in the Freya configuration file.
            basename = utils.basename(paths.GBS_IOTJS_PATH)
            sed_flags = [
                '-i',
                's/%%{iotjs-dirname}/%s/g' % basename, 'iotjs-freya.config'
            ]
            utils.execute(build_path, 'sed', sed_flags)

        # 2. Deploy the build folder to the device.
        self.login()
        self.channel.exec_command('mount -o remount,rw /')

        shell_flags = 'ssh -p %s' % self.port
        rsync_flags = [
            '--rsh', shell_flags, '--recursive', '--compress', '--delete'
        ]
        # Note: slash character is required after the path.
        # In this case `rsync` copies the whole folder, not
        # the subcontents to the destination.
        src = self.env['paths']['build'] + '/'
        dst = '%s@%s:%s' % (self.user, self.ip, self.workdir)

        utils.execute('.', 'rsync', rsync_flags + [src, dst])

        # 3. Install rpm package
        template = 'rpm -ivh --force --nodeps %s/%s-1.0.0-0.armv7l.rpm'
        self.channel.exec_command(template % (self.workdir, self.app))

        self.logout()
예제 #21
0
    def _build_stlink(self):
        '''
        Build the ST-Link flasher tool.
        '''
        stlink = self.env['modules']['stlink']

        # Do not build if not necessary.
        if utils.exists(stlink['paths']['st-flash']):
            return

        utils.execute(stlink['src'], 'make', ['release'])
예제 #22
0
    def build(self, app, buildtype, buildoptions, maketarget):
        '''
        Build the operating system.
        '''
        if buildtype == 'release':
            utils.define_environment('R', '1')
        else:
            utils.define_environment('R', '0')

        utils.define_environment('EXTRA_LIBS', '-Map=nuttx.map')
        utils.define_environment('IOTJS_ROOT_DIR', paths.IOTJS_PATH)

        utils.execute(paths.NUTTX_PATH, 'make', ['-j1', maketarget])
예제 #23
0
    def initialize(self):
        '''
        Flash the device.
        '''
        if self.env['info']['no_flash']:
            return

        stlink = self.env['modules']['stlink']
        nuttx = self.env['modules']['nuttx']

        flash_flags = ['write', nuttx['paths']['image'], '0x8000000']

        utils.execute(stlink['src'], 'build/Release/st-flash', flash_flags)
예제 #24
0
    def _build_nuttx(self):
        '''
        Build the NuttX Operating System.
        '''
        nuttx = self.env['modules']['nuttx']
        buildtype = self.env['info']['buildtype']

        utils.define_environment('R', int(buildtype == 'release'))
        utils.define_environment('EXTRA_LIBS', '-Map=nuttx.map')

        # Provide test files as ROMFS content.
        self._append_testfiles()

        utils.execute(nuttx['src'], 'make', ['-j1'])
예제 #25
0
    def __update_status_icon(self, app_name, device_type):
        '''
        Update the status icon.
        '''
        results_web_path = TEST_RESULTS_WEB_PATH[app_name]
        if not utils.exists(results_web_path):
            return

        utils.execute(results_web_path, 'git', ['pull', 'origin', 'gh-pages'])
        status = 'passing'
        for test in self.results:
            if test['result'] == 'fail':
                status = 'failing'
                break

        current_status_icon = utils.join(results_web_path, 'status',
                                         '%s.svg' % device_type)

        if not utils.exists(current_status_icon):
            return

        with open(current_status_icon) as file:
            if status in file.read():
                return

        image = 'pass.svg' if status is 'passing' else 'fail.svg'
        copied_status_icon = utils.join(results_web_path, 'img', image)
        utils.copy_file(copied_status_icon, current_status_icon)

        utils.execute(results_web_path, 'git', ['add', current_status_icon])
        utils.execute(results_web_path, 'git',
                      ['commit', '-m', 'Update the status badge.'])
        utils.execute(results_web_path, 'git', ['push'])
예제 #26
0
    def __apply_heap_patches(self, device, revert=False):
        '''
        Apply memstat patches to measure the memory consumption of IoT.js
        '''
        if device.get_type() in ['stm32f4dis', 'artik053']:
            iotjs_memstat_patch = utils.join(paths.PATCHES_PATH,
                                             'iotjs-memstat.diff')
            utils.patch(paths.IOTJS_PATH, iotjs_memstat_patch, revert)

            libtuv_memstat_patch = utils.join(paths.PATCHES_PATH,
                                              'libtuv-memstat.diff')
            utils.patch(paths.IOTJS_LIBTUV_PATH, libtuv_memstat_patch, revert)
            utils.execute(paths.IOTJS_LIBTUV_PATH, 'git', ['add', '-u'])

        jerry_memstat_patch = utils.join(paths.PATCHES_PATH,
                                         'jerry-memstat.diff')
        utils.patch(paths.IOTJS_JERRY_PATH, jerry_memstat_patch, revert)
        utils.execute(paths.IOTJS_JERRY_PATH, 'git', ['add', '-u'])
예제 #27
0
    def _prebuild_tizenrt(self):
        '''
        Clean TizenRT and configure it for the appropriate application.
        '''
        tizenrt = self.env['modules']['tizenrt']
        config = 'artik053/%s' % self.env['info']['app']

        utils.execute(tizenrt['paths']['os'], 'make', ['distclean'])
        utils.execute(tizenrt['paths']['tools'], './configure.sh', [config])
        utils.execute(tizenrt['paths']['os'], 'make', ['clean'])
        utils.execute(tizenrt['paths']['os'], 'make', ['context'])
예제 #28
0
    def _prebuild_nuttx(self):
        '''
        Clean NuttX and configure it for serial communication.
        '''
        nuttx = self.env['modules']['nuttx']
        config = ['stm32f4discovery/usbnsh']

        utils.execute(nuttx['src'], 'make', ['distclean'])
        utils.execute(nuttx['paths']['tools'], './configure.sh', config)
        utils.execute(nuttx['src'], 'make', ['clean'])
        utils.execute(nuttx['src'], 'make', ['context'])
예제 #29
0
    def initialize(self):
        '''
        Flash the device.
        '''
        if self.env['info']['no_flash']:
            return

        # 1. Copy all the necessary files.
        target_app = self.env['modules']['app']
        build_path = self.env['paths']['build']

        test_src = target_app['paths']['tests']
        test_dst = utils.join(build_path, 'tests')

        # Copy all the tests into the build folder.
        utils.copy(test_src, test_dst)

        utils.copy(paths.FREYA_TESTER, build_path)

        if not self.env['info']['no_memstat']:
            # Copy Freya memory measurement files.
            utils.copy(paths.FREYA_CONFIG, build_path)

            # Resolve the iotjs-dirname macro in the Freya configuration file.
            basename = utils.basename(target_app['src'])
            sed_flags = [
                '-i',
                's/%%{iotjs-dirname}/%s/g' % basename, 'iotjs-freya.config'
            ]
            utils.execute(build_path, 'sed', sed_flags)

        # 2. Deploy the build folder to the device.
        shell_flags = 'ssh -p %s' % self.port
        rsync_flags = [
            '--rsh', shell_flags, '--recursive', '--compress', '--delete'
        ]
        # Note: slash character is required after the path.
        # In this case `rsync` copies the whole folder, not
        # the subcontents to the destination.
        src = self.env['paths']['build'] + '/'
        dst = '%s@%s:%s' % (self.user, self.ip, self.workdir)

        utils.execute('.', 'rsync', rsync_flags + [src, dst])
예제 #30
0
 def __update_repository(self):
     '''
     Update the repository.
     '''
     utils.execute(paths.TIZENRT_PATH, 'git', ['clean', '-dxf'])
     utils.execute(paths.TIZENRT_PATH, 'git', ['reset', '--hard'])
     utils.execute(paths.TIZENRT_PATH, 'git', ['pull'])