The extension automatically detects a KasperskyOS project in the open workspace and starts. The detection parameter is the presence of the .vscode/kos_project.json file or einit directory in the workspace. If the extension has not automatically activated in the directory but you are certain that it is a KasperskyOS project, run the command KOS: Activate extension in this directory. This command activates the extension and creates an empty .vscode/kos_project.json file in the project directory. To cancel manual activation, delete this file.
After startup, the extension adds the following buttons to the lower panel of the Visual Studio Code editor:
– select the build target.
– start the project in QEMU.
– start the selected target with debugging.
– build all targets.
– build the selected target.
– clear the build directory.
– switch the build type.
– enable/disable the project build with tests.
– select the target platform for the build.
– select the device or QEMU emulator.
– display the SDK version.Functions that provide buttons can also be called from the command line of the code editor, which can be opened by pressing F1. All commands have the KOS: prefix.
Working with a basic KasperskyOS image
The extension lets you avoid having to completely build a KasperskyOS-based solution after making changes to application code. Instead, you can use the following scenario:
CMake commands of the kpa library to pack a program into a KPA package.Create a basic solution security policy description
The extension lets you automatically create basic solution security policy descriptions for a project.
To create a basic security policy description:
KOS: Generate policy file for current project.Grant all permissions: create a basic solution security policy description that allows all interactions between different processes of any class and between these processes and the KasperskyOS kernel, and that also allows any process to initialize the startup of processes.Grant necessary permissions: create a basic solution security policy description that allows all interactions between different processes of any class and between these processes and the KasperskyOS kernel, and that also determines the necessary permissions for initializing the startup of processes based on the init.yaml.in file within the project.These policies can be used only as stubs during the early stages of development of a KasperskyOS-based solution so that the Kaspersky Security Module does not interfere with interactions. It would be unacceptable to apply such policies in a real-world KasperskyOS-based solution.
Running tests
After the extension is activated, the Testing tab (
) appears on the side panel of Visual Studio Code. When you select the Testing tab, the code editor window displays a tree of tests created using the Google Test library and found in files in the test/ directory.
To run the tests, tap the
button. All detected tests are run by default. However, you can select specific tests on the tabs containing the source code of the tests, or you can select specific groups of tests by selecting them from the tree of all tests. You can only run tests that are added to CMakeLists.txt files for building programs using the kl_kos_add_small_test() or generate_kos_test() CMake commands from the TestGenerator CMake library included in the SDK.
The test results and log files are located in the directory <build_directory>/bin/tests/output.
Starting solution security policy tests
The extension lets you run solution security policy tests for a project if they were created based on the solution security policy description.
To build and run solution security policy tests:
CMake commands for building solution security policy tests have been added to one of the CMakeLists.txt files of the project.
button in the lower panel.
and select the target named kos-qemu-image-PalTest<N>-sim (N refers to the PSL file index within the list of PSL files containing solution security policy tests).
button to build the selected target.