Exemplo n.º 1
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)
Exemplo n.º 2
0
    def _append_testfiles(self):
        '''
        Add test files to the contents folder of TizenRT.
        '''
        target_app = self.env['modules']['app']
        tizenrt = self.env['modules']['tizenrt']

        test_src = target_app['paths']['tests']
        test_dst = tizenrt['paths']['contents']

        utils.rmtree(test_dst)
        utils.copy(test_src, test_dst)
Exemplo n.º 3
0
def save_artifacts(modules):
    '''
    Copy the created files (libs, linker.map, ...) into the build folder.
    '''
    for _, build_info in modules.iteritems():
        # Do not copy the artifact if not necessary.
        for artifact in build_info.get('artifacts', []):
            if 'dst' not in artifact:
                continue

            if not eval(artifact.get('condition', 'False')):
                continue

            src = artifact.get('src')
            dst = artifact.get('dst')

            utils.copy(src, dst)
Exemplo n.º 4
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()
Exemplo n.º 5
0
    def _build_freya(self):
        '''
        Cross-compile Valgrind and its Freya tool.
        '''
        build_dir = utils.join(self.env['paths']['build'], 'valgrind_freya')
        valgrind_files = [
            'vg-in-place', 'coregrind/valgrind', '.in_place/freya-arm-linux',
            '.in_place/vgpreload_core-arm-linux.so',
            '.in_place/vgpreload_freya-arm-linux.so'
        ]

        # Check if a Freya build already exists, if yes, skip the build.
        if utils.exist_files(build_dir, valgrind_files):
            return

        freya = self.env['modules']['freya']

        utils.define_environment('LD', 'arm-linux-gnueabihf-ld')
        utils.define_environment('AR', 'arm-linux-gnueabihf-ar')
        utils.define_environment('CC', 'arm-linux-gnueabihf-gcc')
        utils.define_environment('CPP', 'arm-linux-gnueabihf-cpp')
        utils.define_environment('CXX', 'arm-linux-gnueabihf-g++')

        configure_options = ['--host=armv7-linux-gnueabihf']

        utils.execute(freya['src'], './autogen.sh')
        utils.execute(freya['src'], './configure', configure_options)
        utils.execute(freya['src'], 'make', ['clean'])
        utils.execute(freya['src'], 'make', ['TOOLS=freya'])

        utils.unset_environment('LD')
        utils.unset_environment('AR')
        utils.unset_environment('CC')
        utils.unset_environment('CPP')
        utils.unset_environment('CXX')

        # Copy necessary files into the output directory.
        for valgrind_file in valgrind_files:
            src = utils.join(freya['src'], valgrind_file)
            dst = utils.join(build_dir, valgrind_file)

            utils.copy(src, dst)
Exemplo n.º 6
0
    def _copy_build_files(self, target_module, builddir):
        '''
        Copy the created binaries, libs, linker map to the build folder.
        '''
        application = self.env['modules']['app']

        linker_map = utils.join(builddir, 'linker.map')
        lib_folder = utils.join(builddir, 'libs')

        utils.copy(application['paths']['libdir'], lib_folder)
        utils.copy(target_module['paths']['linker-map'], linker_map)
        utils.copy(target_module['paths']['image'], builddir)
Exemplo n.º 7
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])