1*1a4b7ee2SBrad Bishop# Copyright (C) 2017-2018 Wind River Systems, Inc.
2*1a4b7ee2SBrad Bishop#
3*1a4b7ee2SBrad Bishop# This program is free software; you can redistribute it and/or modify
4*1a4b7ee2SBrad Bishop# it under the terms of the GNU General Public License version 2 as
5*1a4b7ee2SBrad Bishop# published by the Free Software Foundation.
6*1a4b7ee2SBrad Bishop#
7*1a4b7ee2SBrad Bishop# This program is distributed in the hope that it will be useful,
8*1a4b7ee2SBrad Bishop# but WITHOUT ANY WARRANTY; without even the implied warranty of
9*1a4b7ee2SBrad Bishop# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10*1a4b7ee2SBrad Bishop# See the GNU General Public License for more details.
11*1a4b7ee2SBrad Bishop#
12*1a4b7ee2SBrad Bishop# You should have received a copy of the GNU General Public License
13*1a4b7ee2SBrad Bishop# along with this program; if not, write to the Free Software
14*1a4b7ee2SBrad Bishop# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15*1a4b7ee2SBrad Bishop
16*1a4b7ee2SBrad Bishopimport unittest
17*1a4b7ee2SBrad Bishopimport tempfile
18*1a4b7ee2SBrad Bishopimport os
19*1a4b7ee2SBrad Bishopimport bb
20*1a4b7ee2SBrad Bishop
21*1a4b7ee2SBrad Bishopimport logging
22*1a4b7ee2SBrad Bishop
23*1a4b7ee2SBrad Bishopclass LayersTest(unittest.TestCase):
24*1a4b7ee2SBrad Bishop
25*1a4b7ee2SBrad Bishop    def setUp(self):
26*1a4b7ee2SBrad Bishop        self.origdir = os.getcwd()
27*1a4b7ee2SBrad Bishop        self.d = bb.data.init()
28*1a4b7ee2SBrad Bishop        # At least one variable needs to be set
29*1a4b7ee2SBrad Bishop        self.d.setVar('DL_DIR', os.getcwd())
30*1a4b7ee2SBrad Bishop
31*1a4b7ee2SBrad Bishop        if os.environ.get("BB_SKIP_NETTESTS") == "yes":
32*1a4b7ee2SBrad Bishop            self.d.setVar('BB_NO_NETWORK', '1')
33*1a4b7ee2SBrad Bishop
34*1a4b7ee2SBrad Bishop        self.tempdir = tempfile.mkdtemp()
35*1a4b7ee2SBrad Bishop        self.logger = logging.getLogger("BitBake")
36*1a4b7ee2SBrad Bishop
37*1a4b7ee2SBrad Bishop    def tearDown(self):
38*1a4b7ee2SBrad Bishop        os.chdir(self.origdir)
39*1a4b7ee2SBrad Bishop        if os.environ.get("BB_TMPDIR_NOCLEAN") == "yes":
40*1a4b7ee2SBrad Bishop            print("Not cleaning up %s. Please remove manually." % self.tempdir)
41*1a4b7ee2SBrad Bishop        else:
42*1a4b7ee2SBrad Bishop            bb.utils.prunedir(self.tempdir)
43*1a4b7ee2SBrad Bishop
44