selinux/python/audit2allow/Makefile
Nicolas Iooss 4ac069a3ee python/audit2allow: make the tests useful again
audit2allow testsuite requires a system which uses SELinux with a MLS
policy. This is a lot to ask for a continuous integretation system.
Thankfully this can be worked around by using option -p to run the tools
with a specific configuration. Doing this, the testsuite can even be run
on a system without SELinux.

This approach requires building a custom policy for parsing test.log.
Add a minimal policy written in CIL for this need.

While at it:
* Do not invoke "sudo sepolgen-ifgen" but produce a file in a writable
  directory (instead of /var/lib/sepolgen/interface_info)
* Use sys.executable instead of 'python', in order to really test
  python3 and python2 when calling the test script with one of these
  interpreters.

Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
2019-01-08 10:15:46 +01:00

49 lines
1.3 KiB
Makefile

PYTHON ?= python
SECILC ?= secilc
# Installation directories.
PREFIX ?= /usr
BINDIR ?= $(PREFIX)/bin
MANDIR ?= $(PREFIX)/share/man
CFLAGS ?= -Werror -Wall -W
# If no specific libsepol.a is specified, fall back on LDFLAGS search path
# Otherwise, as $(LIBSEPOLA) already appears in the dependencies, there
# is no need to define a value for LDLIBS_LIBSEPOLA
ifeq ($(LIBSEPOLA),)
LDLIBS_LIBSEPOLA := -l:libsepol.a
endif
all: audit2why sepolgen-ifgen-attr-helper
sepolgen-ifgen-attr-helper: sepolgen-ifgen-attr-helper.o $(LIBSEPOLA)
$(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS_LIBSEPOLA)
audit2why:
ln -sf audit2allow audit2why
test: all test_dummy_policy
@$(PYTHON) test_audit2allow.py -v
test_dummy_policy: test_dummy_policy.cil
$(SECILC) -o $@ -f /dev/null $<
install: all
-mkdir -p $(DESTDIR)$(BINDIR)
install -m 755 audit2allow $(DESTDIR)$(BINDIR)
(cd $(DESTDIR)$(BINDIR); ln -sf audit2allow audit2why)
install -m 755 sepolgen-ifgen-attr-helper $(DESTDIR)$(BINDIR)
install -m 755 sepolgen-ifgen $(DESTDIR)$(BINDIR)
-mkdir -p $(DESTDIR)$(MANDIR)/man1
install -m 644 audit2allow.1 $(DESTDIR)$(MANDIR)/man1/
install -m 644 audit2why.1 $(DESTDIR)$(MANDIR)/man1/
clean:
rm -f *~ *.o sepolgen-ifgen-attr-helper test_dummy_policy
indent:
../../scripts/Lindent $(wildcard *.[ch])
relabel: ;