In this project, a dedicated test version of a Samba server is built to execute the tests.
The tests are carried out by running the run-tests.py
script,
which systematically executes the smbtorture utility.
This utility, included in the samba-testsuite
package,
offers a comprehensive suite of tests that are specifically designed to evaluate Samba server implementations.
The tests.py
script is used for parsing test results.
NetInit
—Program that initializes the network interfaceen0
Smbd
—Samba server ported to KasperskyOSVfsNet
—Program that is used for working with the networkDhcpcd
—DHCP client implementation program that gets network interface parameters from an external DHCP server in the background and passes them to the virtual file systemVfsRamFs
—Program that supports RamFS file systemDNetSrv
—Driver for working with network cardsEntropyEntity
—Random number generatorRAMDisk
—Block device driver of a virtual drive in RAMBcm2711MboxArmToVc
—Mailbox driver for Raspberry Pi 4 B
Statically created IPC channels
netinit.NetInit
→kl.VfsNet
netinit.NetInit
→kl.VfsRamFs
samba.Smbd
→kl.VfsNet
samba.Smbd
→kl.VfsRamFs
kl.VfsNet
→kl.EntropyEntity
kl.VfsNet
→kl.drivers.DNetSrv
kl.rump.Dhcpcd
→kl.VfsNet
kl.rump.Dhcpcd
→kl.VfsRamFs
kl.VfsRamFs
→kl.drivers.RAMDisk
kl.VfsRamFs
→kl.EntropyEntity
kl.drivers.DNetSrv
→kl.drivers.Bcm2711MboxArmToVc
The ./einit/src/init.yaml.in
template is used to automatically generate part of the solution initialization
description file init.yaml
. For more information about the init.yaml.in
template file, see the
KasperskyOS Community Edition Online Help.
The ./einit/src/security.psl
file contains part of a solution security policy description.
For more information about the security.psl
file, see
Describing a security policy for a KasperskyOS-based solution.
- To install KasperskyOS Community Edition SDK and run tests on QEMU, make sure you meet all the System requirements listed in the KasperskyOS Community Edition Developer's Guide.
- Make sure you have at least Python 3 version 3.10.0 installed. To install the latest version of
Python 3, run the following command:
$ sudo apt-get install python3
- Install all dependencies from the ./st/requirements.txt file.
pip3 install -r ./st/requirements.txt
- To install the
smbtorture
utility, run the following command:$ sudo apt-get install samba-testsuite
The Samba server in KasperskyOS is built using the CMake build system, which is provided in the KasperskyOS Community Edition SDK.
To build and run the Samba server in KasperskyOS, run the following command in this directory:
$ SDK_PREFIX=/opt/KasperskyOS-Community-Edition-<version> ./cross-build.sh
where the SDK_PREFIX
environment variable specifies the path to the installed version of the KasperskyOS Community Edition SDK.
The value of this environment variable must be set.
The cross-build.sh
script both builds the Samba server on QEMU and runs it.
./einit/CMakeLists.txt—CMake commands for building the Einit
program and the solution image.
./netinit/CMakeLists.txt—CMake commands for building the NetInit
program.
./CMakeLists.txt—CMake commands for building the solution.
-
Build and run the test version of the Samba server in KasperskyOS.
-
Wait until the following message appears in the standard output:
KOS: skipping start_epmd KOS: skipping start_lsasd KOS: skipping start_fssd
-
Go to the
./st
directory. In this directory is located the scriptrun-tests.py
, developed for easy testing of KasperskyOS-implementation of the Samba server and output of results tests. Syntax for using therun-tests.py
script:python3 ./run-tests.py [-h ADDRESS] [-f FILE]
where:
-h ADDRESS
Host address where the Samba server is running. If not specified, the default address
//127.0.0.0.1
will be used.-f FILE
Full path to the file containing the list of tests implemented in the
smbtorture
utility. If not specified, the default valuetests.txt
will be used. You can modify the list of tests in the filetests.txt
Once the script is run, a sequential test run will begin. Test results and general statistics will be displayed in the standard output. You can redirect the output of the results to a file.
-
Run the
run-tests.py
script from a separate terminal window:python3 ./run-tests.py -h 127.0.0.1 -f tests.txt > tests_results.txt
This command will run the tests listed in the
tests.txt
file. The results of the tests will be written to thetests_results.txt
file. -
If the provided statistics are insufficient, you have the option to utilize the script named
tests.py
for parsing test results. This script provides more detailed information about the tests and allows for the comparison of test results across various versions of the KasperskyOS Community Edition SDK. To work, thetests.py
script needs thetests_results.txt
file with the test run results generated at the previous step. Stay in the./st
directory and perform the actions you require:- To get detailed statistics about the tests, run the following command:
The statistics should be displayed in the standard output with division into test groups. The following characteristics are displayed for each group:
python3 ./tests.py stat tests_results.txt
- total number of tests (TOTAL)
- number of successful tests (PASS)
- number of skipped tests (SKIP)
- number of failed tests (FAIL)
- percentage of successful tests = PASS / (TOTAL - SKIP) * 100 (%)
- To get a list of tests that completed with the specified result, run the following command:
The list of tests whose execution result is equal to the value passed in the script parameter (
python3 ./tests.py filter <PASS|SKIP|FAIL> tests_results.txt
PASS
,SKIP
orFAIL
) should be displayed in the standard output. - To compare the test results in two files, run the following command:
In this command,
python3 ./tests.py diff <file1> <file2>
file1
andfile2
are the names of files containing the test execution results generated on different runs. The list of tests whose results infile2
are different from the results infile1
should be displayed in the standard output.
- To get detailed statistics about the tests, run the following command: