Skip to content

Commit b167718

Browse files
authored
Merge pull request #2205 from strictdoc-project/stanislaw/auto_uid
commands/manage_autouid: ensure that non-SDoc files are not modified
2 parents aa28abe + e809a1d commit b167718

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

strictdoc/commands/manage_autouid_command.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@ def execute(*, project_config: ProjectConfig, parallelizer: Parallelizer):
7070
next_number += 1
7171

7272
for document in traceability_index.document_tree.document_list:
73+
# Most recently, we parse JUnit XML or Gcov JSON files.
74+
# These must not be written back.
75+
if not document.meta.document_filename.endswith(".sdoc"):
76+
continue
77+
7378
document_content = SDWriter(project_config).write(document)
7479
document_meta = document.meta
7580
with open(
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#
2+
# This test verifies that the manage auto_uid command will not overwrite the
3+
# JUnit XML files with SDoc content.
4+
# The scope of the auto_uid is only SDoc files. All other extensions must be ignored.
5+
#
6+
7+
RUN: cp %S/*.xml %S/Output/
8+
RUN: %strictdoc manage auto-uid %S/Output | filecheck %s --dump-input=fail
9+
10+
CHECK: Step 'Build traceability graph' took
11+
12+
RUN: %diff %S/tests_unit.gtest.junit.xml %S/Output/tests_unit.gtest.junit.xml
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<testsuites tests="2" failures="0" disabled="0" errors="0" time="0.001" timestamp="2025-05-01T16:42:49.950" name="AllTests">
3+
<testsuite name="TestCaseVc" tests="2" failures="0" disabled="0" skipped="0" errors="0" time="0.001" timestamp="2025-05-01T16:42:49.950">
4+
<testcase name="TestCase" file="/home/foobar/vc_test.cc" line="53" status="run" result="completed" time="0." timestamp="2025-05-01T16:42:49.950" classname="TestCaseVc" />
5+
<testcase name="Steering1" file="/home/foobar/vc_test.cc" line="61" status="run" result="completed" time="0.001" timestamp="2025-05-01T16:42:49.950" classname="TestCaseVc" />
6+
</testsuite>
7+
</testsuites>

0 commit comments

Comments
 (0)