From patchwork Mon Nov 18 14:52:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ondrej Mosnacek X-Patchwork-Id: 11249841 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A101013A4 for ; Mon, 18 Nov 2019 14:52:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 76D1A2084D for ; Mon, 18 Nov 2019 14:52:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Zt5raw2h" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727140AbfKROwr (ORCPT ); Mon, 18 Nov 2019 09:52:47 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:35019 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726748AbfKROwr (ORCPT ); Mon, 18 Nov 2019 09:52:47 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574088765; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YynLGcwqfrg1zrZcC7yWAsZBhR/R+Oy3X5+AJIk9Z2o=; b=Zt5raw2hvd+ijlBjfOV1Qp3N5WqA0sjyOFuTGLz/HgHO6K45vj5td1GlX8b5gDgbIMjMUO 1X3ufTCAn89G0IdDhm2yZbpB9M7DOjczpXOu27dAxni3d0puxa7aRxixXDGxVTxj6fWPz9 6lIV0ze23ULpMkaDXdsK5I/9HLv8xmQ= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-220--F3xdTPrN4Cs7EuAtL8IJg-1; Mon, 18 Nov 2019 09:52:43 -0500 Received: by mail-wr1-f69.google.com with SMTP id n11so3120935wrq.5 for ; Mon, 18 Nov 2019 06:52:42 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=lCsn/X0nmr4hSWIgFPGsvpX5LzN+Uu1MiAqfZRe9+Lg=; b=BlKYn33y9Qi8E+Xtv2pwzqO5UEhdVnQu5l6Nw2klej06dOV/9tFtHatXpVpO6Gssrh 4FPA2Qx+BFlTVyC0ne/jGhupoczo7h0SGTcvgYu6rB5Cl0/8H0EYLJy6Vc6mgfFhtNeB tfxZx1EVzkhTfXfTQCRd334UZ478Y/svr3zS2xFjaeYrT7LuNN8CmGEDTusJSQvI3euA zA2SdDpKxI9mLxEbct1SBQDrf414IQ13tfmnqUpJtH+2RMldFQFvFO3IfrqH+9vHwDgb Ay5zan+v2tQ83VspxKNStdqD7ag94qYmvbifWQag9tb99rsGJtHL70KbJcV5A0CUxAS9 h/BA== X-Gm-Message-State: APjAAAXGZSn8qMNFCB+uoeX2q9Tg2Mpyjeifl8hXm9gpHkXtTrl478N/ byqhm9ooVm40wC7fqA+LN5DviVuYAhrKlh9ximfgCeqIvRCOFdvaSW17CCB8SNEXbtryPaqrq4v N975fjTdD3BLwhYqI0g== X-Received: by 2002:a1c:f404:: with SMTP id z4mr29518075wma.12.1574088761632; Mon, 18 Nov 2019 06:52:41 -0800 (PST) X-Google-Smtp-Source: APXvYqzcYHSUybkg8vlk+wVMCrxxq+uACtLM66OfFFuA0n6CHTDWsO8VV4wt+Uqux2oLoJ8L3CSPBg== X-Received: by 2002:a1c:f404:: with SMTP id z4mr29518048wma.12.1574088761352; Mon, 18 Nov 2019 06:52:41 -0800 (PST) Received: from localhost.localdomain.com (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id o5sm23044658wrx.15.2019.11.18.06.52.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Nov 2019 06:52:40 -0800 (PST) From: Ondrej Mosnacek To: selinux@vger.kernel.org Subject: [PATCH testsuite v4 3/3] travis: test building the test policy package Date: Mon, 18 Nov 2019 15:52:38 +0100 Message-Id: <20191118145238.408124-4-omosnace@redhat.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191118145238.408124-1-omosnace@redhat.com> References: <20191118145238.408124-1-omosnace@redhat.com> MIME-Version: 1.0 X-MC-Unique: -F3xdTPrN4Cs7EuAtL8IJg-1 X-Mimecast-Spam-Score: 0 Sender: selinux-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: selinux@vger.kernel.org Download, build, and install Fedora policy & refpolicy and try building the test policy package against both of them. Signed-off-by: Ondrej Mosnacek Reviewed-by: Stephen Smalley Tested-by: Stephen Smalley --- .travis.yml | 48 ++++++++++++++++++++++++++--- policy/Makefile | 11 ++++--- travis-ci/enable-policy.sh | 10 ++++++ travis-ci/setup-policy-fedora.sh | 33 ++++++++++++++++++++ travis-ci/setup-policy-refpolicy.sh | 19 ++++++++++++ 5 files changed, 113 insertions(+), 8 deletions(-) create mode 100644 travis-ci/enable-policy.sh create mode 100644 travis-ci/setup-policy-fedora.sh create mode 100644 travis-ci/setup-policy-refpolicy.sh diff --git a/.travis.yml b/.travis.yml index fbbe98d..42b2490 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: c -dist: xenial +dist: bionic addons: apt: @@ -8,16 +8,56 @@ addons: - astyle - libselinux1-dev - libsctp-dev + - libaudit-dev + - libcap-dev + - libdbus-glib-1-dev + - xmlto + +cache: + directories: + - selinux-policy + - container-selinux + - refpolicy before_install: + - export LIBRARY_PATH=/usr/local/lib + - export LD_LIBRARY_PATH=/usr/local/lib # FYI: known good with HEAD at 8551fc60fc515cd290ba38ee8c758c1f4df52b56 - git clone https://github.com/perltidy/perltidy.git perltidy - | (cd perltidy && perl Makefile.PL && - make && - sudo make install) + make PREFIX=/usr/local && + sudo make install PREFIX=/usr/local) + # install libbpf from sources + - git clone https://github.com/libbpf/libbpf + - (cd libbpf/src && make PREFIX=/usr/local) + - (cd libbpf/src && sudo make install PREFIX=/usr/local) + # install keyutils from sources + - git clone https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/keyutils.git + - KEYUTILS_OPTS="" + - KEYUTILS_OPTS+="BINDIR=/usr/local/bin SBINDIR=/usr/local/sbin " + - KEYUTILS_OPTS+="LIBDIR=/usr/local/lib USRLIBDIR=/usr/local/lib " + - KEYUTILS_OPTS+="INCLUDEDIR=/usr/local/include " + - KEYUTILS_OPTS+="SHAREDIR=/usr/local/share/keyutils MANDIR=/usr/local/share/man" + - (cd keyutils && make $KEYUTILS_OPTS) + - (cd keyutils && sudo make install $KEYUTILS_OPTS) + # install SELinux userspace from source + - git clone https://github.com/SELinuxProject/selinux + - (cd selinux && sudo make install PREFIX=/usr/local SHLIBDIR=/usr/local/lib) + # install Fedora policy and refpolicy + - bash travis-ci/setup-policy-fedora.sh + - bash travis-ci/setup-policy-refpolicy.sh + # establish a fake "selinuxfs" mount (policy/Makefile just greps for selinuxfs) + - sudo mkdir -p /tmp/fake-selinuxfs + - sudo mount -t tmpfs tmpfs /tmp/fake-selinuxfs + - echo 999 >/tmp/fake-selinuxfs/policyvers script: - tools/check-syntax -f && git diff --exit-code - - make + - | + bash travis-ci/enable-policy.sh targeted && + make PREFIX=/usr/local POLDEV=/usr/share/selinux/targeted + - | + bash travis-ci/enable-policy.sh refpolicy && + make PREFIX=/usr/local POLDEV=/usr/share/selinux/refpolicy diff --git a/policy/Makefile b/policy/Makefile index ff65153..39ae84a 100644 --- a/policy/Makefile +++ b/policy/Makefile @@ -1,8 +1,11 @@ -POLDEV ?= /usr/share/selinux/devel -SEMODULE = /usr/sbin/semodule -CHECKPOLICY = /usr/bin/checkpolicy -CHECKMODULE = /usr/bin/checkmodule +PREFIX ?= /usr +BINDIR ?= $(PREFIX)/bin +SBINDIR ?= $(PREFIX)/sbin +POLDEV ?= $(PREFIX)/share/selinux/devel +SEMODULE = $(SBINDIR)/semodule +CHECKPOLICY = $(BINDIR)/checkpolicy +CHECKMODULE = $(BINDIR)/checkmodule DISTRO=$(shell ../tests/os_detect) diff --git a/travis-ci/enable-policy.sh b/travis-ci/enable-policy.sh new file mode 100644 index 0000000..ae53fbe --- /dev/null +++ b/travis-ci/enable-policy.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +set -e + +# create a dummy /etc/selinux/config +sudo mkdir -p /etc/selinux +sudo tee /etc/selinux/config >/dev/null <