Skip to contentSkip to conversation

libcap: add ptest support

PATCH New Kris Gavvala 1 participant 1 message Jun 16

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 libcap: add ptest support

These ptests include a subset of upstream
tests that provide functional coverage of core libcap and libpsx behavior across target systems.

This approach is preferred instead of using libcap's quicktest.sh script because the later assumes the upstream build-tree layout and has too many dependencies not available after installation. Quicktest exercises a wide range of kernel capability features and environment-specific functionality that is too comprehensive for ptests.

The ptests include the following from libcap/tests:
uns_test, psx_test, libcap_launch_test, exploit and noexploit. cap_test from libcap/libcap is also included.

These provide coverage for capability manipulation, libpsx integration, launch handling, and basic security validation.

---

changes in v2:

- Removed libcap_psx_test from ptests
- Added bash when installing ptests

 .../distro/include/ptest-packagelists.inc     |  1 +
 meta/recipes-support/libcap/files/run-ptest   | 25 +++++++++++
 meta/recipes-support/libcap/libcap_2.78.bb    | 44 ++++++++++++++++++-
 3 files changed, 69 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-support/libcap/files/run-ptest
meta/conf/distro/include/ptest-packagelists.inc +1 -0
index f3f42f908a..1254a9e204 100644
@@ -31,6 +31,7 @@ PTESTS_FAST = "\
     libarchive \
     libassuan \
     libatomic-ops \
+    libcap \
     libcheck \
     libconfig \
     libconvert-asn1-perl \
meta/recipes-support/libcap/files/run-ptest new file +25 -0
new file mode 100644
index 0000000000..2d7b656fd3
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+EXPECT_FAIL=1
+EXPECT_PASS=0
+
+cd tests  
+
+for t in uns_test psx_test libcap_launch_test cap_test exploit noexploit; do
+        output=$("./$t" 2>&1 )
+        status=$?
+
+        expected="$EXPECT_PASS"
+
+        if [ $t = 'exploit' ]; then
+                expected="$EXPECT_FAIL"
+        fi
+
+        if [ "$status" -eq "$expected" ]; then
+                echo "PASS: $t"
+        else
+                echo "FAIL: $t"
+                echo "$output"
+        fi
+done
+
meta/recipes-support/libcap/libcap_2.78.bb +43 -1

65 lines not on this page · raw message

Signature · 1 line
2.49.0