From 50d8ea5e540f1d2f423db77e8a93b0f5bcc1d1ca Mon Sep 17 00:00:00 2001 From: Leon Anavi Date: Tue, 14 Nov 2017 19:11:32 +0200 Subject: garage_push.py: Test SOTA_PACKED_CREDENTIALS Add test to verify that the file specified at SOTA_PACKED_CREDENTIALS exists and is included in the image. If SOTA_PACKED_CREDENTIALS is not set this test case will be skipped. Signed-off-by: Leon Anavi --- lib/oeqa/selftest/updater.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'lib') diff --git a/lib/oeqa/selftest/updater.py b/lib/oeqa/selftest/updater.py index 9945b40..b59eefc 100644 --- a/lib/oeqa/selftest/updater.py +++ b/lib/oeqa/selftest/updater.py @@ -65,6 +65,20 @@ class GeneralTests(oeSelfTest): result = get_bb_var('DISTRO_FEATURES').find('systemd') self.assertNotEqual(result, -1, 'Feature "systemd" not set at DISTRO_FEATURES'); + def test_credentials(self): + bitbake('core-image-minimal') + credentials = get_bb_var('SOTA_PACKED_CREDENTIALS') + # skip the test if the variable SOTA_PACKED_CREDENTIALS is not set + if credentials is None: + raise unittest.SkipTest("Variable 'SOTA_PACKED_CREDENTIALS' not set.") + # Check if the file exists + self.assertTrue(os.path.isfile(credentials), "File %s does not exist" % credentials) + deploydir = get_bb_var('DEPLOY_DIR_IMAGE') + imagename = get_bb_var('IMAGE_LINK_NAME', 'core-image-minimal') + # Check if the credentials are included in the output image + result = runCmd('tar -jtvf %s/%s.tar.bz2 | grep sota_provisioning_credentials.zip' % (deploydir, imagename), ignore_status=True) + self.assertEqual(result.status, 0, "Status not equal to 0. output: %s" % result.output) + def test_java(self): result = runCmd('which java', ignore_status=True) self.assertEqual(result.status, 0, "Java not found.") -- cgit v1.2.3-54-g00ecf