netlabel_tools/0003-tests-add-a-basic-CALIPSO-pass-through-test.patch
Vit Mojzis 295af65518 netlabel_tools-0.30.0-21
- Improve "help/usage" message
- libnetlabel: fix a header file guard typo
- netlabel-config: Fix IPv4/IPv6 addresses parsing in nlbl_reset_unlbl()
- netlabel: Update man page to clarify SELinux labeling
- tests: add a basic CALIPSO pass through test
- doc: fix a typo in the netlabel-config man page

Resolves: RHEL-38477
2025-08-04 12:38:57 +02:00

73 lines
2.0 KiB
Diff

From 3b77fb8f3ee77244edb256cf51029aa445d7aac4 Mon Sep 17 00:00:00 2001
From: Paul Moore <paul@paul-moore.com>
Date: Wed, 3 Mar 2021 17:45:02 -0500
Subject: [PATCH] tests: add a basic CALIPSO pass through test
Signed-off-by: Paul Moore <paul@paul-moore.com>
---
tests/09-calipso_pass.tests | 52 +++++++++++++++++++++++++++++++++++++
1 file changed, 52 insertions(+)
create mode 100755 tests/09-calipso_pass.tests
diff --git a/tests/09-calipso_pass.tests b/tests/09-calipso_pass.tests
new file mode 100755
index 0000000..0de1d15
--- /dev/null
+++ b/tests/09-calipso_pass.tests
@@ -0,0 +1,52 @@
+#!/bin/bash
+
+#
+# NetLabel Tools test script
+#
+
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of version 2 of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+function doi_remove() {
+ local rc=1
+ while [[ $rc -ne 0 && $rc -lt 3 ]]; do
+ $GLBL_NETLABELCTL calipso del doi:$1
+ [[ $? -ne 0 ]] && rc=$(($rc+1)) || rc=0
+ sleep 1
+ done
+ [[ $rc -ne 0 ]] && exit 1
+}
+
+# add the DOIs
+$GLBL_NETLABELCTL calipso add pass doi:100
+[[ $? -ne 0 ]] && exit 1
+$GLBL_NETLABELCTL calipso add pass doi:101
+[[ $? -ne 0 ]] && exit 1
+$GLBL_NETLABELCTL calipso add pass doi:102
+[[ $? -ne 0 ]] && exit 1
+
+# verify the DOIs
+[[ "$($GLBL_NETLABELCTL calipso list doi:100)" != "type:PASS_THROUGH" ]] \
+ && exit 1
+[[ "$($GLBL_NETLABELCTL calipso list doi:101)" != "type:PASS_THROUGH" ]] \
+ && exit 1
+[[ "$($GLBL_NETLABELCTL calipso list doi:102)" != "type:PASS_THROUGH" ]] \
+ && exit 1
+
+# remove the DOIs
+doi_remove 100
+doi_remove 101
+doi_remove 102
+
+exit 0
--
2.49.0