1# Copyright (C) 2017 Intel Corporation
2#
3# SPDX-License-Identifier: MIT
4#
5
6import unittest
7
8from checklayer import LayerType
9from checklayer.case import OECheckLayerTestCase
10
11class DistroCheckLayer(OECheckLayerTestCase):
12    @classmethod
13    def setUpClass(self):
14        if self.tc.layer['type'] not in (LayerType.DISTRO, LayerType.CORE):
15            raise unittest.SkipTest("DistroCheckLayer: Layer %s isn't Distro one." %\
16                self.tc.layer['name'])
17
18    def test_distro_defines_distros(self):
19        self.assertTrue(self.tc.layer['conf']['distros'],
20                "Layer is BSP but doesn't defines machines.")
21
22    def test_distro_no_set_distros(self):
23        from oeqa.utils.commands import get_bb_var
24
25        distro = get_bb_var('DISTRO')
26        self.assertEqual(self.td['bbvars']['DISTRO'], distro,
27                msg="Layer %s modified distro %s -> %s" % \
28                    (self.tc.layer['name'], self.td['bbvars']['DISTRO'], distro))
29