summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@intel.com>2015-10-19 15:58:26 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-10-21 22:56:07 +0100
commit2d008033c540f07c12e025c342f7474e09e1c615 (patch)
tree03b1aaf0882723233b3b206dd77c3b6975040a55 /meta
parent1881564cdd8f52c2d7ee46e4c2d38272c4d9820c (diff)
downloadpoky-2d008033c540f07c12e025c342f7474e09e1c615.tar.gz
oeqa/selftest: improve config writing and cleanup
The selftest.inc configuration file is deleted in both tearDown() and setUp() so there's no need to use addCleanup() to remove statements from it. Use write_config instead of append_config if the intention is to start from an empty config file, for clarity. Finally remove some misleading comments that claim that append_config() writes to local.conf when it doesn't. (From OE-Core rev: ad33259b507914bfc8de92d1df12e0974157900e) 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/bbtests.py9
-rw-r--r--meta/lib/oeqa/selftest/buildoptions.py4
-rw-r--r--meta/lib/oeqa/selftest/imagefeatures.py16
3 files changed, 9 insertions, 20 deletions
diff --git a/meta/lib/oeqa/selftest/bbtests.py b/meta/lib/oeqa/selftest/bbtests.py
index 1c0e588c04..94ca79c031 100644
--- a/meta/lib/oeqa/selftest/bbtests.py
+++ b/meta/lib/oeqa/selftest/bbtests.py
@@ -156,8 +156,7 @@ SSTATE_DIR = \"${TOPDIR}/download-selftest\"
156 156
157 @testcase(1028) 157 @testcase(1028)
158 def test_environment(self): 158 def test_environment(self):
159 self.append_config("TEST_ENV=\"localconf\"") 159 self.write_config("TEST_ENV=\"localconf\"")
160 self.addCleanup(self.remove_config, "TEST_ENV=\"localconf\"")
161 result = runCmd('bitbake -e | grep TEST_ENV=') 160 result = runCmd('bitbake -e | grep TEST_ENV=')
162 self.assertTrue('localconf' in result.output, msg = "bitbake didn't report any value for TEST_ENV variable. To test, run 'bitbake -e | grep TEST_ENV='") 161 self.assertTrue('localconf' in result.output, msg = "bitbake didn't report any value for TEST_ENV variable. To test, run 'bitbake -e | grep TEST_ENV='")
163 162
@@ -184,8 +183,7 @@ SSTATE_DIR = \"${TOPDIR}/download-selftest\"
184 ftools.write_file(preconf ,"TEST_PREFILE=\"prefile\"") 183 ftools.write_file(preconf ,"TEST_PREFILE=\"prefile\"")
185 result = runCmd('bitbake -r conf/prefile.conf -e | grep TEST_PREFILE=') 184 result = runCmd('bitbake -r conf/prefile.conf -e | grep TEST_PREFILE=')
186 self.assertTrue('prefile' in result.output, "Preconfigure file \"prefile.conf\"was not taken into consideration. ") 185 self.assertTrue('prefile' in result.output, "Preconfigure file \"prefile.conf\"was not taken into consideration. ")
187 self.append_config("TEST_PREFILE=\"localconf\"") 186 self.write_config("TEST_PREFILE=\"localconf\"")
188 self.addCleanup(self.remove_config, "TEST_PREFILE=\"localconf\"")
189 result = runCmd('bitbake -r conf/prefile.conf -e | grep TEST_PREFILE=') 187 result = runCmd('bitbake -r conf/prefile.conf -e | grep TEST_PREFILE=')
190 self.assertTrue('localconf' in result.output, "Preconfigure file \"prefile.conf\"was not taken into consideration.") 188 self.assertTrue('localconf' in result.output, "Preconfigure file \"prefile.conf\"was not taken into consideration.")
191 189
@@ -194,8 +192,7 @@ SSTATE_DIR = \"${TOPDIR}/download-selftest\"
194 postconf = os.path.join(self.builddir, 'conf/postfile.conf') 192 postconf = os.path.join(self.builddir, 'conf/postfile.conf')
195 self.track_for_cleanup(postconf) 193 self.track_for_cleanup(postconf)
196 ftools.write_file(postconf , "TEST_POSTFILE=\"postfile\"") 194 ftools.write_file(postconf , "TEST_POSTFILE=\"postfile\"")
197 self.append_config("TEST_POSTFILE=\"localconf\"") 195 self.write_config("TEST_POSTFILE=\"localconf\"")
198 self.addCleanup(self.remove_config, "TEST_POSTFILE=\"localconf\"")
199 result = runCmd('bitbake -R conf/postfile.conf -e | grep TEST_POSTFILE=') 196 result = runCmd('bitbake -R conf/postfile.conf -e | grep TEST_POSTFILE=')
200 self.assertTrue('postfile' in result.output, "Postconfigure file \"postfile.conf\"was not taken into consideration.") 197 self.assertTrue('postfile' in result.output, "Postconfigure file \"postfile.conf\"was not taken into consideration.")
201 198
diff --git a/meta/lib/oeqa/selftest/buildoptions.py b/meta/lib/oeqa/selftest/buildoptions.py
index fbe0cd7c37..acf481f7b8 100644
--- a/meta/lib/oeqa/selftest/buildoptions.py
+++ b/meta/lib/oeqa/selftest/buildoptions.py
@@ -39,7 +39,7 @@ class ImageOptionsTests(oeSelfTest):
39 for image_file in deploydir_files: 39 for image_file in deploydir_files:
40 if imagename in image_file and os.path.islink(os.path.join(deploydir, image_file)): 40 if imagename in image_file and os.path.islink(os.path.join(deploydir, image_file)):
41 track_original_files.append(os.path.realpath(os.path.join(deploydir, image_file))) 41 track_original_files.append(os.path.realpath(os.path.join(deploydir, image_file)))
42 self.append_config("RM_OLD_IMAGE = \"1\"") 42 self.write_config("RM_OLD_IMAGE = \"1\"")
43 bitbake("-C rootfs core-image-minimal") 43 bitbake("-C rootfs core-image-minimal")
44 deploydir_files = os.listdir(deploydir) 44 deploydir_files = os.listdir(deploydir)
45 remaining_not_expected = [path for path in track_original_files if os.path.basename(path) in deploydir_files] 45 remaining_not_expected = [path for path in track_original_files if os.path.basename(path) in deploydir_files]
@@ -97,7 +97,7 @@ class SanityOptionsTest(oeSelfTest):
97 97
98 @testcase(278) 98 @testcase(278)
99 def test_sanity_userspace_dependency(self): 99 def test_sanity_userspace_dependency(self):
100 self.append_config('WARN_QA_append = " unsafe-references-in-binaries unsafe-references-in-scripts"') 100 self.write_config('WARN_QA_append = " unsafe-references-in-binaries unsafe-references-in-scripts"')
101 bitbake("-ccleansstate gzip nfs-utils") 101 bitbake("-ccleansstate gzip nfs-utils")
102 res = bitbake("gzip nfs-utils") 102 res = bitbake("gzip nfs-utils")
103 self.assertTrue("WARNING: QA Issue: gzip" in res.output, "WARNING: QA Issue: gzip message is not present in bitbake's output: %s" % res.output) 103 self.assertTrue("WARNING: QA Issue: gzip" in res.output, "WARNING: QA Issue: gzip message is not present in bitbake's output: %s" % res.output)
diff --git a/meta/lib/oeqa/selftest/imagefeatures.py b/meta/lib/oeqa/selftest/imagefeatures.py
index fcffc423ea..4efb0d92a3 100644
--- a/meta/lib/oeqa/selftest/imagefeatures.py
+++ b/meta/lib/oeqa/selftest/imagefeatures.py
@@ -25,9 +25,7 @@ class ImageFeatures(oeSelfTest):
25 features = 'EXTRA_IMAGE_FEATURES = "ssh-server-openssh empty-root-password allow-empty-password"\n' 25 features = 'EXTRA_IMAGE_FEATURES = "ssh-server-openssh empty-root-password allow-empty-password"\n'
26 features += 'INHERIT += "extrausers"\n' 26 features += 'INHERIT += "extrausers"\n'
27 features += 'EXTRA_USERS_PARAMS = "useradd -p \'\' {}; usermod -s /bin/sh {};"'.format(self.test_user, self.test_user) 27 features += 'EXTRA_USERS_PARAMS = "useradd -p \'\' {}; usermod -s /bin/sh {};"'.format(self.test_user, self.test_user)
28 28 self.write_config(features)
29 # Append 'features' to local.conf
30 self.append_config(features)
31 29
32 # Build a core-image-minimal 30 # Build a core-image-minimal
33 bitbake('core-image-minimal') 31 bitbake('core-image-minimal')
@@ -53,9 +51,7 @@ class ImageFeatures(oeSelfTest):
53 features = 'EXTRA_IMAGE_FEATURES = "ssh-server-openssh allow-empty-password"\n' 51 features = 'EXTRA_IMAGE_FEATURES = "ssh-server-openssh allow-empty-password"\n'
54 features += 'INHERIT += "extrausers"\n' 52 features += 'INHERIT += "extrausers"\n'
55 features += 'EXTRA_USERS_PARAMS = "useradd -p \'\' {}; usermod -s /bin/sh {};"'.format(self.test_user, self.test_user) 53 features += 'EXTRA_USERS_PARAMS = "useradd -p \'\' {}; usermod -s /bin/sh {};"'.format(self.test_user, self.test_user)
56 54 self.write_config(features)
57 # Append 'features' to local.conf
58 self.append_config(features)
59 55
60 # Build a core-image-minimal 56 # Build a core-image-minimal
61 bitbake('core-image-minimal') 57 bitbake('core-image-minimal')
@@ -87,9 +83,7 @@ class ImageFeatures(oeSelfTest):
87 features += 'IMAGE_INSTALL_append = " openssh"\n' 83 features += 'IMAGE_INSTALL_append = " openssh"\n'
88 features += 'EXTRA_IMAGE_FEATURES = "empty-root-password allow-empty-password package-management"\n' 84 features += 'EXTRA_IMAGE_FEATURES = "empty-root-password allow-empty-password package-management"\n'
89 features += 'RPMROOTFSDEPENDS_remove = "rpmresolve-native:do_populate_sysroot"' 85 features += 'RPMROOTFSDEPENDS_remove = "rpmresolve-native:do_populate_sysroot"'
90 86 self.write_config(features)
91 # Append 'features' to local.conf
92 self.append_config(features)
93 87
94 # Build a core-image-minimal 88 # Build a core-image-minimal
95 bitbake('core-image-minimal') 89 bitbake('core-image-minimal')
@@ -159,9 +153,7 @@ class ImageFeatures(oeSelfTest):
159 153
160 features = 'DISTRO_FEATURES_append = " wayland"\n' 154 features = 'DISTRO_FEATURES_append = " wayland"\n'
161 features += 'CORE_IMAGE_EXTRA_INSTALL += "wayland weston"' 155 features += 'CORE_IMAGE_EXTRA_INSTALL += "wayland weston"'
162 156 self.write_config(features)
163 # Append 'features' to local.conf
164 self.append_config(features)
165 157
166 # Build a core-image-weston 158 # Build a core-image-weston
167 bitbake('core-image-weston') 159 bitbake('core-image-weston')