metadata:
    format: Lava-Test Test Definition 1.0
    name: pkcs11-tests
    description: "Basic test suite for pkcs11 operations.
    The main motivation behind the tests is checking the interaction
    with SE05x TPM devices. Tests can also be used with softhsm if
    TPM is not available

    Example use with TPM:
        ./pkcs11.sh -p 'pkcs11-tool --module /usr/lib/libckteec.so.0.1'

    Example use with softhsm:
        ./pkcs11.sh -p 'pkcs11-tool --module /usr/lib/softhsm/libsofthsm2.so' -t false

    ssscli tool comes from NXP and is not packaged for any distribution
    at the moment. It needs to be preinstalled in the OS in order to use
    SE05x TPM for this test.
    "
    maintainer:
        - milosz.wasilewski@foundries.io
    os:
        - debian
        - ubuntu
        - centos
        - fedora
        - openembedded
    scope:
        - functional
    devices:
        - imx8mm
        - imx6ull

params:
    SKIP_INSTALL: "True"
    PTOOL: "pkcs11-tool --module /usr/lib/libckteec.so.0.1.0"
    USE_SE05X: "True"
    EXECUTE_LOOP: "True"
    SE05X_TOOL: "ssscli"
    OTA: "False"
    OTA_ACTION: "sign"
    OTA_DIRECTORY: "/home"

run:
    steps:
        - cd ./automated/linux/pkcs11/
        - ./pkcs11.sh -s "${SKIP_INSTALL}" -t "${USE_SE05X}" -p "${PTOOL}" -l "${EXECUTE_LOOP}" -c "${SE05X_TOOL}" -o "${OTA}" -a "${OTA_ACTION}" -d "${OTA_DIRECTORY}"
        - ../../utils/send-to-lava.sh ./output/result.txt
