summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa
diff options
context:
space:
mode:
authorCorneliu Stoicescu <corneliux.stoicescu@intel.com>2013-12-17 12:29:02 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-12-20 12:26:29 +0000
commit6fe6a91db50da283041df0327fcb5621809710d8 (patch)
treea1d267fcbe43bedca1ede22c9bcaf9865bf36f91 /meta/lib/oeqa
parent8379990a4c4ba9396984e8741df68a8403ad0b27 (diff)
downloadpoky-6fe6a91db50da283041df0327fcb5621809710d8.tar.gz
oe-selftest: New test module for OE scripts.
Added a new module meta/lib/oeqa/selftest/oescripts.py containing tests for scripts from ${COREBASE}/scripts (From OE-Core rev: 685879739017317f234824689cbd89388d236816) Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa')
-rw-r--r--meta/lib/oeqa/selftest/oescripts.py60
1 files changed, 60 insertions, 0 deletions
diff --git a/meta/lib/oeqa/selftest/oescripts.py b/meta/lib/oeqa/selftest/oescripts.py
new file mode 100644
index 0000000000..4aab2ed095
--- /dev/null
+++ b/meta/lib/oeqa/selftest/oescripts.py
@@ -0,0 +1,60 @@
1import datetime
2import unittest
3import os
4import re
5import shutil
6
7import oeqa.utils.ftools as ftools
8from oeqa.selftest.base import oeSelfTest
9from oeqa.selftest.buildhistory import BuildhistoryBase
10from oeqa.utils.commands import Command, runCmd, bitbake, get_bb_var, get_test_layer
11
12class TestScripts(oeSelfTest):
13
14 def test_cleanup_workdir(self):
15 path = os.path.dirname(get_bb_var('WORKDIR', 'gzip'))
16 old_version_recipe = os.path.join(get_bb_var('COREBASE'), 'meta/recipes-extended/gzip/gzip_1.3.12.bb')
17 old_version = '1.3.12'
18 bitbake("-ccleansstate gzip")
19 bitbake("-ccleansstate -b %s" % old_version_recipe)
20 if os.path.exists(get_bb_var('WORKDIR', "-b %s" % old_version_recipe)):
21 shutil.rmtree(get_bb_var('WORKDIR', "-b %s" % old_version_recipe))
22 if os.path.exists(get_bb_var('WORKDIR', 'gzip')):
23 shutil.rmtree(get_bb_var('WORKDIR', 'gzip'))
24
25 if os.path.exists(path):
26 initial_contents = os.listdir(path)
27 else:
28 initial_contents = []
29
30 bitbake('gzip')
31 intermediary_contents = os.listdir(path)
32 bitbake("-b %s" % old_version_recipe)
33 runCmd('cleanup-workdir')
34 remaining_contents = os.listdir(path)
35
36 expected_contents = [x for x in intermediary_contents if x not in initial_contents]
37 remaining_not_expected = [x for x in remaining_contents if x not in expected_contents]
38 self.assertFalse(remaining_not_expected, msg="Not all necessary content has been deleted from %s: %s" % (path, ', '.join(map(str, remaining_not_expected))))
39 expected_not_remaining = [x for x in expected_contents if x not in remaining_contents]
40 self.assertFalse(expected_not_remaining, msg="The script removed extra contents from %s: %s" % (path, ', '.join(map(str, expected_not_remaining))))
41
42class BuildhistoryDiffTests(BuildhistoryBase):
43
44 def test_buildhistory_diff(self):
45 self.add_command_to_tearDown('cleanup-workdir')
46 target = 'xcursor-transparent-theme'
47 self.run_buildhistory_operation(target, target_config="PR = \"r1\"", change_bh_location=True)
48 self.run_buildhistory_operation(target, target_config="PR = \"r0\"", change_bh_location=False, expect_error=True)
49 result = runCmd("buildhistory-diff -p %s" % get_bb_var('BUILDHISTORY_DIR'))
50 expected_output = 'PR changed from "r1" to "r0"'
51 self.assertTrue(expected_output in result.output, msg="Did not find expected output: %s" % result.output)
52
53
54
55
56
57
58
59
60