xref: /aosp_15_r20/external/selinux/python/sepolgen/tests/test_module.py (revision 2d543d20722ada2425b5bdab9d0d1d29470e7bba)
1*2d543d20SAndroid Build Coastguard Worker# Authors: Karl MacMillan <[email protected]>
2*2d543d20SAndroid Build Coastguard Worker#
3*2d543d20SAndroid Build Coastguard Worker# Copyright (C) 2006 Red Hat
4*2d543d20SAndroid Build Coastguard Worker# see file 'COPYING' for use and warranty information
5*2d543d20SAndroid Build Coastguard Worker#
6*2d543d20SAndroid Build Coastguard Worker# This program is free software; you can redistribute it and/or
7*2d543d20SAndroid Build Coastguard Worker# modify it under the terms of the GNU General Public License as
8*2d543d20SAndroid Build Coastguard Worker# published by the Free Software Foundation; version 2 only
9*2d543d20SAndroid Build Coastguard Worker#
10*2d543d20SAndroid Build Coastguard Worker# This program is distributed in the hope that it will be useful,
11*2d543d20SAndroid Build Coastguard Worker# but WITHOUT ANY WARRANTY; without even the implied warranty of
12*2d543d20SAndroid Build Coastguard Worker# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13*2d543d20SAndroid Build Coastguard Worker# GNU General Public License for more details.
14*2d543d20SAndroid Build Coastguard Worker#
15*2d543d20SAndroid Build Coastguard Worker# You should have received a copy of the GNU General Public License
16*2d543d20SAndroid Build Coastguard Worker# along with this program; if not, write to the Free Software
17*2d543d20SAndroid Build Coastguard Worker# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18*2d543d20SAndroid Build Coastguard Worker#
19*2d543d20SAndroid Build Coastguard Worker
20*2d543d20SAndroid Build Coastguard Workerimport unittest
21*2d543d20SAndroid Build Coastguard Workerimport sepolgen.module as module
22*2d543d20SAndroid Build Coastguard Workerimport os
23*2d543d20SAndroid Build Coastguard Worker
24*2d543d20SAndroid Build Coastguard Workerclass TestModuleCompiler(unittest.TestCase):
25*2d543d20SAndroid Build Coastguard Worker    def test(self):
26*2d543d20SAndroid Build Coastguard Worker        package = "module_compile_test.pp"
27*2d543d20SAndroid Build Coastguard Worker        mc = module.ModuleCompiler()
28*2d543d20SAndroid Build Coastguard Worker        mc.create_module_package("module_compile_test.te", refpolicy=True)
29*2d543d20SAndroid Build Coastguard Worker        os.stat(package)
30*2d543d20SAndroid Build Coastguard Worker        os.unlink(package)
31*2d543d20SAndroid Build Coastguard Worker
32*2d543d20SAndroid Build Coastguard Worker        mc.refpolicy = True
33*2d543d20SAndroid Build Coastguard Worker        mc.create_module_package("module_compile_test.te", refpolicy=False)
34*2d543d20SAndroid Build Coastguard Worker        os.stat(package)
35*2d543d20SAndroid Build Coastguard Worker        os.unlink(package)
36