add_kss_pal_qemu_tests()

Before reading this section, you are advised to familiarize yourself with the general principles of creating and testing a security policy for a KasperskyOS-based solution.

This section describes the add_kss_pal_qemu_tests() function of the CMake library test_generator:

Function syntax

This function is declared in a file located in KasperskyOS Community Edition at the following path: toolchain/share/cmake/Modules/test-generator/add_kss_pal_qemu_tests.cmake. The file is available only in the distribution package of KasperskyOS Community Edition for QEMU.

add_kss_pal_qemu_tests(...)

This function generates the Einit initializing program and other artifacts required for building and running a PAL test (also a test in the PAL language) of a security policy for a KasperskyOS-based solution.

Function parameters

Artifacts generated by the function

The add_kss_pal_qemu_tests() function generates the artifacts required for building and running a PAL test in KasperskyOS. Artifacts are generated in the following directories:

The following artifacts are generated in the solution build directory:

In the program build directory:

Building and running the PAL test

The process of building and running a PAL test is described in step 4 of the test procedure in the section titled Creating and performing tests for a KasperskyOS-based solution security policy.

You can also build and run PAL tests using the KasperskyOS SDK Extension for Visual Studio Code. For more details, please refer to the Extension functions section that describes how to run tests of solution security policies.

Example

# Minimum required version of the CMake build system for the project.

cmake_minimum_required (VERSION 3.25)

# Name of the CMake project.

project (pal_tests)

# Connect the CMake library named platform.

include (platform)

# Statically link executable files.

initialize_platform (FORCE_STATIC)

# Include the CMake library containing the solution image build scripts.

include (platform/image)

# Include the CMake library named nk for working with the NK compiler (nk-gen-c).

include (platform/nk)

# Connect the test_generator CMake library module add_kss_pal_qemu_tests to the project.

include (test-generator/add_kss_pal_qemu_tests)

# Create a CMake target for generating an .idl.h file

# for the specified IDL file by using the NK compiler.

nk_build_idl_files (${PROJECT_NAME}_idl_files

NK_MODULE pal_tests

IDL "${NK_RESOURCES}/pal_tests/${IDL_FILE}")

# Create a CMake target for generating an .edl.h file

# for the specified EDL file by using the NK compiler.

nk_build_edl_files (${PROJECT_NAME}_edl_files

DEPENDS ${PROJECT_NAME}_idl_files

NK_MODULE pal_tests

EDL "${NK_RESOURCES}/pal_tests/${EDL_FILE})

add_kss_pal_qemu_tests (

PSL_FILES

src/security.psl

DEPENDS

${PROJECT_NAME}_edl_files)

For more details, see the pal_tests example located in examples directory, in the KasperskyOS Community Edition.

Page top