diff options
| author | Armin Kuster <akuster808@gmail.com> | 2023-07-07 13:44:28 -0400 |
|---|---|---|
| committer | Armin Kuster <akuster808@gmail.com> | 2023-07-31 06:18:52 -0400 |
| commit | 1ca654ef4fe809c642164eccc186ac9acee6b778 (patch) | |
| tree | f8486ed607cafe588f6f13992b74d9842a935db6 | |
| parent | ef184ce03a0f442ccb9e069994eb3bc353275a78 (diff) | |
| download | meta-security-1ca654ef4fe809c642164eccc186ac9acee6b778.tar.gz | |
scap-security-guide: enable ptest
This add the basic framework to allow the test suite to run. It takes a very long time
so it my not be practical to run in some cases (days in my case).
The ptest log format has not been verified.
Signed-off-by: Armin Kuster <akuster808@gmail.com>
| -rw-r--r-- | recipes-compliance/scap-security-guide/files/run-ptest | 7 | ||||
| -rw-r--r-- | recipes-compliance/scap-security-guide/scap-security-guide_0.1.67.bb | 47 |
2 files changed, 53 insertions, 1 deletions
diff --git a/recipes-compliance/scap-security-guide/files/run-ptest b/recipes-compliance/scap-security-guide/files/run-ptest new file mode 100644 index 0000000..e8d270f --- /dev/null +++ b/recipes-compliance/scap-security-guide/files/run-ptest | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | export PYTHONPATH="/usr/lib/scap-security-guide/ptest/git:$PYTHONPATH" | ||
| 4 | |||
| 5 | cd git/build | ||
| 6 | |||
| 7 | ctest --output-on-failure -E unique-stigids | ||
diff --git a/recipes-compliance/scap-security-guide/scap-security-guide_0.1.67.bb b/recipes-compliance/scap-security-guide/scap-security-guide_0.1.67.bb index 6e62f22..988e48b 100644 --- a/recipes-compliance/scap-security-guide/scap-security-guide_0.1.67.bb +++ b/recipes-compliance/scap-security-guide/scap-security-guide_0.1.67.bb | |||
| @@ -9,6 +9,7 @@ LICENSE = "BSD-3-Clause" | |||
| 9 | SRCREV = "3a1012bc9ec2b01b3b71c6feefd3cff0f52bd64d" | 9 | SRCREV = "3a1012bc9ec2b01b3b71c6feefd3cff0f52bd64d" |
| 10 | SRC_URI = "git://github.com/ComplianceAsCode/content.git;branch=master;protocol=https \ | 10 | SRC_URI = "git://github.com/ComplianceAsCode/content.git;branch=master;protocol=https \ |
| 11 | file://run_eval.sh \ | 11 | file://run_eval.sh \ |
| 12 | file://run-ptest \ | ||
| 12 | file://0001-scap-security-guide-add-openembedded-distro-support.patch \ | 13 | file://0001-scap-security-guide-add-openembedded-distro-support.patch \ |
| 13 | file://0002-scap-security-guide-Add-Poky-support.patch \ | 14 | file://0002-scap-security-guide-Add-Poky-support.patch \ |
| 14 | " | 15 | " |
| @@ -19,7 +20,7 @@ DEPENDS = "openscap-native python3-pyyaml-native python3-jinja2-native libxml2-n | |||
| 19 | S = "${WORKDIR}/git" | 20 | S = "${WORKDIR}/git" |
| 20 | B = "${S}/build" | 21 | B = "${S}/build" |
| 21 | 22 | ||
| 22 | inherit cmake pkgconfig python3native python3targetconfig | 23 | inherit cmake pkgconfig python3native python3targetconfig ptest |
| 23 | 24 | ||
| 24 | OECMAKE_GENERATOR = "Unix Makefiles" | 25 | OECMAKE_GENERATOR = "Unix Makefiles" |
| 25 | 26 | ||
| @@ -37,8 +38,52 @@ do_install:append() { | |||
| 37 | install ${WORKDIR}/run_eval.sh ${D}${datadir}/openscap/. | 38 | install ${WORKDIR}/run_eval.sh ${D}${datadir}/openscap/. |
| 38 | } | 39 | } |
| 39 | 40 | ||
| 41 | do_compile_ptest() { | ||
| 42 | cd ${S}/build | ||
| 43 | cmake ../ | ||
| 44 | make | ||
| 45 | } | ||
| 46 | |||
| 47 | do_install_ptest() { | ||
| 48 | |||
| 49 | # remove host & work dir from tests | ||
| 50 | for x in $(find ${S}/build -type f) ; | ||
| 51 | do | ||
| 52 | sed -e 's#${HOSTTOOLS_DIR}/##g' \ | ||
| 53 | -e 's#${RECIPE_SYSROOT_NATIVE}##g' \ | ||
| 54 | -e 's#${WORKDIR}#${PTEST_PATH}#g' \ | ||
| 55 | -e 's#/.*/xmllint#/usr/bin/xmllint#g' \ | ||
| 56 | -e 's#/.*/oscap#/usr/bin/oscap#g' \ | ||
| 57 | -e 's#/python3-native##g' \ | ||
| 58 | -i ${x} | ||
| 59 | done | ||
| 60 | |||
| 61 | for x in $(find ${S}/build-scripts -type f) ; | ||
| 62 | do | ||
| 63 | sed -i -e '1s|^#!.*|#!/usr/bin/env python3|' ${x} | ||
| 64 | done | ||
| 65 | |||
| 66 | for x in $(find ${S}/tests -type f) ; | ||
| 67 | do | ||
| 68 | sed -i -e '1s|^#!.*|#!/usr/bin/env python3|' ${x} | ||
| 69 | done | ||
| 70 | |||
| 71 | for x in $(find ${S}/utils -type f) ; | ||
| 72 | do | ||
| 73 | sed -i -e '1s|^#!.*|#!/usr/bin/env python3|' ${x} | ||
| 74 | done | ||
| 75 | |||
| 76 | PDIRS="apple_os build controls products shared components applications linux_os ocp-resources tests utils ssg build-scripts" | ||
| 77 | t=${D}/${PTEST_PATH}/git | ||
| 78 | for d in ${PDIRS}; do | ||
| 79 | install -d ${t}/$d | ||
| 80 | cp -fr ${S}/$d/* ${t}/$d/. | ||
| 81 | done | ||
| 82 | } | ||
| 83 | |||
| 40 | FILES:${PN} += "${datadir}/xml ${datadir}/openscap" | 84 | FILES:${PN} += "${datadir}/xml ${datadir}/openscap" |
| 41 | 85 | ||
| 42 | RDEPENDS:${PN} = "openscap" | 86 | RDEPENDS:${PN} = "openscap" |
| 87 | RDEPENDS:${PN}-ptest = "cmake grep sed bash git python3 python3-modules python3-mypy python3-pyyaml python3-yamlpath python3-xmldiff python3-json2html python3-pandas python3-openpyxl python3-pytest libxml2-utils libxslt-bin" | ||
| 43 | 88 | ||
| 44 | COMPATIBLE_HOST:libc-musl = "null" | 89 | COMPATIBLE_HOST:libc-musl = "null" |
