Skip to content

Commit

Permalink
ci: add module storage test
Browse files Browse the repository at this point in the history
Add test to verify modular policies can be successfully installed from
a module storage.

Signed-off-by: Christian Göttsche <[email protected]>
  • Loading branch information
cgzones committed Nov 10, 2024
1 parent 7718b32 commit b132eb4
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
9 changes: 9 additions & 0 deletions .github/workflows/build-policy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,15 @@ jobs:
run: |
make validate
- name: Test module storage
working-directory: ${{ inputs.path }}
shell: bash
if: ${{ matrix.monolithic == 'n' }}
run: |
echo compiler-directory = "${TEST_TOOLCHAIN}/usr/libexec/selinux/hll" | sudo tee -a /etc/selinux/semanage.conf
find / -name pp 2> /dev/null
make test-module-storage
- name: Build docs
working-directory: ${{ inputs.path }}
shell: bash
Expand Down
12 changes: 11 additions & 1 deletion Rules.modular
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,16 @@ validate: $(base_pkg) $(mod_pkgs) $(tmpdir)/all_mods.fc $(builtappfiles)
$(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) --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

0 comments on commit b132eb4

Please sign in to comment.