def test_autorev_sstate_works(self):
        # Test that a git repository which changes is correctly handled by SRCREV = ${AUTOREV}
        # when PV does not contain SRCPV

        tempdir = tempfile.mkdtemp(prefix='oeqa')
        self.track_for_cleanup(tempdir)
        create_temp_layer(tempdir, 'selftestrecipetool')
        self.add_command_to_tearDown('bitbake-layers remove-layer %s' % tempdir)
        runCmd('bitbake-layers add-layer %s' % tempdir)

        # Use dbus-wait as a local git repo we can add a commit between two builds in
        pn = 'dbus-wait'
        srcrev = '6cc6077a36fe2648a5f993fe7c16c9632f946517'
        url = 'git://git.yoctoproject.org/dbus-wait'
        result = runCmd('git clone %s noname' % url, cwd=tempdir)
        srcdir = os.path.join(tempdir, 'noname')
        result = runCmd('git reset --hard %s' % srcrev, cwd=srcdir)
        self.assertTrue(os.path.isfile(os.path.join(srcdir, 'configure.ac')), 'Unable to find configure script in source directory')

        recipefile = os.path.join(tempdir, "recipes-test", "dbus-wait-test", 'dbus-wait-test_git.bb')
        os.makedirs(os.path.dirname(recipefile))
        srcuri = 'git://' + srcdir + ';protocol=file'
        result = runCmd(['recipetool', 'create', '-o', recipefile, srcuri])
        self.assertTrue(os.path.isfile(recipefile), 'recipetool did not create recipe file; output:\n%s' % result.output)

        with open(recipefile, 'a') as f:
            f.write('SRCREV = "${AUTOREV}"\n')
            f.write('PV = "1.0"\n')

        bitbake("dbus-wait-test -c fetch")
        with open(os.path.join(srcdir, "bar.txt"), "w") as f:
            f.write("foo")
        result = runCmd('git add bar.txt; git commit -asm "add bar"', cwd=srcdir)
        bitbake("dbus-wait-test -c unpack")
Exemple #2
0
    def test_autorev_sstate_works(self):
        # Test that a git repository which changes is correctly handled by SRCREV = ${AUTOREV}
        # when PV does not contain SRCPV

        tempdir = tempfile.mkdtemp(prefix='oeqa')
        self.track_for_cleanup(tempdir)
        create_temp_layer(tempdir, 'selftestrecipetool')
        self.add_command_to_tearDown('bitbake-layers remove-layer %s' % tempdir)
        runCmd('bitbake-layers add-layer %s' % tempdir)

        # Use dbus-wait as a local git repo we can add a commit between two builds in
        pn = 'dbus-wait'
        srcrev = '6cc6077a36fe2648a5f993fe7c16c9632f946517'
        url = 'git://git.yoctoproject.org/dbus-wait'
        result = runCmd('git clone %s noname' % url, cwd=tempdir)
        srcdir = os.path.join(tempdir, 'noname')
        result = runCmd('git reset --hard %s' % srcrev, cwd=srcdir)
        self.assertTrue(os.path.isfile(os.path.join(srcdir, 'configure.ac')), 'Unable to find configure script in source directory')

        recipefile = os.path.join(tempdir, "recipes-test", "dbus-wait-test", 'dbus-wait-test_git.bb')
        os.makedirs(os.path.dirname(recipefile))
        srcuri = 'git://' + srcdir + ';protocol=file'
        result = runCmd(['recipetool', 'create', '-o', recipefile, srcuri])
        self.assertTrue(os.path.isfile(recipefile), 'recipetool did not create recipe file; output:\n%s' % result.output)

        with open(recipefile, 'a') as f:
            f.write('SRCREV = "${AUTOREV}"\n')
            f.write('PV = "1.0"\n')

        bitbake("dbus-wait-test -c fetch")
        with open(os.path.join(srcdir, "bar.txt"), "w") as f:
            f.write("foo")
        result = runCmd('git add bar.txt; git commit -asm "add bar"', cwd=srcdir)
        bitbake("dbus-wait-test -c unpack")
Exemple #3
0
    def test_locked_signatures(self):
        """
        Summary:     Test locked signature mechanism
        Expected:    Locked signatures will prevent task to run
        Product:     oe-core
        Author:      Daniel Istrate <*****@*****.**>
        AutomatedBy: Daniel Istrate <*****@*****.**>
        """

        import uuid

        test_recipe = 'ed'
        locked_sigs_file = 'locked-sigs.inc'

        bitbake(test_recipe)
        # Generate locked sigs include file
        bitbake('-S none %s' % test_recipe)

        feature = 'require %s\n' % locked_sigs_file
        feature += 'SIGGEN_LOCKEDSIGS_TASKSIG_CHECK = "warn"\n'
        self.write_config(feature)

        # Build a locked recipe
        bitbake(test_recipe)

        templayerdir = tempfile.mkdtemp(prefix='signingqa')
        create_temp_layer(templayerdir, 'selftestsigning')
        runCmd('bitbake-layers add-layer %s' % templayerdir)

        # Make a change that should cause the locked task signature to change
        # Use uuid so hash equivalance server isn't triggered
        recipe_append_file = test_recipe + '_' + get_bb_var(
            'PV', test_recipe) + '.bbappend'
        recipe_append_path = os.path.join(templayerdir, 'recipes-test',
                                          test_recipe, recipe_append_file)
        feature = 'SUMMARY_${PN} = "test locked signature%s"\n' % uuid.uuid4()

        os.mkdir(os.path.join(templayerdir, 'recipes-test'))
        os.mkdir(os.path.join(templayerdir, 'recipes-test', test_recipe))
        write_file(recipe_append_path, feature)

        self.add_command_to_tearDown('bitbake-layers remove-layer %s' %
                                     templayerdir)
        self.add_command_to_tearDown(
            'rm -f %s' % os.path.join(self.builddir, locked_sigs_file))
        self.add_command_to_tearDown('rm -rf %s' % templayerdir)

        # Build the recipe again
        ret = bitbake(test_recipe)

        # Verify you get the warning and that the real task *isn't* run (i.e. the locked signature has worked)
        patt = r'The %s:do_package sig is computed to be \S+, but the sig is locked to \S+ in SIGGEN_LOCKEDSIGS\S+' % test_recipe
        found_warn = re.search(patt, ret.output)

        self.assertIsNotNone(
            found_warn,
            "Didn't find the expected warning message. Output: %s" %
            ret.output)
Exemple #4
0
def setUpModule():
    global templayerdir
    templayerdir = tempfile.mkdtemp(prefix='recipetoolqa')
    create_temp_layer(templayerdir, 'selftestrecipetool')
    result = runCmd('bitbake-layers add-layer %s' % templayerdir)
    # Ensure we have the right data in shlibs/pkgdata
    logger = logging.getLogger("selftest")
    logger.info('Running bitbake to generate pkgdata')
    bitbake('base-files coreutils busybox selftest-recipetool-appendfile')
def setUpModule():
    global templayerdir
    templayerdir = tempfile.mkdtemp(prefix='recipetoolqa')
    create_temp_layer(templayerdir, 'selftestrecipetool')
    result = runCmd('bitbake-layers add-layer %s' % templayerdir)
    # Ensure we have the right data in shlibs/pkgdata
    logger = logging.getLogger("selftest")
    logger.info('Running bitbake to generate pkgdata')
    bitbake('base-files coreutils busybox selftest-recipetool-appendfile')
Exemple #6
0
 def _create_temp_layer(self, templayerdir, addlayer, templayername, priority=999, recipepathspec='recipes-*/*'):
     create_temp_layer(templayerdir, templayername, priority, recipepathspec)
     if addlayer:
         self.add_command_to_tearDown('bitbake-layers remove-layer %s || true' % templayerdir)
         result = runCmd('bitbake-layers add-layer %s' % templayerdir, cwd=self.builddir)
def setUpModule():
    global templayerdir
    templayerdir = tempfile.mkdtemp(prefix='recipetool-mel-qa')
    create_temp_layer(templayerdir, 'selftest-recipetool-mel')
    runCmd('bitbake-layers add-layer %s' % templayerdir)
def setUpModule():
    global templayerdir
    templayerdir = tempfile.mkdtemp(prefix="recipetoolqa")
    create_temp_layer(templayerdir, "selftestrecipetool")
    runCmd("bitbake-layers add-layer %s" % templayerdir)
Exemple #9
0
 def _create_temp_layer(self, templayerdir, addlayer, templayername, priority=999, recipepathspec='recipes-*/*'):
     create_temp_layer(templayerdir, templayername, priority, recipepathspec)
     if addlayer:
         self.add_command_to_tearDown('bitbake-layers remove-layer %s || true' % templayerdir)
         result = runCmd('bitbake-layers add-layer %s' % templayerdir, cwd=self.builddir)