diff options
| author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-06-29 09:16:11 +0100 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-07-01 15:39:59 +0100 |
| commit | 58ecd46c6483456118327f67b81f93869d458aa9 (patch) | |
| tree | 83cd7c5a12eb6c7183719ee53331a734bc8713e1 | |
| parent | dcd361f9ebadf1319bfcf8fe41e38a569c47da0b (diff) | |
| download | poky-58ecd46c6483456118327f67b81f93869d458aa9.tar.gz | |
oeqa/bbtests: Improve error handling
Currently if a test fails the cleanup isn't performed, leading to cascade
failures in other tests. We can do better.
(From OE-Core rev: db01d6ba2ce87e1586dc8804dd823a0a038d5794)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rw-r--r-- | meta/lib/oeqa/selftest/bbtests.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/meta/lib/oeqa/selftest/bbtests.py b/meta/lib/oeqa/selftest/bbtests.py index b301d8f819..f4f3884f7e 100644 --- a/meta/lib/oeqa/selftest/bbtests.py +++ b/meta/lib/oeqa/selftest/bbtests.py | |||
| @@ -121,9 +121,9 @@ class BitbakeTests(oeSelfTest): | |||
| 121 | @testcase(1028) | 121 | @testcase(1028) |
| 122 | def test_environment(self): | 122 | def test_environment(self): |
| 123 | self.append_config("TEST_ENV=\"localconf\"") | 123 | self.append_config("TEST_ENV=\"localconf\"") |
| 124 | self.addCleanup(self.remove_config, "TEST_ENV=\"localconf\"") | ||
| 124 | result = runCmd('bitbake -e | grep TEST_ENV=') | 125 | result = runCmd('bitbake -e | grep TEST_ENV=') |
| 125 | self.assertTrue('localconf' in result.output) | 126 | self.assertTrue('localconf' in result.output) |
| 126 | self.remove_config("TEST_ENV=\"localconf\"") | ||
| 127 | 127 | ||
| 128 | @testcase(1029) | 128 | @testcase(1029) |
| 129 | def test_dry_run(self): | 129 | def test_dry_run(self): |
| @@ -149,9 +149,9 @@ class BitbakeTests(oeSelfTest): | |||
| 149 | result = runCmd('bitbake -r conf/prefile.conf -e | grep TEST_PREFILE=') | 149 | result = runCmd('bitbake -r conf/prefile.conf -e | grep TEST_PREFILE=') |
| 150 | self.assertTrue('prefile' in result.output) | 150 | self.assertTrue('prefile' in result.output) |
| 151 | self.append_config("TEST_PREFILE=\"localconf\"") | 151 | self.append_config("TEST_PREFILE=\"localconf\"") |
| 152 | self.addCleanup(self.remove_config, "TEST_PREFILE=\"localconf\"") | ||
| 152 | result = runCmd('bitbake -r conf/prefile.conf -e | grep TEST_PREFILE=') | 153 | result = runCmd('bitbake -r conf/prefile.conf -e | grep TEST_PREFILE=') |
| 153 | self.assertTrue('localconf' in result.output) | 154 | self.assertTrue('localconf' in result.output) |
| 154 | self.remove_config("TEST_PREFILE=\"localconf\"") | ||
| 155 | 155 | ||
| 156 | @testcase(1033) | 156 | @testcase(1033) |
| 157 | def test_postfile(self): | 157 | def test_postfile(self): |
| @@ -159,9 +159,9 @@ class BitbakeTests(oeSelfTest): | |||
| 159 | self.track_for_cleanup(postconf) | 159 | self.track_for_cleanup(postconf) |
| 160 | ftools.write_file(postconf , "TEST_POSTFILE=\"postfile\"") | 160 | ftools.write_file(postconf , "TEST_POSTFILE=\"postfile\"") |
| 161 | self.append_config("TEST_POSTFILE=\"localconf\"") | 161 | self.append_config("TEST_POSTFILE=\"localconf\"") |
| 162 | self.addCleanup(self.remove_config, "TEST_POSTFILE=\"localconf\"") | ||
| 162 | result = runCmd('bitbake -R conf/postfile.conf -e | grep TEST_POSTFILE=') | 163 | result = runCmd('bitbake -R conf/postfile.conf -e | grep TEST_POSTFILE=') |
| 163 | self.assertTrue('postfile' in result.output) | 164 | self.assertTrue('postfile' in result.output) |
| 164 | self.remove_config("TEST_POSTFILE=\"localconf\"") | ||
| 165 | 165 | ||
| 166 | @testcase(1034) | 166 | @testcase(1034) |
| 167 | def test_checkuri(self): | 167 | def test_checkuri(self): |
| @@ -183,8 +183,8 @@ class BitbakeTests(oeSelfTest): | |||
| 183 | data = 'INCOMPATIBLE_LICENSE = "GPLv3"' | 183 | data = 'INCOMPATIBLE_LICENSE = "GPLv3"' |
| 184 | conf = os.path.join(self.builddir, 'conf/local.conf') | 184 | conf = os.path.join(self.builddir, 'conf/local.conf') |
| 185 | ftools.append_file(conf ,data) | 185 | ftools.append_file(conf ,data) |
| 186 | self.addCleanup(ftools.remove_from_file, conf ,data) | ||
| 186 | result = bitbake('readline', ignore_status=True) | 187 | result = bitbake('readline', ignore_status=True) |
| 187 | self.assertEqual(result.status, 0) | 188 | self.assertEqual(result.status, 0) |
| 188 | self.assertFalse(os.path.isfile(os.path.join(self.builddir, 'tmp/deploy/licenses/readline/generic_GPLv3'))) | 189 | self.assertFalse(os.path.isfile(os.path.join(self.builddir, 'tmp/deploy/licenses/readline/generic_GPLv3'))) |
| 189 | self.assertTrue(os.path.isfile(os.path.join(self.builddir, 'tmp/deploy/licenses/readline/generic_GPLv2'))) | 190 | self.assertTrue(os.path.isfile(os.path.join(self.builddir, 'tmp/deploy/licenses/readline/generic_GPLv2'))) |
| 190 | ftools.remove_from_file(conf ,data) \ No newline at end of file | ||
