Exemplo n.º 1
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'])
Exemplo n.º 2
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')
Exemplo n.º 3
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)
Exemplo n.º 4
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'))
Exemplo n.º 5
0
    def __copy_app_files(self, app):
        '''
        Copy application files into the NuttX apps.
        '''
        utils.copy_files(app.get_home_dir(), app.get_install_dir())

        # Override the default romfs image file.
        utils.copy_file(
            app.get_romfs_file(),
            utils.join(paths.NUTTX_APPS_NSHLIB_PATH, 'nsh_romfsimg.h'))
Exemplo n.º 6
0
    def build(self, device):
        '''
        Build IoT.js for the target device/OS and for Raspberry Pi 2.
        '''

        # prebuild the OS
        os = device.get_os()
        os.prebuild(self)

        utils.rmtree(paths.IOTJS_MAP_DIR_PATH)
        utils.mkdir(paths.IOTJS_MAP_DIR_PATH)

        build_flags = [
            '--clean',
            '--buildtype=%s' % self.buildtype,
            '--target-arch=arm',
            '--target-os=%s' % os.get_name(),
        ]

        # Step 1: Set the appropriate build flags for the targets.
        if device.get_type() == 'stm32f4dis':
            build_flags.append('--target-board=%s' % device.get_type())
            build_flags.append('--jerry-heaplimit=56')
            build_flags.append('--no-parallel-build')
            build_flags.append('--nuttx-home=%s' % paths.NUTTX_PATH)

            profile = utils.join(paths.IOTJS_TEST_PROFILES_PATH,
                                 'nuttx.profile')
            mapfile = utils.join(paths.NUTTX_PATH, "arch/arm/src/nuttx.map")

        elif device.get_type() == 'rpi2':
            build_flags.append('--target-board=%s' % device.get_type())

            profile = utils.join(paths.IOTJS_TEST_PROFILES_PATH,
                                 'rpi2-linux.profile')
            mapfile = utils.join(paths.IOTJS_BUILD_PATH % self.buildtype,
                                 "../iotjs.map")

        elif device.get_type() == 'artik053':
            profile = utils.join(paths.IOTJS_TEST_PROFILES_PATH,
                                 'tizenrt.profile')
            mapfile = utils.join(paths.TIZENRT_BUILD_PATH,
                                 "output/bin/tinyara.map")

        else:
            console.fail('Non-minimal IoT.js build failed, unsupported '
                         'device (%s)!' % device.get_type())

        # Step 2: Create minimal profile build for the binary size measurement.
        build_flags.append('--profile=%s' % paths.IOTJS_MINIMAL_PROFILE_PATH)

        # Note: IoT.js is built by TizenRT in case of artik053.
        if device.get_type() in ['stm32f4dis', 'rpi2']:
            utils.execute(paths.IOTJS_PATH, 'tools/build.py', build_flags)

        os.build(self, self.buildtype, build_flags, 'all')
        utils.copy_file(mapfile, paths.IOTJS_MINIMAL_MAP_FILE_PATH)

        # Step 3: Create target specific profile build for the binary size measurement.
        os.prebuild(self)

        build_flags = build_flags[:-1]
        build_flags.append('--profile=%s' % profile)

        if device.get_type() in ['stm32f4dis', 'rpi2']:
            utils.execute(paths.IOTJS_PATH, 'tools/build.py', build_flags)

        os.build(self, self.buildtype, build_flags, 'all')
        utils.copy_file(mapfile, paths.IOTJS_TARGET_MAP_FILE_PATH)

        # Step 4: Create target specific profile with patches for the tests.
        self.__apply_heap_patches(device)

        if device.get_type() in ['stm32f4dis', 'artik053']:
            self.__apply_stack_patches(device)

        os.prebuild(self)

        build_flags_heap = list(build_flags)
        build_flags_heap.append('--jerry-memstat')
        if device.get_type() == 'rpi2':
            build_flags_heap.append('--compile-flag=-g')
            build_flags_heap.append('--jerry-compile-flag=-g')

        if device.get_type() in ['stm32f4dis', 'rpi2']:
            utils.execute(paths.IOTJS_PATH, 'tools/build.py', build_flags_heap)

        os.build(self, self.buildtype, build_flags_heap, 'all')

        # Revert all the memstat patches from the project.
        self.__apply_heap_patches(device, revert=True)

        # Build the application to stack consumption check
        if device.get_type() == 'rpi2':
            self.__apply_stack_patches(device)
            build_flags.append('--builddir=%s' % paths.IOTJS_BUILD_STACK_DIR)
            utils.execute(paths.IOTJS_PATH, 'tools/build.py', build_flags)

        self.__apply_stack_patches(device, revert=True)