-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathMakefile
More file actions
283 lines (242 loc) · 9.89 KB
/
Makefile
File metadata and controls
283 lines (242 loc) · 9.89 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
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
SYSTEM_PYTHONPATH:=$(PYTHONPATH)
export LOBSTER_ROOT=$(PWD)
export PYTHONPATH=$(LOBSTER_ROOT)
export PATH:=$(LOBSTER_ROOT):$(PATH)
TOOL_FOLDERS := $(shell \
(find ./lobster/tools -mindepth 1 -maxdepth 1 -type d \
| grep -v -E '__pycache__|parser|core$$' \
| sed 's|^./lobster/tools/||'; \
find ./lobster/tools/core -mindepth 1 -maxdepth 1 -type d 2>/dev/null \
| grep -v -E '__pycache__' \
| sed 's|^./lobster/tools/core/|core-|') \
| sort)
.PHONY: packages docs tracing
lint: style
@PYTHONPATH=$(SYSTEM_PYTHONPATH) \
python3 -m pylint --rcfile=pylint3.cfg \
--reports=no \
--ignore=assets.py,html_report_js.py \
lobster util
lint-system-tests: style
@PYTHONPATH=$(SYSTEM_PYTHONPATH) \
python3 -m pylint --rcfile=tests_system/pylint3.cfg \
--reports=no \
tests_system/asserter.py \
tests_system/lobster_gtest \
tests_system/lobster_html_report \
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_pkg \
tests_system/lobster_report \
tests_system/lobster_trlc \
tests_system/system_test_case_base.py
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,html_report_js.py
clean-packages:
git clean -xdf packages test_install test_install_monolithic test_install_monolithic_venv
packages: clean-packages
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" -x "*pkg*" -x "pkg/*"
diff -Naur test_install/bin test_install_monolithic/bin -x "*pkg*" -x "pkg/*"
# 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 && \
lobster-pkg --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)
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
coverage run -p \
--branch --rcfile=coverage.cfg \
--data-file .coverage.system \
--source=lobster \
-m unittest discover -s tests_system -v -t .
@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
remove-dev:
python3 -m util.release
bump:
python3 -m util.bump_version_post_release
# steps for a release:
# - create new branch
# - make remove-dev
# - review CHANGELOG.md (is it complete, or is something missing?)
# - git push + create pull request
#
# - create new branch
# - make bump
# - git push + create pull request
# --- 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=48
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=74
# --- 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
test-unit: clean-coverage unit-tests
make coverage-unit
docs:
mkdir -p docs/api_documentation
@-make tracing
@-make tracing-stf
@-./tracing/tracing.sh
@sphinx-build -c sphinx -b html . docs/api_documentation
clean-docs:
rm -rf docs
tracing:
@mkdir -p docs
@for tool in $(TOOL_FOLDERS); do \
echo "Processing tool: $$tool"; \
case $$tool in \
codebeamer|cpptest|trlc|json|pkg|core-report|core-html_report|core-online-report) \
echo "Skipping tool: $$tool (handled by tracing.sh script)"; \
;; \
*) \
echo "> Processing tool: $$tool"; \
make tracing-tools-$$tool; \
;; \
esac; \
done
tracing-tools-%: tracing-%
rm -f usecases.lobster
@echo "Finished processing tool: $*"
usecases.lobster-%:
python3 util/tracing/usecases.py \
--target=lobster_$(subst -,_,$*) \
--out=usecases.lobster \
lobster/requirements.rsl \
lobster/use_cases.trlc \
tracing-%: report.lobster-%
$(eval TOOL_PATH := $(subst -,_,$*))
python lobster-html-report.py report.lobster --out=docs/tracing-$(TOOL_PATH).html
python lobster-ci-report.py report.lobster
report.lobster-%: lobster/tools/lobster.conf \
code.lobster-% \
unit-tests.lobster-% \
system_requirements.lobster-% \
software_requirements.lobster-% \
system-tests.lobster-% \
usecases.lobster-%
python lobster-report.py \
--lobster-config=lobster/tools/lobster.conf \
--out=report.lobster
@printf "report: report.lobster\ncommit_id: 'main'\nrepo_root: ''\nbase_url: 'https://github.com/bmw-software-engineering/lobster'" > online_report_config.yaml
python lobster-online-report.py --config=online_report_config.yaml --out=report.lobster
@rm online_report_config.yaml
system_requirements.lobster-%: TRLC_CONFIG = lobster/tools/lobster-trlc-system.yaml
system_requirements.lobster-%:
$(eval TOOL_PATH := $(subst -,/,$*))
@echo "inputs: ['lobster/requirements.rsl', 'lobster/use_cases.trlc', 'lobster/tools/$(TOOL_PATH)']" > lobster/tools/config.yaml
@cat $(TRLC_CONFIG) >> lobster/tools/config.yaml
python lobster-trlc.py --config=lobster/tools/config.yaml \
--out=system_requirements.lobster
rm lobster/tools/config.yaml
software_requirements.lobster-%: TRLC_CONFIG = lobster/tools/lobster-trlc-software.yaml
software_requirements.lobster-%:
$(eval TOOL_PATH := $(subst -,/,$*))
@echo "inputs: ['lobster/requirements.rsl', 'lobster/use_cases.trlc', 'lobster/tools/$(TOOL_PATH)']" > lobster/tools/config.yaml
@cat $(TRLC_CONFIG) >> lobster/tools/config.yaml
python lobster-trlc.py --config=lobster/tools/config.yaml \
--out=software_requirements.lobster
rm lobster/tools/config.yaml
code.lobster-%:
$(eval TOOL_PATH := $(subst -,/,$*))
python lobster-python.py --out code.lobster lobster/tools/$(TOOL_PATH)
unit-tests.lobster-%:
$(eval TOOL_NAME := $(notdir $(TOOL_PATH)))
python lobster-python.py --activity --out unit-tests.lobster tests_unit/lobster_$(TOOL_NAME)
system-tests.lobster-%:
$(eval TOOL_NAME := $(notdir $(TOOL_PATH)))
python lobster-python.py --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, $(wildcard tests_system/*.py))
STF_OUTPUT_FILE := docs/tracing-stf.html
# This target is used to generate the LOBSTER report for the requirements of the system test framework itself.
tracing-stf: $(STF_TRLC_FILES)
python lobster-trlc.py --config=lobster/tools/lobster-trlc-system-stf.yaml --out=stf_system_requirements.lobster
python lobster-trlc.py --config=lobster/tools/lobster-trlc-software-stf.yaml --out=stf_software_requirements.lobster
python lobster-python.py --out=stf_code.lobster --only-tagged-functions $(STF_PYTHON_FILES)
python lobster-report.py --lobster-config=tests_system/stf-lobster.conf --out=stf_report.lobster
@printf "report: stf_report.lobster\ncommit_id: 'main'\nrepo_root: ''\nbase_url: 'https://github.com/bmw-software-engineering/lobster'" > online_report_config.yaml
python lobster-online-report.py --config=online_report_config.yaml --out=stf-online-report.lobster
python lobster-html-report.py stf-online-report.lobster --out=$(STF_OUTPUT_FILE)
@echo "✅ STF report generated at $(STF_OUTPUT_FILE)"
@echo "Deleting STF *.lobster files..."
rm -f stf_system_requirements.lobster stf_software_requirements.lobster stf_code.lobster stf_report.lobster online_report_config.yaml