summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2016-02-24 16:51:30 +1300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-02-28 11:33:01 +0000
commit4bae2f25b8a55c80c3ca48b63d093c5a7594c636 (patch)
tree09f636bce4006e013f7868fc5a850337c91d3bb7
parent10290f2245cd95e95078e809a1b388d3573d73b8 (diff)
downloadpoky-4bae2f25b8a55c80c3ca48b63d093c5a7594c636.tar.gz
oe-selftest: devtool: rework devtool upgrade test
* Use a more real-world test of a recipe pointing to a remote file * The cleanup tracking / teardown commands need to be added towards the top, or they won't have the desired effect of cleaning up if the test fails. * Check that a versioned subdirectory gets renamed to match the new version * Ensure the recipe contents gets changed as we expect it to * Check that the recipe directory is deleted by devtool reset at the end (From OE-Core rev: d0ae258e963f9bafffc4ca43c87497d27e57c127) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta-selftest/recipes-test/devtool/devtool-upgrade-test1-1.5.3/0001-Add-a-note-line-to-the-quick-reference.patch25
-rw-r--r--meta-selftest/recipes-test/devtool/devtool-upgrade-test1_1.5.3.bb16
-rw-r--r--meta-selftest/recipes-test/devtool/devtool-upgrade-test1_1.5.3.bb.upgraded14
-rw-r--r--meta-selftest/recipes-test/devtool/devtool-upgrade_0.1.bb25
-rw-r--r--meta-selftest/recipes-test/devtool/files/0001-helloword.c-exit-with-EXIT_SUCCESS-instead-of-a-magi.patch27
-rw-r--r--meta-selftest/recipes-test/devtool/files/devtool-upgrade-0.1.tar.gzbin411 -> 0 bytes
-rw-r--r--meta-selftest/recipes-test/devtool/files/devtool-upgrade-0.2.tar.gzbin411 -> 0 bytes
-rw-r--r--meta/lib/oeqa/selftest/devtool.py27
8 files changed, 73 insertions, 61 deletions
diff --git a/meta-selftest/recipes-test/devtool/devtool-upgrade-test1-1.5.3/0001-Add-a-note-line-to-the-quick-reference.patch b/meta-selftest/recipes-test/devtool/devtool-upgrade-test1-1.5.3/0001-Add-a-note-line-to-the-quick-reference.patch
new file mode 100644
index 0000000000..4ea3d74f0f
--- /dev/null
+++ b/meta-selftest/recipes-test/devtool/devtool-upgrade-test1-1.5.3/0001-Add-a-note-line-to-the-quick-reference.patch
@@ -0,0 +1,25 @@
1From 1478846ebfac690684e9c48049d08e0065f97a36 Mon Sep 17 00:00:00 2001
2From: Paul Eggleton <paul.eggleton@linux.intel.com>
3Date: Wed, 24 Feb 2016 17:43:03 +1300
4Subject: [PATCH] Add a note line to the quick reference
5
6A test patch so we have a file to move around.
7---
8 doc/quickref.1.in | 1 +
9 1 file changed, 1 insertion(+)
10
11diff --git a/doc/quickref.1.in b/doc/quickref.1.in
12index 389008b..226615c 100644
13--- a/doc/quickref.1.in
14+++ b/doc/quickref.1.in
15@@ -560,6 +560,7 @@ you want, at runtime, to change the parameters of.
16 .P
17 If you find any other problems, please report them.
18
19+NOTE: this is an important note.
20
21 .SH REPORTING BUGS
22 Report bugs in
23--
242.5.0
25
diff --git a/meta-selftest/recipes-test/devtool/devtool-upgrade-test1_1.5.3.bb b/meta-selftest/recipes-test/devtool/devtool-upgrade-test1_1.5.3.bb
new file mode 100644
index 0000000000..e93b0d5514
--- /dev/null
+++ b/meta-selftest/recipes-test/devtool/devtool-upgrade-test1_1.5.3.bb
@@ -0,0 +1,16 @@
1SUMMARY = "Pipe viewer test recipe for devtool upgrade test"
2LICENSE = "Artistic-2.0"
3LIC_FILES_CHKSUM = "file://doc/COPYING;md5=9c50db2589ee3ef10a9b7b2e50ce1d02"
4
5SRC_URI = "http://www.ivarch.com/programs/sources/pv-${PV}.tar.gz \
6 file://0001-Add-a-note-line-to-the-quick-reference.patch"
7
8SRC_URI[md5sum] = "9365d86bd884222b4bf1039b5a9ed1bd"
9SRC_URI[sha256sum] = "681bcca9784bf3cb2207e68236d1f68e2aa7b80f999b5750dc77dcd756e81fbc"
10
11PR = "r5"
12
13S = "${WORKDIR}/pv-${PV}"
14
15inherit autotools
16
diff --git a/meta-selftest/recipes-test/devtool/devtool-upgrade-test1_1.5.3.bb.upgraded b/meta-selftest/recipes-test/devtool/devtool-upgrade-test1_1.5.3.bb.upgraded
new file mode 100644
index 0000000000..afcc4aa13c
--- /dev/null
+++ b/meta-selftest/recipes-test/devtool/devtool-upgrade-test1_1.5.3.bb.upgraded
@@ -0,0 +1,14 @@
1SUMMARY = "Pipe viewer test recipe for devtool upgrade test"
2LICENSE = "Artistic-2.0"
3LIC_FILES_CHKSUM = "file://doc/COPYING;md5=9c50db2589ee3ef10a9b7b2e50ce1d02"
4
5SRC_URI = "http://www.ivarch.com/programs/sources/pv-${PV}.tar.gz \
6 file://0001-Add-a-note-line-to-the-quick-reference.patch"
7
8SRC_URI[md5sum] = "062bca5ff33df1dd09472e7fc3bbe332"
9SRC_URI[sha256sum] = "9dd45391806b0ed215abee4c5ac1597d018c386fe9c1f5afd2f6bc3b07fd82c3"
10
11S = "${WORKDIR}/pv-${PV}"
12
13inherit autotools
14
diff --git a/meta-selftest/recipes-test/devtool/devtool-upgrade_0.1.bb b/meta-selftest/recipes-test/devtool/devtool-upgrade_0.1.bb
deleted file mode 100644
index 33ffc8803a..0000000000
--- a/meta-selftest/recipes-test/devtool/devtool-upgrade_0.1.bb
+++ /dev/null
@@ -1,25 +0,0 @@
1#
2# This file was derived from the 'Hello World!' example recipe in the
3# Yocto Project Development Manual.
4#
5
6DESCRIPTION = "Simple helloworld application used to test the devtool upgrade feature"
7SECTION = "devtool"
8LICENSE = "MIT"
9LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
10PR = "r0"
11
12SRC_URI = "file://${THISDIR}/files/${P}.tar.gz \
13 file://0001-helloword.c-exit-with-EXIT_SUCCESS-instead-of-a-magi.patch \
14 "
15
16S = "${WORKDIR}/${P}"
17
18do_compile() {
19 ${CC} helloworld.c -o helloworld
20}
21
22do_install() {
23 install -d ${D}${bindir}
24 install -m 0755 helloworld ${D}${bindir}
25}
diff --git a/meta-selftest/recipes-test/devtool/files/0001-helloword.c-exit-with-EXIT_SUCCESS-instead-of-a-magi.patch b/meta-selftest/recipes-test/devtool/files/0001-helloword.c-exit-with-EXIT_SUCCESS-instead-of-a-magi.patch
deleted file mode 100644
index 2294a094b2..0000000000
--- a/meta-selftest/recipes-test/devtool/files/0001-helloword.c-exit-with-EXIT_SUCCESS-instead-of-a-magi.patch
+++ /dev/null
@@ -1,27 +0,0 @@
1From 0f37affbc6e6c71687301d99d7259f1968e57c48 Mon Sep 17 00:00:00 2001
2From: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>
3Date: Wed, 26 Aug 2015 12:42:23 +0000
4Subject: [PATCH] helloword.c: exit with EXIT_SUCCESS instead of a magic number
5
6---
7 helloworld.c | 3 ++-
8 1 file changed, 2 insertions(+), 1 deletion(-)
9
10diff --git a/helloworld.c b/helloworld.c
11index 71f2e46..54bf50b 100644
12--- a/helloworld.c
13+++ b/helloworld.c
14@@ -1,8 +1,9 @@
15 #include <stdio.h>
16+#include <stdlib.h>
17
18 int main(int argc, char **argv)
19 {
20 printf("Hello World!\n");
21
22- return 0;
23+ return EXIT_SUCCESS;
24 }
25--
261.8.4.5
27
diff --git a/meta-selftest/recipes-test/devtool/files/devtool-upgrade-0.1.tar.gz b/meta-selftest/recipes-test/devtool/files/devtool-upgrade-0.1.tar.gz
deleted file mode 100644
index 06a1c49cd9..0000000000
--- a/meta-selftest/recipes-test/devtool/files/devtool-upgrade-0.1.tar.gz
+++ /dev/null
Binary files differ
diff --git a/meta-selftest/recipes-test/devtool/files/devtool-upgrade-0.2.tar.gz b/meta-selftest/recipes-test/devtool/files/devtool-upgrade-0.2.tar.gz
deleted file mode 100644
index 9b0dcf4b6c..0000000000
--- a/meta-selftest/recipes-test/devtool/files/devtool-upgrade-0.2.tar.gz
+++ /dev/null
Binary files differ
diff --git a/meta/lib/oeqa/selftest/devtool.py b/meta/lib/oeqa/selftest/devtool.py
index 036146425b..4d280bb4af 100644
--- a/meta/lib/oeqa/selftest/devtool.py
+++ b/meta/lib/oeqa/selftest/devtool.py
@@ -1095,14 +1095,18 @@ class DevtoolTests(DevtoolBase):
1095 def test_devtool_upgrade(self): 1095 def test_devtool_upgrade(self):
1096 # Check preconditions 1096 # Check preconditions
1097 self.assertTrue(not os.path.exists(self.workspacedir), 'This test cannot be run with a workspace directory under the build directory') 1097 self.assertTrue(not os.path.exists(self.workspacedir), 'This test cannot be run with a workspace directory under the build directory')
1098 self.track_for_cleanup(self.workspacedir)
1099 self.add_command_to_tearDown('bitbake-layers remove-layer */workspace')
1098 # Check parameters 1100 # Check parameters
1099 result = runCmd('devtool upgrade -h') 1101 result = runCmd('devtool upgrade -h')
1100 for param in 'recipename srctree --version -V --branch -b --keep-temp --no-patch'.split(): 1102 for param in 'recipename srctree --version -V --branch -b --keep-temp --no-patch'.split():
1101 self.assertIn(param, result.output) 1103 self.assertIn(param, result.output)
1102 # For the moment, we are using a real recipe. 1104 # For the moment, we are using a real recipe.
1103 recipe='devtool-upgrade' 1105 recipe = 'devtool-upgrade-test1'
1104 version='0.2' 1106 version = '1.6.0'
1107 oldrecipefile = get_bb_var('FILE', recipe)
1105 tempdir = tempfile.mkdtemp(prefix='devtoolqa') 1108 tempdir = tempfile.mkdtemp(prefix='devtoolqa')
1109 self.track_for_cleanup(tempdir)
1106 # Check that recipe is not already under devtool control 1110 # Check that recipe is not already under devtool control
1107 result = runCmd('devtool status') 1111 result = runCmd('devtool status')
1108 self.assertNotIn(recipe, result.output) 1112 self.assertNotIn(recipe, result.output)
@@ -1110,22 +1114,27 @@ class DevtoolTests(DevtoolBase):
1110 # we are downgrading instead of upgrading. 1114 # we are downgrading instead of upgrading.
1111 result = runCmd('devtool upgrade %s %s -V %s' % (recipe, tempdir, version)) 1115 result = runCmd('devtool upgrade %s %s -V %s' % (recipe, tempdir, version))
1112 # Check if srctree at least is populated 1116 # Check if srctree at least is populated
1113 self.assertTrue(len(os.listdir(tempdir)) > 0, 'scrtree (%s) should be populated with new (%s) source code' % (tempdir, version)) 1117 self.assertTrue(len(os.listdir(tempdir)) > 0, 'srctree (%s) should be populated with new (%s) source code' % (tempdir, version))
1114 # Check new recipe folder is present 1118 # Check new recipe subdirectory is present
1115 self.assertTrue(os.path.exists(os.path.join(self.workspacedir,'recipes',recipe)), 'Recipe folder should exist') 1119 self.assertTrue(os.path.exists(os.path.join(self.workspacedir, 'recipes', recipe, '%s-%s' % (recipe, version))), 'Recipe folder should exist')
1116 # Check new recipe file is present 1120 # Check new recipe file is present
1117 self.assertTrue(os.path.exists(os.path.join(self.workspacedir,'recipes',recipe,"%s_%s.bb" % (recipe,version))), 'Recipe folder should exist') 1121 newrecipefile = os.path.join(self.workspacedir, 'recipes', recipe, '%s_%s.bb' % (recipe, version))
1122 self.assertTrue(os.path.exists(newrecipefile), 'Recipe file should exist after upgrade')
1118 # Check devtool status and make sure recipe is present 1123 # Check devtool status and make sure recipe is present
1119 result = runCmd('devtool status') 1124 result = runCmd('devtool status')
1120 self.assertIn(recipe, result.output) 1125 self.assertIn(recipe, result.output)
1121 self.assertIn(tempdir, result.output) 1126 self.assertIn(tempdir, result.output)
1127 # Check recipe got changed as expected
1128 with open(oldrecipefile + '.upgraded', 'r') as f:
1129 desiredlines = f.readlines()
1130 with open(newrecipefile, 'r') as f:
1131 newlines = f.readlines()
1132 self.assertEqual(desiredlines, newlines)
1122 # Check devtool reset recipe 1133 # Check devtool reset recipe
1123 result = runCmd('devtool reset %s -n' % recipe) 1134 result = runCmd('devtool reset %s -n' % recipe)
1124 result = runCmd('devtool status') 1135 result = runCmd('devtool status')
1125 self.assertNotIn(recipe, result.output) 1136 self.assertNotIn(recipe, result.output)
1126 self.track_for_cleanup(tempdir) 1137 self.assertFalse(os.path.exists(os.path.join(self.workspacedir, 'recipes', recipe)), 'Recipe directory should not exist after resetting')
1127 self.track_for_cleanup(self.workspacedir)
1128 self.add_command_to_tearDown('bitbake-layers remove-layer */workspace')
1129 1138
1130 @testcase(1352) 1139 @testcase(1352)
1131 def test_devtool_layer_plugins(self): 1140 def test_devtool_layer_plugins(self):