forked from siemens/cmp-test-suite
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
134 lines (112 loc) · 6.82 KB
/
Copy pathMakefile
File metadata and controls
134 lines (112 loc) · 6.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# SPDX-FileCopyrightText: Copyright 2024 Siemens AG
#
# SPDX-License-Identifier: Apache-2.0
help:
@echo 'Commands:'
@echo ' test - Run all compliance tests (results will be in reports/)'
@echo ' test-verbose - Run all compliance tests, including verbose tests (results will be in reports/)'
@echo ' test-pq-hybrid - Run all PQ and Hybrid compliance tests (results will be in reports/)'
@echo ' test-pq-hybrid-verbose - Run all PQ and Hybrid compliance tests, including verbose tests (results will be in reports/)'
@echo ' teslog - Run all compliance tests, store results in timestamped subirectories in reports/'
@echo ' docs - Produce documentation files and store them in doc/'
@echo ' unittest - Run unit tests for the test suite itself '
@echo ' unittest-docker - Run unit tests in a docker container'
@echo ' build-unittest - Build the unittest docker image'
@echo ' dryrun - Test whether all CMP tests can be loaded without errors, but it does not execute them'
@echo ' autoformat - Run ruff on all the source files, to resolve all issues automatically '
@echo ' verify - Run a bunch of checks, to see if there are any obvious deficiencies in the code '
@echo ' verifyformat - Check formatting only '
@echo ' show-outdated - Show outdated packages (depth 1)'
@echo ' start-mock-ca - Start the mock CA server, so that it can listens to requests '
@echo ' test-mock-ca - Run the test against the mock CA server '
@echo ' test-mock-ca-verbose - Run all tests against the mock CA server '
@echo ''
# By default, run the tests against the local environment from config/local.robot
# You can override it, e.g., `make test env=cloudpki`
env ?= cloudpki
test: check_ejbca
# Run the compliance tests, using the environment specified by the `env` variable.
# The results will be stored in the reports/ directory.
# Per default will only run the tests that are not marked as verbose-tests.
robot --pythonpath=./ --exclude verbose-tests --outputdir=reports --variable environment:$(env) tests
test-verbose:
# Run the compliance tests, using the environment specified by the `env` variable.
# The results will be stored in the reports/ directory.
# This will run all tests, including those marked as verbose-tests.
# To ensure compliance in deepth, you can run this command.
robot --pythonpath=./ --outputdir=reports --variable environment:$(env) tests
# As above, but keep the results in timestamped subdirectories, so they keep accumulating. This is useful because you
# won't overwrite test reports from previous runs, which may contain interesting information about exotic errors you
# encountered.
testlog:
robot --pythonpath=./ --exclude verbose-tests --outputdir=reports/`date +%Y-%m-%d_%H-%M_%B-%d` --variable environment:$(env) tests
DOCKERFILE_UNITTEST = data/dockerfiles/Dockerfile.base
build-unittest:
@echo "Building unittest Docker image..."
docker build -t unittest-image -f $(DOCKERFILE_UNITTEST) .
unittest-docker: build-unittest
@echo "Running unittest Docker container..."
docker run --rm -v $(shell pwd):/app -w /app unittest-image \
python3 -m unittest discover -s unit_tests
unittest:
# adjust path such that the unit tests can be started from the root directory, to make it easier to load
# example files from data/
PYTHONPATH=./resources python -m unittest discover -s unit_tests
# On Windows Powershell: `$env:PYTHONPATH = "./resources"; python -m unittest discover -s unit_tests`
check_ejbca:
ifeq ($(env), ejbca)
$(MAKE) -f Makefile_EJBCA start_EJBCA
endif
docs:
python -m robot.libdoc --pythonpath=./ resources/keywords.resource doc/keywords.html
python -m robot.libdoc --pythonpath=./ resources/cryptoutils.py doc/cryptoutils.html
python -m robot.libdoc --pythonpath=./ resources/cmputils.py doc/cmputils.html
python -m robot.libdoc --pythonpath=./ resources/asn1utils.py doc/asn1utils.html
python -m robot.libdoc --pythonpath=./ resources/httputils.py doc/httputils.html
python -m robot.libdoc --pythonpath=./ resources/keyutils.py doc/keyutils.html
python -m robot.libdoc --pythonpath=./ resources/protectionutils.py doc/protectionutils.html
python -m robot.libdoc --pythonpath=./ resources/compareutils.py doc/compareutils.html
python -m robot.libdoc --pythonpath=./ resources/general_msg_utils.py doc/general_msg_utils.html
python -m robot.libdoc --pythonpath=./ resources/cert_related_utils.py doc/cert_related_utils.html
python -m robot.libdoc --pythonpath=./ resources/ca_kga_logic.py doc/ca_kga_logic.html
python -m robot.libdoc --pythonpath=./ resources/envdatautils.py doc/envdatautils.html
python -m robot.libdoc --pythonpath=./ resources/extra_issuing_logic.py doc/extra_issuing_logic.html
python -m robot.libdoc --pythonpath=./ resources/ca_ra_utils.py doc/ca_ra_utils.html
python -m robot.libdoc --pythonpath=./ pq_logic/hybrid_prepare.py doc/hybrid_prepare.html
python -m robot.libdoc --pythonpath=./ pq_logic/pq_verify_logic.py doc/pq_verify_logic.html
# Test documentation
python -m robot.testdoc tests/ doc/test-suites.html
python -m robot.testdoc tests_pq_and_hybrid/ doc/test-pq-hybrid-suites.html
python -m robot.testdoc tests_mock_ca/ doc/test-mock-ca.html
autoformat:
ruff check --fix .
verify:
reuse lint
ruff check .
pylint . --ignore-paths="^venv"
PYTHONPATH=./resources pyright
# on Windows Powershell: `$env:PYTHONPATH = "./resources"; pyright`
codespell . --check-filenames --skip *.html,*.pem,*.xml,*venv*,*fips/*.py,*/announcement.py,./data/rfc_test_vectors/*,./liboqs-python/*,./liboqs-python-stateful-sig/*
verifyformat:
ruff check .
show-outdated:
uv tree --outdated --depth 1
dryrun:
robot --dryrun --pythonpath=./ --variable environment:$(env) tests tests_pq_and_hybrid tests_mock_ca
test-pq-hybrid:
# Start the tests for PQ and Hybrid algorithms/mechanisms.
robot --pythonpath=./ --exclude verbose-tests --outputdir=reports --variable environment:$(env) tests_pq_and_hybrid
test-pq-hybrid-verbose:
# Start the tests for PQ and Hybrid algorithms/mechanisms.
robot --pythonpath=./ --exclude "composite-kemANDfrodokem" --outputdir=reports --variable environment:$(env) tests_pq_and_hybrid
start-mock-ca:
python ./mock_ca/ca_handler.py
test-mock-ca:
# exclude resource-intensive for faster execution.
# robot --exclude resource-intensive --pythonpath=./ --outputdir=reports --variable environment:mock_ca tests/lwcmp.robot
robot --pythonpath=./ --exclude verbose-tests --outputdir=reports --variable environment:mock_ca tests tests_mock_ca tests_pq_and_hybrid
test-mock-ca-verbose:
# Run the compliance tests, using the environment specified by the `env` variable.
# The results will be stored in the reports/ directory.
# This will run all tests, including those marked as verbose-tests.
robot --pythonpath=./ --outputdir=reports --variable environment:mock_ca tests tests_mock_ca tests_pq_and_hybrid