diff options
Diffstat (limited to 'meta/lib')
-rw-r--r-- | meta/lib/oeqa/selftest/cases/sstatetests.py | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/meta/lib/oeqa/selftest/cases/sstatetests.py b/meta/lib/oeqa/selftest/cases/sstatetests.py index 47900886a3..6735694263 100644 --- a/meta/lib/oeqa/selftest/cases/sstatetests.py +++ b/meta/lib/oeqa/selftest/cases/sstatetests.py | |||
@@ -2,15 +2,51 @@ import os | |||
2 | import shutil | 2 | import shutil |
3 | import glob | 3 | import glob |
4 | import subprocess | 4 | import subprocess |
5 | import tempfile | ||
5 | 6 | ||
6 | from oeqa.selftest.case import OESelftestTestCase | 7 | from oeqa.selftest.case import OESelftestTestCase |
7 | from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_test_layer | 8 | from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_test_layer, create_temp_layer |
8 | from oeqa.selftest.cases.sstate import SStateBase | 9 | from oeqa.selftest.cases.sstate import SStateBase |
9 | from oeqa.core.decorator.oeid import OETestID | 10 | from oeqa.core.decorator.oeid import OETestID |
10 | 11 | ||
11 | import bb.siggen | 12 | import bb.siggen |
12 | 13 | ||
13 | class SStateTests(SStateBase): | 14 | class SStateTests(SStateBase): |
15 | def test_autorev_sstate_works(self): | ||
16 | # Test that a git repository which changes is correctly handled by SRCREV = ${AUTOREV} | ||
17 | # when PV does not contain SRCPV | ||
18 | |||
19 | tempdir = tempfile.mkdtemp(prefix='oeqa') | ||
20 | self.track_for_cleanup(tempdir) | ||
21 | create_temp_layer(tempdir, 'selftestrecipetool') | ||
22 | self.add_command_to_tearDown('bitbake-layers remove-layer %s' % tempdir) | ||
23 | runCmd('bitbake-layers add-layer %s' % tempdir) | ||
24 | |||
25 | # Use dbus-wait as a local git repo we can add a commit between two builds in | ||
26 | pn = 'dbus-wait' | ||
27 | srcrev = '6cc6077a36fe2648a5f993fe7c16c9632f946517' | ||
28 | url = 'git://git.yoctoproject.org/dbus-wait' | ||
29 | result = runCmd('git clone %s noname' % url, cwd=tempdir) | ||
30 | srcdir = os.path.join(tempdir, 'noname') | ||
31 | result = runCmd('git reset --hard %s' % srcrev, cwd=srcdir) | ||
32 | self.assertTrue(os.path.isfile(os.path.join(srcdir, 'configure.ac')), 'Unable to find configure script in source directory') | ||
33 | |||
34 | recipefile = os.path.join(tempdir, "recipes-test", "dbus-wait-test", 'dbus-wait-test_git.bb') | ||
35 | os.makedirs(os.path.dirname(recipefile)) | ||
36 | srcuri = 'git://' + srcdir + ';protocol=file' | ||
37 | result = runCmd(['recipetool', 'create', '-o', recipefile, srcuri]) | ||
38 | self.assertTrue(os.path.isfile(recipefile), 'recipetool did not create recipe file; output:\n%s' % result.output) | ||
39 | |||
40 | with open(recipefile, 'a') as f: | ||
41 | f.write('SRCREV = "${AUTOREV}"\n') | ||
42 | f.write('PV = "1.0"\n') | ||
43 | |||
44 | bitbake("dbus-wait-test -c fetch") | ||
45 | with open(os.path.join(srcdir, "bar.txt"), "w") as f: | ||
46 | f.write("foo") | ||
47 | result = runCmd('git add bar.txt; git commit -asm "add bar"', cwd=srcdir) | ||
48 | bitbake("dbus-wait-test -c unpack") | ||
49 | |||
14 | 50 | ||
15 | # Test sstate files creation and their location | 51 | # Test sstate files creation and their location |
16 | def run_test_sstate_creation(self, targets, distro_specific=True, distro_nonspecific=True, temp_sstate_location=True, should_pass=True): | 52 | def run_test_sstate_creation(self, targets, distro_specific=True, distro_nonspecific=True, temp_sstate_location=True, should_pass=True): |