diff --git a/.gitlab/scripts/ptest-to-junit.py b/.gitlab/scripts/ptest-to-junit.py index 4bd44111cbb620fad5f91b542003e0cb9fc07236..ce9a180599f9540c60802f99b7b708f3b7a7bd36 100644 --- a/.gitlab/scripts/ptest-to-junit.py +++ b/.gitlab/scripts/ptest-to-junit.py @@ -36,7 +36,7 @@ def _parse_test_log(test_log): if collect_failure_log: failure_log += line continue - if "DEBUG" in line: + if "DEBUG" in line or "OUTPUT" in line: continue regex = r'(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}) ([A-Z]{4}):(.*)' test_result = re.match(regex, line) diff --git a/documentation/developer_manual/build_system.rst b/documentation/developer_manual/build_system.rst index ec88cde9d92365fd5b61e7703fe4078a9644e7df..e27bde2fdb680748fd84d5e1c9009b45bcd99d08 100644 --- a/documentation/developer_manual/build_system.rst +++ b/documentation/developer_manual/build_system.rst @@ -130,13 +130,18 @@ Other Cassini Features Developer Support ----------------- - **Corresponding value in** ``DISTRO_FEATURES`` **variable**: + * **Corresponding value in** ``DISTRO_FEATURES`` **variable**: ``cassini-dev``. + * **Base Config**: ``meta-cassini-config/kas/cassini-dev.yml``. - This Cassini distribution image feature includes packages appropriate for + This Cassini distribution feature includes packages appropriate for development image builds, such as the ``debug-tweaks`` package, which sets an empty root password for simplified development access. + .. code-block:: console + + kas build meta-cassini-config/kas/cassini-dev.yml:meta-cassini-config/kas/n1sdp.yml + .. _build_system_run-time_integration_tests_label: Run-Time Integration Tests @@ -146,7 +151,7 @@ Run-Time Integration Tests ``cassini-test``. * **Build Modifier Config**: ``meta-cassini-config/kas/tests.yml``. - This Cassini distribution image feature includes the Cassini test suites + This Cassini distribution feature includes the Cassini test suites provided to validate the image is running successfully with the expected Cassini functionalities. @@ -169,6 +174,29 @@ Run-Time Integration Tests variables associated with each suite are detailed separately, at :ref:`run-time_integration_tests_label`. +.. _parsec_service_label: + +Parsec service +-------------- + + **Corresponding value in** ``DISTRO_FEATURES`` **variable**: + ``cassini-parsec``. + + This Cassini distribution feature adds parsec-service and parsec-tool + to the Cassini distribution image. + + The value ``cassini-parsec`` is appended to ``DISTRO_FEATURES`` in + ``meta-cassini-distro/conf/distro/cassini.conf``. Therefore, parsec service + is included in the Cassini distribution image by default. If parsec-service + is not required then the value ``cassini-parsec`` can be removed from + ``DISTRO_FEATURES`` in the ``.conf`` of the downstream + distribution. To build Cassini distribution image with parsec-service for + the N1SDP hardware target platform, run the following command: + + .. code-block:: console + + kas build meta-cassini-config/kas/cassini.yml:meta-cassini-config/kas/n1sdp.yml + .. _security_hardening_label: Security Hardening @@ -178,7 +206,7 @@ Security Hardening ``cassini-security``. * **Build Modifier Config**: ``meta-cassini-config/kas/security.yml``. - This Cassini distribution image feature configures user accounts, packages, + This Cassini distribution feature configures user accounts, packages, remote access controls and other image features to provide extra security hardening for the Cassini distribution image. @@ -204,7 +232,7 @@ Software Development Kit (SDK) ``cassini-sdk``. * **Build Modifier Config**: ``meta-cassini-config/kas/cassini-sdk.yml`` - This Cassini distribution image feature: + This Cassini distribution feature: * Adds the Cassini Software Development Kit (SDK) which includes packages and image features to support on-target software development activities. diff --git a/documentation/developer_manual/validation.rst b/documentation/developer_manual/validation.rst index 24e8b774002b0b68038863a71b606e95ec3837c6..8190769d24fa68558781a9c8f3d0022a16e093a6 100644 --- a/documentation/developer_manual/validation.rst +++ b/documentation/developer_manual/validation.rst @@ -402,3 +402,46 @@ state where the first log-in will prompt the user for a new account password. If enabled then the environment clean operations will always be run, regardless of test-suite success or failure. + +Parsec simple end2end Tests +--------------------------- + +The Parsec simple end2end test suite is identified as: + + ``parsec-simple-e2e-tests`` + +for execution via ``ptest-runner`` or as a standalone BATS suite, as described +in :ref:`running_the_tests_label`. + +The test suite is built and installed in the image according to the following +BitBake recipe within +``meta-cassini-tests/recipes-tests/runtime-integration-tests/parsec-simple-e2e-tests.bb``. + +The test suite validates Parsec service in Cassini distribution image by +running simple end2end tests available in `parsec-tool `_. + +The tests can be customized via environment variables passed to the execution, +each prefixed by ``PS_`` to identify the variable as associated to the Parsec +simple end2end tests: + +| ``PS_TEST_LOG_DIR``: defines the location of the log file +| Default: ``/home/test/runtime-integration-tests-logs/`` +| Directory will be created if it does not exist +| See :ref:`test_logging_label` +| ``PS_TEST_CLEAN_ENV``: enable test environment clean-up +| Default: ``1`` (enabled) +| See :ref:`parsec_simple_end2end_tests_environment_clean-up_label` + +.. _parsec_simple_end2end_tests_environment_clean-up_label: + +Parsec Simple End2End Tests Environment Clean-Up +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +In addition, the clean-up operations will only occur if ``PS_TEST_CLEAN_ENV`` +is set to ``1`` (as is default). + +Currently, no clean-up is required as simple end2end tests script +``parsec-cli-tests.sh`` cleans up temporary files before exiting. + +If enabled then the environment clean operations will always be run, regardless +of test-suite success or failure. diff --git a/documentation/developer_manual/yocto_layers.rst b/documentation/developer_manual/yocto_layers.rst index 42b4bb8b03edb7ef55098b2d74e4942bee793f1c..5176fa2b04d9ee2ab187e73f3bf0a74accfdc726 100644 --- a/documentation/developer_manual/yocto_layers.rst +++ b/documentation/developer_manual/yocto_layers.rst @@ -37,7 +37,7 @@ Cassini project, which are further expanded on below. | -Cassini depends on the following layer dependency sources: +Cassini distribution depends on the following layer dependency sources: .. code-block:: yaml :substitutions: @@ -57,6 +57,11 @@ Cassini depends on the following layer dependency sources: branch: |meta-virtualization branch| revision: |meta-virtualization revision| + URL: https://git.yoctoproject.org/git/meta-security + layers: meta-parsec + branch: |meta-security branch| + revision: |meta-security revision| + An additional layer dependency source is conditionally required, depending on the specific Cassini distribution image being built. This layer dependency source is the ``meta-arm`` repository, which provides three Yocto layers: diff --git a/documentation/images/cassini_architecture.png b/documentation/images/cassini_architecture.png index b60b7572df8c2677878251d3c328afcf2214a5a4..7c20f345887a7634b0155b4713d2518e3b753a20 100644 Binary files a/documentation/images/cassini_architecture.png and b/documentation/images/cassini_architecture.png differ diff --git a/documentation/images/cassini_layers_deps.png b/documentation/images/cassini_layers_deps.png index 0b7e64a1d3e30862449f0762f1d567c136c71a89..c61e0cbcb688e431fc2164dcd64ea15d2fa228f1 100644 Binary files a/documentation/images/cassini_layers_deps.png and b/documentation/images/cassini_layers_deps.png differ diff --git a/documentation/introduction.rst b/documentation/introduction.rst index ed357115e9027858e90dc6e995f46fbfdf593fdd..9855caac8982aa83638151b29d7b7eb4631ec8bb 100644 --- a/documentation/introduction.rst +++ b/documentation/introduction.rst @@ -54,12 +54,12 @@ The different software layers are described below: This is the main component provided by the Cassini project. The Cassini filesystem contains tools and services that provide Cassini core - functionalities and facilitate deployment and orchestration of user - application workloads. These tools and services include the Docker - container engine, the K3s container orchestration framework, together with - their run-time dependencies. In addition, Cassini provides supporting - packages such as those which enable run-time validation tests or software - development capabilities on the target platform. + functionalities and facilitate secure deployment and orchestration of user + application workloads. These tools and services include the Parsec service, + the Docker container engine, the K3s container orchestration framework, + together with their run-time dependencies. In addition, Cassini provides + supporting packages such as those which enable run-time validation tests or + software development capabilities on the target platform. * **System software**: @@ -74,6 +74,7 @@ Cassini includes the following major features: * Container engine and runtime with Docker and runc-opencontainers. * Container workload orchestration with the K3s Kubernetes distribution. + * Parsec service and Parsec tool * On-target development support with optionally included Software Development Kit. * Validation support with optionally included run-time integration tests, and diff --git a/documentation/variables.py b/documentation/variables.py index a2973103cb30df8477e5dbb5c2e55482ff0e8a7b..0437edd5e623d594092bac62ade0e50a50c459ae 100644 --- a/documentation/variables.py +++ b/documentation/variables.py @@ -71,9 +71,11 @@ layer_definitions = { "poky branch": f"{yocto_release}", "meta-openembedded branch": f"{yocto_release}", "meta-virtualization branch": f"{yocto_release}", + "meta-security branch": f"{yocto_release}", "meta-arm branch": f"{yocto_release}", "poky revision": "453be4d258f71855205f45599eea04589eb4a369", "meta-virtualization revision": "2fae71cdf0e8c6f398f51219bdf31eac76c662ec", + "meta-security revision": "c79262a30bd385f5dbb009ef8704a1a01644528e", "meta-openembedded revision": "166ef8dbb14ad98b2094a77fcf352f6c63d5abf2", "meta-arm revision": "fc09cc0e8db287600625e64905170a6de24f2686", "layer dependency statement": f"The layer revisions are related to the Cassini ``{cassini_version}`` release.", diff --git a/meta-cassini-config/kas/include/cassini-base.yml b/meta-cassini-config/kas/include/cassini-base.yml index 132c7dea969ba7029584727f636fc2c204ade3ae..5c71e2cbe481c7f0554dfb44b15e6f4083db6eac 100644 --- a/meta-cassini-config/kas/include/cassini-base.yml +++ b/meta-cassini-config/kas/include/cassini-base.yml @@ -32,6 +32,16 @@ repos: meta-networking: meta-python: + meta-security: + url: https://git.yoctoproject.org/git/meta-security + path: layers/meta-security + layers: + meta-parsec: + + meta-clang: + url: https://github.com/kraj/meta-clang + path: layers/meta-clang + meta-virtualization: url: https://git.yoctoproject.org/git/meta-virtualization path: layers/meta-virtualization diff --git a/meta-cassini-distro/classes/cassini-distro-features.bbclass b/meta-cassini-distro/classes/cassini-distro-features.bbclass index aeb6ee3249a9c331f516fc890f0c4cb8ae3da812..89f1e12cc1a15388f65c53c850a58a05c1864988 100644 --- a/meta-cassini-distro/classes/cassini-distro-features.bbclass +++ b/meta-cassini-distro/classes/cassini-distro-features.bbclass @@ -5,14 +5,6 @@ # Used to apply to config for different features of the CASSINI distro, based on # the contents of DISTRO_FEATURES -# CASSINI_DISTRO_FEATURES is a list of available features. -CASSINI_DISTRO_FEATURES = " \ - cassini-devel \ - cassini-test \ - cassini-sdk \ - cassini-security \ - " - # Require inc file for development DISTRO_FEATURE require ${@bb.utils.contains(\ 'DISTRO_FEATURES','cassini-devel','conf/distro/include/cassini-devel.inc', '', d)} @@ -29,3 +21,8 @@ require ${@bb.utils.contains(\ require ${@bb.utils.contains(\ 'DISTRO_FEATURES','cassini-security',\ 'conf/distro/include/cassini-security.inc', '', d)} + +# Require inc file for PARSEC DISTRO_FEATURE +require ${@bb.utils.contains(\ +'DISTRO_FEATURES','cassini-parsec',\ +'conf/distro/include/cassini-parsec.inc', '', d)} diff --git a/meta-cassini-distro/conf/distro/cassini.conf b/meta-cassini-distro/conf/distro/cassini.conf index 9d2ee78377f9a2648689fc26ac4278c1b765a16a..ff956a02fa79719c029186d7eed06928719d9629 100644 --- a/meta-cassini-distro/conf/distro/cassini.conf +++ b/meta-cassini-distro/conf/distro/cassini.conf @@ -11,7 +11,7 @@ DISTRO_VERSION = "unstable" # systemd as the init system INIT_MANAGER = "systemd" -DISTRO_FEATURES:append = " virtualization ipv6 seccomp k3s" +DISTRO_FEATURES:append = " virtualization ipv6 seccomp k3s cassini-parsec" # Apply feature specific config USER_CLASSES:append = " cassini-distro-features" diff --git a/meta-cassini-distro/conf/distro/include/cassini-parsec.inc b/meta-cassini-distro/conf/distro/include/cassini-parsec.inc new file mode 100644 index 0000000000000000000000000000000000000000..ca3bc765e7891a6a026bb87572997215b15625fa --- /dev/null +++ b/meta-cassini-distro/conf/distro/include/cassini-parsec.inc @@ -0,0 +1,9 @@ +# Copyright (c) 2022 Arm Limited or its affiliates. All rights reserved. +# +# SPDX-License-Identifier: MIT + +# Config specifc to the cassini-parsec distro feature, enabled using +# DISTRO_FEATURES + +IMAGE_INSTALL:append = " parsec-service \ + parsec-tool" diff --git a/meta-cassini-distro/conf/distro/include/cassini-test.inc b/meta-cassini-distro/conf/distro/include/cassini-test.inc index 3345d8272889c3276d7d3c0191de779ed831bbd4..019e64deaa0e74a45521495093012f0fd7e54cb1 100644 --- a/meta-cassini-distro/conf/distro/include/cassini-test.inc +++ b/meta-cassini-distro/conf/distro/include/cassini-test.inc @@ -11,3 +11,6 @@ IMAGE_INSTALL:append = " jfrog-cli \ container-engine-integration-tests-ptest \ k3s-integration-tests-ptest \ user-accounts-integration-tests-ptest" + +IMAGE_INSTALL:append = "${@bb.utils.contains('DISTRO_FEATURES',\ + 'cassini-parsec', ' parsec-simple-e2e-tests-ptest', '', d)}" diff --git a/meta-cassini-distro/conf/layer.conf b/meta-cassini-distro/conf/layer.conf index 4f529e3dddbbfdc134bd63eda12ea2b35ddec038..18db1c892cf75515434fba80c695e413a62e391a 100644 --- a/meta-cassini-distro/conf/layer.conf +++ b/meta-cassini-distro/conf/layer.conf @@ -17,6 +17,9 @@ LAYERDEPENDS_meta-cassini-distro = " \ core \ yocto \ virtualization-layer \ + ${@bb.utils.contains('DISTRO_FEATURES', \ + 'cassini-parsec', \ + 'parsec-layer', '', d)} \ " LAYERSERIES_COMPAT_meta-cassini-distro = "kirkstone" diff --git a/meta-cassini-tests/recipes-tests/runtime-integration-tests/files/integration-tests-common-funcs.sh b/meta-cassini-tests/recipes-tests/runtime-integration-tests/files/integration-tests-common-funcs.sh index 2efa90e79df3e83ca4030bcf54144b42598a5beb..d9ad97357267d225d0f3bb4d363c7e8a7d1a666d 100644 --- a/meta-cassini-tests/recipes-tests/runtime-integration-tests/files/integration-tests-common-funcs.sh +++ b/meta-cassini-tests/recipes-tests/runtime-integration-tests/files/integration-tests-common-funcs.sh @@ -28,6 +28,13 @@ log() { timestamp=$(date "+%Y-%m-%d %H:%M:%S") + if [ "${1}" == "PASS" ]; then + for line in "${lines[@]}" + do + echo "${timestamp} OUTPUT:$line" | sudo -n tee -a "${TEST_LOG_FILE}" + done + fi + log_msg="${timestamp} ${1}:${BATS_TEST_NAME}" if [ -n "${2}" ]; then log_msg="${log_msg}:${*:2}" diff --git a/meta-cassini-tests/recipes-tests/runtime-integration-tests/parsec-simple-e2e-tests.bb b/meta-cassini-tests/recipes-tests/runtime-integration-tests/parsec-simple-e2e-tests.bb new file mode 100644 index 0000000000000000000000000000000000000000..e9f124042fe3ae80ad9b8b5d960939592ffcf7ce --- /dev/null +++ b/meta-cassini-tests/recipes-tests/runtime-integration-tests/parsec-simple-e2e-tests.bb @@ -0,0 +1,19 @@ +# Copyright (c) 2022 Arm Limited or its affiliates. All rights reserved. +# +# SPDX-License-Identifier: MIT + +SUMMARY = "PARSEC simple e2e tests." +DESCRIPTION = "Simple End to end tests for PARSEC service. \ + Tests may be run standalone via \ + run-parsec-simple-e2e-tests, or via the ptest \ + framework using ptest-runner." + +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" + +TEST_FILES = " \ + file://parsec-simple-e2e-tests.bats \ + " + +inherit runtime-integration-tests +require runtime-integration-tests.inc diff --git a/meta-cassini-tests/recipes-tests/runtime-integration-tests/parsec-simple-e2e-tests/parsec-simple-e2e-tests.bats b/meta-cassini-tests/recipes-tests/runtime-integration-tests/parsec-simple-e2e-tests/parsec-simple-e2e-tests.bats new file mode 100644 index 0000000000000000000000000000000000000000..13b46ce0514347fee4be168ac4719f40cd1e1dcd --- /dev/null +++ b/meta-cassini-tests/recipes-tests/runtime-integration-tests/parsec-simple-e2e-tests/parsec-simple-e2e-tests.bats @@ -0,0 +1,40 @@ +#!/usr/bin/env bats +# +# Copyright (c) 2022 Arm Limited or its affiliates. All rights reserved. +# +# SPDX-License-Identifier: MIT + +# Run-time validation tests for PARSEC service in Cassini stack. + +# Set generic configuration + +if [ -z "${PS_TEST_LOG_DIR}" ]; then + TEST_LOG_DIR="${HOME}/runtime-integration-tests-logs" +else + TEST_LOG_DIR="${PS_TEST_LOG_DIR}" +fi + +export TEST_LOG_FILE="${TEST_LOG_DIR}/parsec-simple-e2e-tests.log" +export TEST_STDERR_FILE="${TEST_LOG_DIR}/ps-stderr.log" +export TEST_RUN_FILE="${TEST_RUNTIME_DIR}/parsec-simple-e2e-tests.pgid" + +export TEST_CLEAN_ENV="${PS_TEST_CLEAN_ENV:=1}" + +load "${TEST_COMMON_DIR}/integration-tests-common-funcs.sh" + +# There are no base clean-up activities required +# Function is defined and called so that it can be conditionally overridden +clean_test_environment() { + : +} + +@test 'simple end to end tests for PARSEC service' { + + _run /usr/bin/parsec-cli-tests.sh + if [ "${status}" -ne 0 ]; then + log "FAIL" + return 1 + else + log "PASS" + fi +}