Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add module storage test #832

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/workflows/build-policy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,16 @@ jobs:
run: |
make validate

- name: Test module storage
working-directory: ${{ inputs.path }}
shell: bash
if: ${{ matrix.monolithic == 'n' }}
run: |
temp="${TEST_TOOLCHAIN%\"}"
temp="${temp#\"}"
echo "compiler-directory = ${temp}/usr/libexec/selinux/hll" | sudo tee -a /etc/selinux/semanage.conf
make test-module-storage

- name: Build docs
working-directory: ${{ inputs.path }}
shell: bash
Expand Down
14 changes: 12 additions & 2 deletions Rules.modular
Original file line number Diff line number Diff line change
Expand Up @@ -225,11 +225,21 @@ validate: $(base_pkg) $(mod_pkgs) $(tmpdir)/all_mods.fc $(builtappfiles)
$(verbose) $(SEMOD_LNK) -o $(tmpdir)/test.lnk $(base_pkg) $(mod_pkgs)
$(verbose) $(SEMOD_EXP) $(tmpdir)/test.lnk $(tmpdir)/policy.bin
@echo "Validating $(NAME) file contexts."
$(verbose) $(SETFILES) -q -c $(tmpdir)/policy.bin $(tmpdir)/all_mods.fc
$(verbose) $(SETFILES) -c $(tmpdir)/policy.bin $(tmpdir)/all_mods.fc
@echo "Validating $(NAME) appconfig."
$(verbose) $(validateappconfig) $(builtappconf) $(tmpdir)/policy.bin
@echo "Success."

########################################
#
# Test converting to module storage
#
test-module-storage: $(base_pkg) $(mod_pkgs)
@echo "Testing module storage for $(NAME)."
@test -d $(tmpdir)/policy_root/var/lib/selinux/$(NAME) || mkdir -p $(tmpdir)/policy_root/var/lib/selinux/$(NAME)
$(verbose) $(SEMODULE) $(VERBOSE_FLAG) --noreload --store $(NAME) --path $(tmpdir)/policy_root --install *.pp
$(verbose) $(SETFILES) -c $(tmpdir)/policy_root/var/lib/selinux/$(NAME)/policy/policy.* $(tmpdir)/policy_root/var/lib/selinux/$(NAME)/contexts/files/file_contexts

########################################
#
# Clean the sources
Expand All @@ -241,4 +251,4 @@ clean:
$(verbose) rm -f $(net_contexts) $(net_contexts_nft)
$(verbose) rm -fR $(tmpdir)

.PHONY: default all policy base modules install load pure-load clean validate
.PHONY: default all policy base modules install load pure-load clean validate test-module-storage
4 changes: 2 additions & 2 deletions Rules.monolithic
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ $(homedir_template): $(fc)
#
$(fcpath): $(fc) $(loadpath) $(userpath)/system.users
@echo "Validating $(NAME) file_contexts."
$(verbose) $(SETFILES) -q -c $(loadpath) $(fc)
$(verbose) $(SETFILES) -c $(loadpath) $(fc)
@echo "Installing file_contexts."
@$(INSTALL) -d -m 0755 $(@D)
$(verbose) $(INSTALL) -m 0644 $(fc) $(fcpath)
Expand All @@ -247,7 +247,7 @@ $(fcpath): $(fc) $(loadpath) $(userpath)/system.users
#
validate: $(fc) $(polver) $(builtappfiles)
@echo "Validating $(NAME) file_contexts."
$(verbose) $(SETFILES) -q -c $(polver) $(fc)
$(verbose) $(SETFILES) -c $(polver) $(fc)
@echo "Validating $(NAME) appconfig."
$(verbose) $(validateappconfig) $(builtappconf) $(polver)
@echo "Success."
Expand Down
Loading