1717 < div class ="section ">
1818 < a href ="index.html "> MISS_HIT</ a > includes a simple tool
1919 (< span class ="file "> mh_trace</ span > ), that can be used to
20- extract tracing tags for code and tests. The output is json and
21- is intended to be used by other tools .
20+ extract tracing tags for code and tests. The output is in the
21+ LOBSTER format </ a > .
2222 </ div >
2323
2424 < div class ="title ">
@@ -34,9 +34,11 @@ <h2>Introduction</h2>
3434 standards (such as ISO 26262 or DO-178C). While you definitely
3535 should not be using MATLAB for this, it is not my place to
3636 judge; and so we have a tool to support this
37- activity. < tt > mh_trace</ tt > can extract tags put in code and
38- test and generate an easy to parse json file that a different
39- tool can use to generate a traceability report.
37+ activity. < tt > mh_trace</ tt > can extract tags put in code,
38+ tests, and Simulink models and generate
39+ a < a href ="https://github.com/bmw-software-engineering/lobster/blob/main/docs/schemas.md "> LOBSTER
40+ trace</ a > files that a different tool (such as LOBSTER) can
41+ use to generate a traceability report.
4042 </ div >
4143
4244 < div >
@@ -68,77 +70,34 @@ <h2>Introduction</h2>
6870</ pre >
6971 </ div >
7072 < div >
71- Running < tt > mh_trace</ tt > will generate a json file (by
72- default < tt > mh_trace.json</ tt > ) that shows which tags affect
73- any given function:
73+ Running < tt > mh_trace</ tt > will generate two lobster files (by
74+ default < tt > mh_imp_trace.lobster</ tt > for code and models,
75+ and < tt > mh_act_trace.lobster</ tt > for tests) that shows which
76+ tags affect any given function. Here shown is a snippet for
77+ the testG function:
7478< pre >
75- {
76- "ExampleTagClassTest::testF": {
77- "source": {
78- "col_start": 17,
79- "filename": "ExampleTagClassTest.m",
80- "line": 6
81- },
82- "tags": ["FeatureB"],
83- "test": True
79+ {
80+ "framework": "MATLAB",
81+ "just_down": [],
82+ "just_global": [],
83+ "just_up": [],
84+ "kind": "Test",
85+ "location": {
86+ "column": 17,
87+ "file": "ExampleTagClassTest.m",
88+ "kind": "file",
89+ "line": 11
90+ },
91+ "name": "ExampleTagClassTest::testG",
92+ "refs": [
93+ "req FeatureB",
94+ "req FeatureC",
95+ "req System"
96+ ],
97+ "status": null,
98+ "tag": "matlab ExampleTagClassTest::testG"
8499 },
85- "ExampleTagClassTest::testG": {
86- "source": {
87- "col_start": 17,
88- "filename": "ExampleTagClassTest.m",
89- "line": 11
90- },
91- "tags": ["FeatureB", "FeatureC", "System"],
92- "test": True
93- },
94- "ExampleTagClassTest::testH": {
95- "source": {
96- "col_start": 17,
97- "filename": "ExampleTagClassTest.m",
98- "line": 16
99- },
100- "tags": ["FeatureA", "FeatureB", "System"],
101- "test": True
102- }
103- }
104- </ pre >
105- </ div >
106-
107- < div >
108- You can also generate the tracing information by tag (using
109- the < tt > --by-tag</ tt > option):
110- < pre >
111- {
112- "FeatureA": [
113- {
114- "name": "ExampleTagClassTest::testH",
115- "source": {
116- "col_start": 17,
117- "filename": "ExampleTagClassTest.m",
118- "line": 16
119- },
120- "test": True
121- }
122- ],
123- "FeatureB": [
124- {
125- "name": "ExampleTagClassTest::testF",
126- "source": {
127- "col_start": 17,
128- "filename": "ExampleTagClassTest.m",
129- "line": 6
130- },
131- "test": True
132- },
133100</ pre >
134- (The rest is omitted because it's just more of the same...)
135- </ div >
136-
137- < div >
138- If you use project configuration (libraries and entrypoints)
139- then an additional field is present in the json output -
140- "shared" to indicate if this code belongs to a shared library
141- or if it is part of an entry point.
142101 </ div >
143102
144103 < h3 > Annotating code</ h3 >
@@ -164,6 +123,16 @@ <h3>Annotating code</h3>
164123 property to tests.
165124 </ div >
166125
126+ < h3 > Annotating models</ h3 >
127+ < div >
128+ Simply place an annotation anywhere in your block. The text
129+ must be a single line only and start
130+ with < tt > lobster-trace:</ tt > and is followed by a (comma
131+ separated) list of tags. For example:
132+ < pre > lobster-trace: foo.My_Req_1, foo.My_Req_2</ pre >
133+ You may place as many of these annotations as you wish.
134+ </ div >
135+
167136 < h3 > Excluding code</ h3 >
168137 < div >
169138 Most projects have some code for e.g. setting up the workspace
@@ -185,16 +154,25 @@ <h3>Excluding code</h3>
185154
186155 < section >
187156 < h2 > Command-line interface</ h2 >
188- < h4 > --json FILE</ h4 >
157+ < h4 > --out-imp FILE</ h4 >
158+ < div >
159+ By default we produce a file
160+ called < tt > mh_imp_trace.lobster</ tt > for code and models. With
161+ this option you can change the filename.
162+ </ div >
163+
164+ < h4 > --out-act FILE</ h4 >
189165 < div >
190166 By default we produce a file
191- called < tt > mh_trace.json </ tt > . With this option you can change
192- the filename.
167+ called < tt > mh_act_trace.lobster </ tt > for tests . With this
168+ option you can change the filename.
193169 </ div >
194170
195- < h4 > --by-tag </ h4 >
171+ < h4 > --only-tagged-blocks </ h4 >
196172 < div >
197- Produce tracing by-tag, instead of by-file (the default).
173+ By default we produce list all blocks in a Simulink model or
174+ library, with this option we only include the ones that have
175+ at least one tag.
198176 </ div >
199177 </ section >
200178
@@ -205,14 +183,14 @@ <h2>Limitations</h2>
205183 normally processes. So if you have your unit tests excluded
206184 from MISS_HIT then you will get no tracing. You could use the
207185 common < tt > --ignore-config</ tt > option to work around this; or
208- even better: don't exclude your unit tests.
186+ even better: don not exclude your unit tests.
209187 </ div >
210188 </ section >
211189
212190 </ main >
213191
214192 < footer >
215- Content © 2021 Florian Schanda< br >
193+ Content © 2021-2023 Florian Schanda< br >
216194 Style © 2019-2020 Alina Boboc< br >
217195 MISS_HIT Lint is licensed under the AGPLv3
218196 </ footer >
0 commit comments