summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorCostin Constantin <costin.c.constantin@intel.com>2015-07-16 13:06:03 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-07-23 08:48:37 +0100
commit9d02d3fd0222c02982b34ce7b9c6e63fdbbdf808 (patch)
treead0e1fc8864b68da362416625c275189179feee0 /meta
parent7d01c595c96eb3d67b90caf71050c4e9345257de (diff)
downloadpoky-9d02d3fd0222c02982b34ce7b9c6e63fdbbdf808.tar.gz
oeqa/pkgdata: add useful failure messages to test cases
(From OE-Core rev: 0884dc483e5111021d700e9a509c478de2e431b3) Signed-off-by: Costin Constantin <costin.c.constantin@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/lib/oeqa/selftest/pkgdata.py86
1 files changed, 43 insertions, 43 deletions
diff --git a/meta/lib/oeqa/selftest/pkgdata.py b/meta/lib/oeqa/selftest/pkgdata.py
index c4d34bd590..138b03aadb 100644
--- a/meta/lib/oeqa/selftest/pkgdata.py
+++ b/meta/lib/oeqa/selftest/pkgdata.py
@@ -26,7 +26,7 @@ class OePkgdataUtilTests(oeSelfTest):
26 result = runCmd('oe-pkgdata-util lookup-pkg zlib-dev') 26 result = runCmd('oe-pkgdata-util lookup-pkg zlib-dev')
27 self.assertEqual(result.output, 'libz-dev') 27 self.assertEqual(result.output, 'libz-dev')
28 result = runCmd('oe-pkgdata-util lookup-pkg nonexistentpkg', ignore_status=True) 28 result = runCmd('oe-pkgdata-util lookup-pkg nonexistentpkg', ignore_status=True)
29 self.assertEqual(result.status, 1) 29 self.assertEqual(result.status, 1, "Status different than 1. output: %s" % result.output)
30 self.assertEqual(result.output, 'ERROR: The following packages could not be found: nonexistentpkg') 30 self.assertEqual(result.output, 'ERROR: The following packages could not be found: nonexistentpkg')
31 # Reverse tests 31 # Reverse tests
32 result = runCmd('oe-pkgdata-util lookup-pkg -r "libc6 busybox"') 32 result = runCmd('oe-pkgdata-util lookup-pkg -r "libc6 busybox"')
@@ -34,7 +34,7 @@ class OePkgdataUtilTests(oeSelfTest):
34 result = runCmd('oe-pkgdata-util lookup-pkg -r libz-dev') 34 result = runCmd('oe-pkgdata-util lookup-pkg -r libz-dev')
35 self.assertEqual(result.output, 'zlib-dev') 35 self.assertEqual(result.output, 'zlib-dev')
36 result = runCmd('oe-pkgdata-util lookup-pkg -r nonexistentpkg', ignore_status=True) 36 result = runCmd('oe-pkgdata-util lookup-pkg -r nonexistentpkg', ignore_status=True)
37 self.assertEqual(result.status, 1) 37 self.assertEqual(result.status, 1, "Status different than 1. output: %s" % result.output)
38 self.assertEqual(result.output, 'ERROR: The following packages could not be found: nonexistentpkg') 38 self.assertEqual(result.output, 'ERROR: The following packages could not be found: nonexistentpkg')
39 39
40 @testcase(1205) 40 @testcase(1205)
@@ -43,7 +43,7 @@ class OePkgdataUtilTests(oeSelfTest):
43 self.assertEqual(result.output, 'zlib') 43 self.assertEqual(result.output, 'zlib')
44 result = runCmd('oe-pkgdata-util read-value PKGSIZE bash') 44 result = runCmd('oe-pkgdata-util read-value PKGSIZE bash')
45 pkgsize = int(result.output.strip()) 45 pkgsize = int(result.output.strip())
46 self.assertGreater(pkgsize, 1) 46 self.assertGreater(pkgsize, 1, "Size should be greater than 1. %s" % result.output)
47 47
48 @testcase(1198) 48 @testcase(1198)
49 def test_find_path(self): 49 def test_find_path(self):
@@ -52,7 +52,7 @@ class OePkgdataUtilTests(oeSelfTest):
52 result = runCmd('oe-pkgdata-util find-path /bin/bash') 52 result = runCmd('oe-pkgdata-util find-path /bin/bash')
53 self.assertEqual(result.output, 'bash: /bin/bash') 53 self.assertEqual(result.output, 'bash: /bin/bash')
54 result = runCmd('oe-pkgdata-util find-path /not/exist', ignore_status=True) 54 result = runCmd('oe-pkgdata-util find-path /not/exist', ignore_status=True)
55 self.assertEqual(result.status, 1) 55 self.assertEqual(result.status, 1, "Status different than 1. output: %s" % result.output)
56 self.assertEqual(result.output, 'ERROR: Unable to find any package producing path /not/exist') 56 self.assertEqual(result.output, 'ERROR: Unable to find any package producing path /not/exist')
57 57
58 @testcase(1204) 58 @testcase(1204)
@@ -62,7 +62,7 @@ class OePkgdataUtilTests(oeSelfTest):
62 result = runCmd('oe-pkgdata-util lookup-recipe libz-dbg') 62 result = runCmd('oe-pkgdata-util lookup-recipe libz-dbg')
63 self.assertEqual(result.output, 'zlib') 63 self.assertEqual(result.output, 'zlib')
64 result = runCmd('oe-pkgdata-util lookup-recipe nonexistentpkg', ignore_status=True) 64 result = runCmd('oe-pkgdata-util lookup-recipe nonexistentpkg', ignore_status=True)
65 self.assertEqual(result.status, 1) 65 self.assertEqual(result.status, 1, "Status different than 1. output: %s" % result.output)
66 self.assertEqual(result.output, 'ERROR: The following packages could not be found: nonexistentpkg') 66 self.assertEqual(result.output, 'ERROR: The following packages could not be found: nonexistentpkg')
67 67
68 @testcase(1202) 68 @testcase(1202)
@@ -70,13 +70,13 @@ class OePkgdataUtilTests(oeSelfTest):
70 # No arguments 70 # No arguments
71 result = runCmd('oe-pkgdata-util list-pkgs') 71 result = runCmd('oe-pkgdata-util list-pkgs')
72 pkglist = result.output.split() 72 pkglist = result.output.split()
73 self.assertIn('glibc-utils', pkglist) 73 self.assertIn('glibc-utils', pkglist, "Listed packages: %s" % result.output)
74 self.assertIn('zlib-dev', pkglist) 74 self.assertIn('zlib-dev', pkglist, "Listed packages: %s" % result.output)
75 # No pkgspec, runtime 75 # No pkgspec, runtime
76 result = runCmd('oe-pkgdata-util list-pkgs -r') 76 result = runCmd('oe-pkgdata-util list-pkgs -r')
77 pkglist = result.output.split() 77 pkglist = result.output.split()
78 self.assertIn('libc6-utils', pkglist) 78 self.assertIn('libc6-utils', pkglist, "Listed packages: %s" % result.output)
79 self.assertIn('libz-dev', pkglist) 79 self.assertIn('libz-dev', pkglist, "Listed packages: %s" % result.output)
80 # With recipe specified 80 # With recipe specified
81 result = runCmd('oe-pkgdata-util list-pkgs -p zlib') 81 result = runCmd('oe-pkgdata-util list-pkgs -p zlib')
82 pkglist = sorted(result.output.split()) 82 pkglist = sorted(result.output.split())
@@ -84,7 +84,7 @@ class OePkgdataUtilTests(oeSelfTest):
84 pkglist.remove('zlib-ptest') # in case ptest is disabled 84 pkglist.remove('zlib-ptest') # in case ptest is disabled
85 except ValueError: 85 except ValueError:
86 pass 86 pass
87 self.assertEqual(pkglist, ['zlib', 'zlib-dbg', 'zlib-dev', 'zlib-doc', 'zlib-staticdev']) 87 self.assertEqual(pkglist, ['zlib', 'zlib-dbg', 'zlib-dev', 'zlib-doc', 'zlib-staticdev'], "Packages listed after remove: %s" % result.output)
88 # With recipe specified, runtime 88 # With recipe specified, runtime
89 result = runCmd('oe-pkgdata-util list-pkgs -p zlib -r') 89 result = runCmd('oe-pkgdata-util list-pkgs -p zlib -r')
90 pkglist = sorted(result.output.split()) 90 pkglist = sorted(result.output.split())
@@ -92,23 +92,23 @@ class OePkgdataUtilTests(oeSelfTest):
92 pkglist.remove('libz-ptest') # in case ptest is disabled 92 pkglist.remove('libz-ptest') # in case ptest is disabled
93 except ValueError: 93 except ValueError:
94 pass 94 pass
95 self.assertEqual(pkglist, ['libz-dbg', 'libz-dev', 'libz-doc', 'libz-staticdev', 'libz1']) 95 self.assertEqual(pkglist, ['libz-dbg', 'libz-dev', 'libz-doc', 'libz-staticdev', 'libz1'], "Packages listed after remove: %s" % result.output)
96 # With recipe specified and unpackaged 96 # With recipe specified and unpackaged
97 result = runCmd('oe-pkgdata-util list-pkgs -p zlib -u') 97 result = runCmd('oe-pkgdata-util list-pkgs -p zlib -u')
98 pkglist = sorted(result.output.split()) 98 pkglist = sorted(result.output.split())
99 self.assertIn('zlib-locale', pkglist) 99 self.assertIn('zlib-locale', pkglist, "Listed packages: %s" % result.output)
100 # With recipe specified and unpackaged, runtime 100 # With recipe specified and unpackaged, runtime
101 result = runCmd('oe-pkgdata-util list-pkgs -p zlib -u -r') 101 result = runCmd('oe-pkgdata-util list-pkgs -p zlib -u -r')
102 pkglist = sorted(result.output.split()) 102 pkglist = sorted(result.output.split())
103 self.assertIn('libz-locale', pkglist) 103 self.assertIn('libz-locale', pkglist, "Listed packages: %s" % result.output)
104 # With recipe specified and pkgspec 104 # With recipe specified and pkgspec
105 result = runCmd('oe-pkgdata-util list-pkgs -p zlib "*-d*"') 105 result = runCmd('oe-pkgdata-util list-pkgs -p zlib "*-d*"')
106 pkglist = sorted(result.output.split()) 106 pkglist = sorted(result.output.split())
107 self.assertEqual(pkglist, ['zlib-dbg', 'zlib-dev', 'zlib-doc']) 107 self.assertEqual(pkglist, ['zlib-dbg', 'zlib-dev', 'zlib-doc'], "Packages listed: %s" % result.output)
108 # With recipe specified and pkgspec, runtime 108 # With recipe specified and pkgspec, runtime
109 result = runCmd('oe-pkgdata-util list-pkgs -p zlib -r "*-d*"') 109 result = runCmd('oe-pkgdata-util list-pkgs -p zlib -r "*-d*"')
110 pkglist = sorted(result.output.split()) 110 pkglist = sorted(result.output.split())
111 self.assertEqual(pkglist, ['libz-dbg', 'libz-dev', 'libz-doc']) 111 self.assertEqual(pkglist, ['libz-dbg', 'libz-dev', 'libz-doc'], "Packages listed: %s" % result.output)
112 112
113 @testcase(1201) 113 @testcase(1201)
114 def test_list_pkg_files(self): 114 def test_list_pkg_files(self):
@@ -131,15 +131,15 @@ class OePkgdataUtilTests(oeSelfTest):
131 # Test recipe-space package name 131 # Test recipe-space package name
132 result = runCmd('oe-pkgdata-util list-pkg-files zlib-dev zlib-doc') 132 result = runCmd('oe-pkgdata-util list-pkg-files zlib-dev zlib-doc')
133 files = splitoutput(result.output) 133 files = splitoutput(result.output)
134 self.assertIn('zlib-dev', files.keys()) 134 self.assertIn('zlib-dev', files.keys(), "listed pkgs. files: %s" %result.output)
135 self.assertIn('zlib-doc', files.keys()) 135 self.assertIn('zlib-doc', files.keys(), "listed pkgs. files: %s" %result.output)
136 self.assertIn(os.path.join(includedir, 'zlib.h'), files['zlib-dev']) 136 self.assertIn(os.path.join(includedir, 'zlib.h'), files['zlib-dev'])
137 self.assertIn(os.path.join(mandir, 'man3/zlib.3'), files['zlib-doc']) 137 self.assertIn(os.path.join(mandir, 'man3/zlib.3'), files['zlib-doc'])
138 # Test runtime package name 138 # Test runtime package name
139 result = runCmd('oe-pkgdata-util list-pkg-files -r libz1 libz-dev') 139 result = runCmd('oe-pkgdata-util list-pkg-files -r libz1 libz-dev')
140 files = splitoutput(result.output) 140 files = splitoutput(result.output)
141 self.assertIn('libz1', files.keys()) 141 self.assertIn('libz1', files.keys(), "listed pkgs. files: %s" %result.output)
142 self.assertIn('libz-dev', files.keys()) 142 self.assertIn('libz-dev', files.keys(), "listed pkgs. files: %s" %result.output)
143 self.assertGreater(len(files['libz1']), 1) 143 self.assertGreater(len(files['libz1']), 1)
144 libspec = os.path.join(base_libdir, 'libz.so.1.*') 144 libspec = os.path.join(base_libdir, 'libz.so.1.*')
145 found = False 145 found = False
@@ -152,12 +152,12 @@ class OePkgdataUtilTests(oeSelfTest):
152 # Test recipe 152 # Test recipe
153 result = runCmd('oe-pkgdata-util list-pkg-files -p zlib') 153 result = runCmd('oe-pkgdata-util list-pkg-files -p zlib')
154 files = splitoutput(result.output) 154 files = splitoutput(result.output)
155 self.assertIn('zlib-dbg', files.keys()) 155 self.assertIn('zlib-dbg', files.keys(), "listed pkgs. files: %s" %result.output)
156 self.assertIn('zlib-doc', files.keys()) 156 self.assertIn('zlib-doc', files.keys(), "listed pkgs. files: %s" %result.output)
157 self.assertIn('zlib-dev', files.keys()) 157 self.assertIn('zlib-dev', files.keys(), "listed pkgs. files: %s" %result.output)
158 self.assertIn('zlib-staticdev', files.keys()) 158 self.assertIn('zlib-staticdev', files.keys(), "listed pkgs. files: %s" %result.output)
159 self.assertIn('zlib', files.keys()) 159 self.assertIn('zlib', files.keys(), "listed pkgs. files: %s" %result.output)
160 self.assertNotIn('zlib-locale', files.keys()) 160 self.assertNotIn('zlib-locale', files.keys(), "listed pkgs. files: %s" %result.output)
161 # (ignore ptest, might not be there depending on config) 161 # (ignore ptest, might not be there depending on config)
162 self.assertIn(os.path.join(includedir, 'zlib.h'), files['zlib-dev']) 162 self.assertIn(os.path.join(includedir, 'zlib.h'), files['zlib-dev'])
163 self.assertIn(os.path.join(mandir, 'man3/zlib.3'), files['zlib-doc']) 163 self.assertIn(os.path.join(mandir, 'man3/zlib.3'), files['zlib-doc'])
@@ -165,36 +165,36 @@ class OePkgdataUtilTests(oeSelfTest):
165 # Test recipe, runtime 165 # Test recipe, runtime
166 result = runCmd('oe-pkgdata-util list-pkg-files -p zlib -r') 166 result = runCmd('oe-pkgdata-util list-pkg-files -p zlib -r')
167 files = splitoutput(result.output) 167 files = splitoutput(result.output)
168 self.assertIn('libz-dbg', files.keys()) 168 self.assertIn('libz-dbg', files.keys(), "listed pkgs. files: %s" %result.output)
169 self.assertIn('libz-doc', files.keys()) 169 self.assertIn('libz-doc', files.keys(), "listed pkgs. files: %s" %result.output)
170 self.assertIn('libz-dev', files.keys()) 170 self.assertIn('libz-dev', files.keys(), "listed pkgs. files: %s" %result.output)
171 self.assertIn('libz-staticdev', files.keys()) 171 self.assertIn('libz-staticdev', files.keys(), "listed pkgs. files: %s" %result.output)
172 self.assertIn('libz1', files.keys()) 172 self.assertIn('libz1', files.keys(), "listed pkgs. files: %s" %result.output)
173 self.assertNotIn('libz-locale', files.keys()) 173 self.assertNotIn('libz-locale', files.keys(), "listed pkgs. files: %s" %result.output)
174 self.assertIn(os.path.join(includedir, 'zlib.h'), files['libz-dev']) 174 self.assertIn(os.path.join(includedir, 'zlib.h'), files['libz-dev'])
175 self.assertIn(os.path.join(mandir, 'man3/zlib.3'), files['libz-doc']) 175 self.assertIn(os.path.join(mandir, 'man3/zlib.3'), files['libz-doc'])
176 self.assertIn(os.path.join(libdir, 'libz.a'), files['libz-staticdev']) 176 self.assertIn(os.path.join(libdir, 'libz.a'), files['libz-staticdev'])
177 # Test recipe, unpackaged 177 # Test recipe, unpackaged
178 result = runCmd('oe-pkgdata-util list-pkg-files -p zlib -u') 178 result = runCmd('oe-pkgdata-util list-pkg-files -p zlib -u')
179 files = splitoutput(result.output) 179 files = splitoutput(result.output)
180 self.assertIn('zlib-dbg', files.keys()) 180 self.assertIn('zlib-dbg', files.keys(), "listed pkgs. files: %s" %result.output)
181 self.assertIn('zlib-doc', files.keys()) 181 self.assertIn('zlib-doc', files.keys(), "listed pkgs. files: %s" %result.output)
182 self.assertIn('zlib-dev', files.keys()) 182 self.assertIn('zlib-dev', files.keys(), "listed pkgs. files: %s" %result.output)
183 self.assertIn('zlib-staticdev', files.keys()) 183 self.assertIn('zlib-staticdev', files.keys(), "listed pkgs. files: %s" %result.output)
184 self.assertIn('zlib', files.keys()) 184 self.assertIn('zlib', files.keys(), "listed pkgs. files: %s" %result.output)
185 self.assertIn('zlib-locale', files.keys()) # this is the key one 185 self.assertIn('zlib-locale', files.keys(), "listed pkgs. files: %s" %result.output) # this is the key one
186 self.assertIn(os.path.join(includedir, 'zlib.h'), files['zlib-dev']) 186 self.assertIn(os.path.join(includedir, 'zlib.h'), files['zlib-dev'])
187 self.assertIn(os.path.join(mandir, 'man3/zlib.3'), files['zlib-doc']) 187 self.assertIn(os.path.join(mandir, 'man3/zlib.3'), files['zlib-doc'])
188 self.assertIn(os.path.join(libdir, 'libz.a'), files['zlib-staticdev']) 188 self.assertIn(os.path.join(libdir, 'libz.a'), files['zlib-staticdev'])
189 # Test recipe, runtime, unpackaged 189 # Test recipe, runtime, unpackaged
190 result = runCmd('oe-pkgdata-util list-pkg-files -p zlib -r -u') 190 result = runCmd('oe-pkgdata-util list-pkg-files -p zlib -r -u')
191 files = splitoutput(result.output) 191 files = splitoutput(result.output)
192 self.assertIn('libz-dbg', files.keys()) 192 self.assertIn('libz-dbg', files.keys(), "listed pkgs. files: %s" %result.output)
193 self.assertIn('libz-doc', files.keys()) 193 self.assertIn('libz-doc', files.keys(), "listed pkgs. files: %s" %result.output)
194 self.assertIn('libz-dev', files.keys()) 194 self.assertIn('libz-dev', files.keys(), "listed pkgs. files: %s" %result.output)
195 self.assertIn('libz-staticdev', files.keys()) 195 self.assertIn('libz-staticdev', files.keys(), "listed pkgs. files: %s" %result.output)
196 self.assertIn('libz1', files.keys()) 196 self.assertIn('libz1', files.keys(), "listed pkgs. files: %s" %result.output)
197 self.assertIn('libz-locale', files.keys()) # this is the key one 197 self.assertIn('libz-locale', files.keys(), "listed pkgs. files: %s" %result.output) # this is the key one
198 self.assertIn(os.path.join(includedir, 'zlib.h'), files['libz-dev']) 198 self.assertIn(os.path.join(includedir, 'zlib.h'), files['libz-dev'])
199 self.assertIn(os.path.join(mandir, 'man3/zlib.3'), files['libz-doc']) 199 self.assertIn(os.path.join(mandir, 'man3/zlib.3'), files['libz-doc'])
200 self.assertIn(os.path.join(libdir, 'libz.a'), files['libz-staticdev']) 200 self.assertIn(os.path.join(libdir, 'libz.a'), files['libz-staticdev'])