forked from bmw-software-engineering/lobster
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
255 lines (214 loc) · 8.55 KB
/
Makefile
File metadata and controls
255 lines (214 loc) · 8.55 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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
SYSTEM_PYTHONPATH:=$(PYTHONPATH)
export LOBSTER_ROOT=$(PWD)
export PYTHONPATH=$(LOBSTER_ROOT)
export PATH:=$(LOBSTER_ROOT):$(PATH)
ASSETS=$(wildcard assets/*.svg)
TOOL_FOLDERS := $(shell find ./lobster/tools -mindepth 1 -maxdepth 2 -type d | grep -v -E '^./lobster/tools/core$$|__pycache__|parser' | sed 's|^./lobster/tools/||; s|/|-|g')
.PHONY: packages docs
lobster/html/assets.py: $(ASSETS) util/mkassets.py
util/mkassets.py lobster/html/assets.py $(ASSETS)
lint: style
@PYTHONPATH=$(SYSTEM_PYTHONPATH) \
python3 -m pylint --rcfile=pylint3.cfg \
--reports=no \
--ignore=assets.py \
lobster util
lint-system-tests: style
@PYTHONPATH=$(SYSTEM_PYTHONPATH) \
python3 -m pylint --rcfile=tests_system/pylint3.cfg \
--reports=no \
tests_system/system_test_case_base.py \
tests_system/asserter.py \
tests_system/lobster_json \
tests_system/lobster_meta_data_tool_base \
tests_system/lobster_online_report \
tests_system/lobster_online_report_nogit \
tests_system/lobster_report
lint-unit-tests: style
@PYTHONPATH=$(SYSTEM_PYTHONPATH) \
python3 -m pylint --rcfile=tests_unit/pylint3.cfg \
--reports=no \
tests_unit
trlc:
trlc lobster --error-on-warnings --verify
style:
@python3 -m pycodestyle lobster tests_system \
--exclude=assets.py
clean-packages:
git clean -xdf packages test_install test_install_monolithic test_install_monolithic_venv
packages: clean-packages
make lobster/html/assets.py
make -C packages/lobster-core
make -C packages/lobster-tool-trlc
make -C packages/lobster-tool-codebeamer
make -C packages/lobster-tool-cpp
make -C packages/lobster-tool-cpptest
make -C packages/lobster-tool-gtest
make -C packages/lobster-tool-json
make -C packages/lobster-tool-python
make -C packages/lobster-metapackage
make -C packages/lobster-monolithic
PYTHONPATH= \
pip3 install --prefix test_install \
packages/*/dist/*.whl
PYTHONPATH= \
pip3 install --prefix test_install_monolithic \
packages/lobster-monolithic/meta_dist/*.whl
diff -Naur test_install/lib/python*/site-packages/lobster test_install_monolithic/lib/python*/site-packages/lobster -x "*.pyc"
diff -Naur test_install/bin test_install_monolithic/bin
# Very basic smoke test to ensure the tools are packaged properly
python3 -m venv test_install_monolithic_venv
. test_install_monolithic_venv/bin/activate && \
pip install --upgrade pip && \
pip install packages/lobster-monolithic/meta_dist/*.whl && \
lobster-report --version && \
lobster-ci-report --version && \
lobster-html-report --version && \
lobster-online-report --version && \
lobster-online-report-nogit --version && \
lobster-cpp --version && \
lobster-cpptest --version && \
lobster-codebeamer --version && \
lobster-gtest --version && \
lobster-json --version && \
lobster-python --version && \
lobster-trlc --version
clang-tidy:
cd .. && \
git clone https://github.com/bmw-software-engineering/llvm-project && \
cd llvm-project && \
cmake -S llvm -B build -G Ninja -DLLVM_ENABLE_PROJECTS='clang;clang-tools-extra' -DCMAKE_BUILD_TYPE=Release && \
cmake --build build --target clang-tidy
integration-tests: packages
(cd tests_integration/projects/basic; make)
(cd tests_integration/projects/coverage; make)
(cd tests_integration/projects/coverage_half; make)
(cd tests_integration/projects/coverage_mix; make)
(cd tests_integration/projects/coverage_zero; make)
(cd tests_integration/projects/cpp_focus; make)
rm -f MODULE.bazel MODULE.bazel.lock
codebeamer-pem:
@echo "🔐 Generating cert.pem and key.pem for codebeamer system tests..."
@mkdir -p tests_system/lobster_codebeamer/data/ssl
@openssl req -x509 -newkey rsa:2048 -nodes \
-keyout tests_system/lobster_codebeamer/data/ssl/key.pem \
-out tests_system/lobster_codebeamer/data/ssl/cert.pem \
-days 365 -subj "//CN=localhost" > /dev/null 2>&1
system-tests: codebeamer-pem
mkdir -p docs
python -m unittest discover -s tests_system -v -t .
make -B -C tests_system TOOL=lobster-python
@echo "🧹 Cleaning up cert.pem and key.pem..."
@rm -rf tests_system/lobster_codebeamer/data/ssl
unit-tests:
coverage run -p \
--branch --rcfile=coverage.cfg \
--data-file .coverage.unit \
--source=lobster \
-m unittest discover -s tests_unit -v
upload-main: packages
python3 -m twine upload --repository pypi packages/*/dist/*
python3 -m twine upload --repository pypi packages/*/meta_dist/*
remove-dev:
python3 -m util.release
github-release:
git push
python3 -m util.github_release
bump:
python3 -m util.bump_version_post_release
full-release:
make remove-dev
git push
make github-release
make bump
git push
# --- Coverage Execution Targets ---
coverage-unit:
@echo "📊 Generating coverage report for unit tests..."
coverage combine -q .coverage.unit*
coverage html --directory=htmlcov-unit --rcfile=coverage.cfg
coverage report --rcfile=coverage.cfg --fail-under=39
coverage-system:
@echo "📊 Generating coverage report for system tests..."
coverage combine -q .coverage.system*
coverage html --directory=htmlcov-system --rcfile=coverage.cfg
coverage report --rcfile=coverage.cfg --fail-under=62
# --- Clean Coverage ---
clean-coverage:
@rm -rf htmlcov htmlcov-unit htmlcov-system
@find . -type f -name ".coverage*" -delete
@find . -type f -name "*.pyc" -delete
@echo "🧹 All .coverage, .coverage.* and *.pyc files deleted."
# --- Convenience Test Targets ---
test-system: clean-coverage system-tests
make coverage-system
util/check_local_modifications.sh
test-unit: clean-coverage unit-tests
make coverage-unit
util/check_local_modifications.sh
docs:
mkdir -p docs
@-make tracing
@-make tracing-stf
clean-docs:
rm -rf docs
tracing:
@mkdir -p docs
@make lobster/html/assets.py
@for tool in $(TOOL_FOLDERS); do \
make tracing-tools-$$tool; \
done
tracing-tools-%: tracing-%
@echo "Finished processing tool: $*"
tracing-%: report.lobster-%
$(eval TOOL_PATH := $(subst -,_,$*))
lobster-html-report report.lobster --out=docs/tracing-$(TOOL_PATH).html
lobster-ci-report report.lobster
report.lobster-%: lobster/tools/lobster.conf \
code.lobster-% \
unit-tests.lobster-% \
system_requirements.lobster-% \
software_requirements.lobster-% \
system-tests.lobster-%
lobster-report \
--lobster-config=lobster/tools/lobster.conf \
--out=report.lobster
lobster-online-report report.lobster
system_requirements.lobster-%: TRLC_CONFIG = lobster/tools/lobster-trlc-system.conf
system_requirements.lobster-%:
$(eval TOOL_PATH := $(subst -,/,$*))
@echo "inputs: ['lobster/tools/requirements.rsl', 'lobster/tools/$(TOOL_PATH)']" > lobster/tools/config.yaml
@echo "trlc_config_file: $(TRLC_CONFIG)" >> lobster/tools/config.yaml
lobster-trlc --config=lobster/tools/config.yaml \
--out=system_requirements.lobster
rm lobster/tools/config.yaml
software_requirements.lobster-%: TRLC_CONFIG = lobster/tools/lobster-trlc-software.conf
software_requirements.lobster-%:
$(eval TOOL_PATH := $(subst -,/,$*))
@echo "inputs: ['lobster/tools/requirements.rsl', 'lobster/tools/$(TOOL_PATH)']" > lobster/tools/config.yaml
@echo "trlc_config_file: $(TRLC_CONFIG)" >> lobster/tools/config.yaml
lobster-trlc --config=lobster/tools/config.yaml \
--out=software_requirements.lobster
rm lobster/tools/config.yaml
code.lobster-%:
$(eval TOOL_PATH := $(subst -,/,$*))
lobster-python --out code.lobster lobster/tools/$(TOOL_PATH)
unit-tests.lobster-%:
$(eval TOOL_NAME := $(subst _,-,$(notdir $(TOOL_PATH))))
lobster-python --activity --out unit-tests.lobster tests_unit/lobster-$(TOOL_NAME)
system-tests.lobster-%:
$(eval TOOL_NAME := $(subst _,-,$(notdir $(TOOL_PATH))))
lobster-python --activity --out=system-tests.lobster tests_system/lobster-$(TOOL_NAME)
# STF is short for System Test Framework
STF_TRLC_FILES := $(wildcard tests_system/*.trlc)
STF_PYTHON_FILES := $(filter-out tests_system/test_%.py tests_system/run_tool_tests.py, $(wildcard tests_system/*.py))
# This target is used to generate the LOBSTER report for the requirements of the system test framework itself.
tracing-stf: $(STF_TRLC_FILES)
lobster-trlc --config=lobster/tools/lobster-trlc-system-stf.yaml --out=stf_system_requirements.lobster
lobster-trlc --config=lobster/tools/lobster-trlc-software-stf.yaml --out=stf_software_requirements.lobster
lobster-python --out=stf_code.lobster --only-tagged-functions $(STF_PYTHON_FILES)
lobster-report --lobster-config=tests_system/stf-lobster.conf --out=stf_report.lobster
lobster-online-report stf_report.lobster
lobster-html-report stf_report.lobster --out=docs/tracing-stf.html
@echo "Deleting STF *.lobster files..."
rm -f stf_system_requirements.lobster stf_software_requirements.lobster stf_code.lobster stf_report.lobster