diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 607b3319..6f350a6f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,50 +23,8 @@ jobs: - name: Executing linter run: | make lint - test: - name: TestSuite - needs: lint - strategy: - matrix: - os: [ubuntu-24.04, windows-2022, macos-13, macos-14] - py-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] - include: - - os: macos-13 - brew: "/usr/local" - - os: macos-14 - brew: "/opt/homebrew" - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v4 - - name: Install python version - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.py-version }} - - name: Install dependencies - run: | - python3 -m pip install --upgrade pip - python3 -m pip install -r requirements_dev.txt - - name: Install gnu make on macos - if: startsWith(matrix.os, 'macos') - run: | - brew install make - echo "${{ matrix.brew }}/opt/make/libexec/gnubin" >> $GITHUB_PATH - - name: Executing unit tests - run: | - make unit-tests - - name: Executing system tests - run: | - make system-tests - - name: Coverage analysis - run: | - make coverage - - name: Check output files - if: always() - run: | - util/check_local_modifications.sh integration-tests: name: Integration tests - needs: test runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 diff --git a/Makefile b/Makefile index 9bf253bb..6f5dae7e 100644 --- a/Makefile +++ b/Makefile @@ -52,8 +52,7 @@ clang-tidy: cmake --build build --target clang-tidy integration-tests: packages - (cd tests-integration/projects/basic; make) - (cd tests-integration/projects/filter; make) + (cd tests-integration/projects/coverage; make) rm -f MODULE.bazel MODULE.bazel.lock system-tests: diff --git a/tests-integration/projects/coverage-half/.gitignore b/tests-integration/projects/coverage-half/.gitignore new file mode 100644 index 00000000..d22c7166 --- /dev/null +++ b/tests-integration/projects/coverage-half/.gitignore @@ -0,0 +1,2 @@ +*.lobster +*.html diff --git a/tests-integration/projects/coverage-half/Makefile b/tests-integration/projects/coverage-half/Makefile new file mode 100644 index 00000000..faf04cc3 --- /dev/null +++ b/tests-integration/projects/coverage-half/Makefile @@ -0,0 +1,21 @@ +LOBSTER_ROOT:=../../.. + +PATH:=$(LOBSTER_ROOT)/test_install/bin:$(PATH) +PYTHONPATH:=$(wildcard $(LOBSTER_ROOT)/test_install/lib/python*/site-packages) + +THIS_TEST:=$(shell realpath --relative-to $(LOBSTER_ROOT) $(PWD)) +THIS_TEST_ESCAPED:=$(subst /,\\/,$(THIS_TEST)) + +html_report.html: softreq.lobster sysreq.lobster lobster.conf trlc-softreq.conf trlc-sysreq.conf + @lobster-report + @lobster-online-report + @cp report.lobster report.reference_output + @lobster-html-report + +softreq.lobster: example.rsl softreq_example.trlc sysreq_example.trlc + @lobster-trlc example.rsl softreq_example.trlc sysreq_example.trlc\ + --out="softreq.lobster" --config-file="trlc-softreq.conf" + +sysreq.lobster: example.rsl softreq_example.trlc sysreq_example.trlc + @lobster-trlc example.rsl softreq_example.trlc sysreq_example.trlc\ + --out="sysreq.lobster" --config-file="trlc-sysreq.conf" diff --git a/tests-integration/projects/coverage-half/example.rsl b/tests-integration/projects/coverage-half/example.rsl new file mode 100644 index 00000000..fa8be84b --- /dev/null +++ b/tests-integration/projects/coverage-half/example.rsl @@ -0,0 +1,12 @@ +package coverage_example + +type System_Requirement +{ + text String +} + +type Software_Requirement +{ + text String + derived_from optional System_Requirement [1 .. *] +} diff --git a/tests-integration/projects/coverage-half/lobster.conf b/tests-integration/projects/coverage-half/lobster.conf new file mode 100644 index 00000000..2ae2e2f4 --- /dev/null +++ b/tests-integration/projects/coverage-half/lobster.conf @@ -0,0 +1,9 @@ +requirements "System Requirements" { + source: "sysreq.lobster"; +} + +requirements "Software Requirements" +{ + source: "softreq.lobster"; + trace to: "System Requirements"; +} diff --git a/tests-integration/projects/coverage-half/report.reference_output b/tests-integration/projects/coverage-half/report.reference_output new file mode 100644 index 00000000..21d4a9f2 --- /dev/null +++ b/tests-integration/projects/coverage-half/report.reference_output @@ -0,0 +1,127 @@ +{ + "schema": "lobster-report", + "version": 2, + "generator": "lobster_report", + "levels": [ + { + "name": "System Requirements", + "kind": "requirements", + "items": [ + { + "tag": "req sysreq_coverage_example.requirement_1a", + "location": { + "kind": "file", + "file": ".\\sysreq_example.trlc", + "line": 4, + "column": 37 + }, + "name": "sysreq_coverage_example.requirement_1a", + "messages": [], + "just_up": [], + "just_down": [], + "just_global": [], + "ref_up": [], + "ref_down": [ + "req softreq_coverage_example.requirement_2a" + ], + "tracing_status": "OK", + "framework": "TRLC", + "kind": "System_Requirement", + "text": "Requirement 1a", + "status": null + } + ], + "coverage": 100.0 + }, + { + "name": "Software Requirements", + "kind": "requirements", + "items": [ + { + "tag": "req softreq_coverage_example.requirement_2a", + "location": { + "kind": "file", + "file": ".\\softreq_example.trlc", + "line": 5, + "column": 39 + }, + "name": "softreq_coverage_example.requirement_2a", + "messages": [], + "just_up": [], + "just_down": [], + "just_global": [], + "ref_up": [ + "req sysreq_coverage_example.requirement_1a" + ], + "ref_down": [], + "tracing_status": "OK", + "framework": "TRLC", + "kind": "Software_Requirement", + "text": "Requirement2a", + "status": null + }, + { + "tag": "req softreq_coverage_example.requirement_2b", + "location": { + "kind": "file", + "file": ".\\softreq_example.trlc", + "line": 11, + "column": 39 + }, + "name": "softreq_coverage_example.requirement_2b", + "messages": [ + "missing up reference" + ], + "just_up": [], + "just_down": [], + "just_global": [], + "tracing_status": "MISSING", + "framework": "TRLC", + "kind": "Software_Requirement", + "text": "Requirement2b", + "status": null + } + ], + "coverage": 50.0 + } + ], + "policy": { + "System Requirements": { + "name": "System Requirements", + "kind": "requirements", + "traces": [], + "source": [ + { + "file": "sysreq.lobster", + "filters": [], + "valid_status": [] + } + ], + "needs_tracing_up": false, + "needs_tracing_down": true, + "breakdown_requirements": [ + [ + "Software Requirements" + ] + ] + }, + "Software Requirements": { + "name": "Software Requirements", + "kind": "requirements", + "traces": [ + "System Requirements" + ], + "source": [ + { + "file": "softreq.lobster", + "filters": [], + "valid_status": [] + } + ], + "needs_tracing_up": true, + "needs_tracing_down": false, + "breakdown_requirements": [] + } + }, + "matrix": [] +} diff --git a/tests-integration/projects/coverage-half/softreq_example.trlc b/tests-integration/projects/coverage-half/softreq_example.trlc new file mode 100644 index 00000000..e6915963 --- /dev/null +++ b/tests-integration/projects/coverage-half/softreq_example.trlc @@ -0,0 +1,14 @@ +package softreq_coverage_example +import coverage_example +import sysreq_coverage_example + +coverage_example.Software_Requirement requirement_2a +{ + text = '''Requirement 2a''' + derived_from = [sysreq_coverage_example.requirement_1a] +} + +coverage_example.Software_Requirement requirement_2b +{ + text = '''Requirement 2b''' +} \ No newline at end of file diff --git a/tests-integration/projects/coverage-half/sysreq_example.trlc b/tests-integration/projects/coverage-half/sysreq_example.trlc new file mode 100644 index 00000000..99dfcfb0 --- /dev/null +++ b/tests-integration/projects/coverage-half/sysreq_example.trlc @@ -0,0 +1,7 @@ +package sysreq_coverage_example +import coverage_example + +coverage_example.System_Requirement requirement_1a +{ + text = '''Requirement 1a''' +} diff --git a/tests-integration/projects/coverage-half/trlc-softreq.conf b/tests-integration/projects/coverage-half/trlc-softreq.conf new file mode 100644 index 00000000..88d154cd --- /dev/null +++ b/tests-integration/projects/coverage-half/trlc-softreq.conf @@ -0,0 +1,4 @@ +coverage_example.Software_Requirement { + description = text + tags "req" = derived_from +} diff --git a/tests-integration/projects/coverage-half/trlc-sysreq.conf b/tests-integration/projects/coverage-half/trlc-sysreq.conf new file mode 100644 index 00000000..79a8ac0a --- /dev/null +++ b/tests-integration/projects/coverage-half/trlc-sysreq.conf @@ -0,0 +1,3 @@ +coverage_example.System_Requirement { + description = text +} \ No newline at end of file diff --git a/tests-integration/projects/coverage-mix/.gitignore b/tests-integration/projects/coverage-mix/.gitignore new file mode 100644 index 00000000..d22c7166 --- /dev/null +++ b/tests-integration/projects/coverage-mix/.gitignore @@ -0,0 +1,2 @@ +*.lobster +*.html diff --git a/tests-integration/projects/coverage-mix/Makefile b/tests-integration/projects/coverage-mix/Makefile new file mode 100644 index 00000000..6b2089fc --- /dev/null +++ b/tests-integration/projects/coverage-mix/Makefile @@ -0,0 +1,25 @@ +LOBSTER_ROOT:=../../.. + +PATH:=$(LOBSTER_ROOT)/test_install/bin:$(PATH) +PYTHONPATH:=$(wildcard $(LOBSTER_ROOT)/test_install/lib/python*/site-packages) + +THIS_TEST:=$(shell realpath --relative-to $(LOBSTER_ROOT) $(PWD)) +THIS_TEST_ESCAPED:=$(subst /,\\/,$(THIS_TEST)) + +html_report.html: softreq.lobster sysreq.lobster testreq.lobster lobster.conf trlc-softreq.conf trlc-sysreq.conf trlc-testreq.conf + @lobster-report + @lobster-online-report + @cp report.lobster report.reference_output + @lobster-html-report + +softreq.lobster: example.rsl softreq_example.trlc sysreq_example.trlc testreq_example.trlc + @lobster-trlc example.rsl softreq_example.trlc sysreq_example.trlc testreq_example.trlc\ + --out="softreq.lobster" --config-file="trlc-softreq.conf" + +sysreq.lobster: example.rsl softreq_example.trlc sysreq_example.trlc testreq_example.trlc + @lobster-trlc example.rsl softreq_example.trlc sysreq_example.trlc testreq_example.trlc\ + --out="sysreq.lobster" --config-file="trlc-sysreq.conf" + +testreq.lobster: example.rsl softreq_example.trlc sysreq_example.trlc testreq_example.trlc + @lobster-trlc example.rsl softreq_example.trlc sysreq_example.trlc testreq_example.trlc\ + --out="testreq.lobster" --config-file="trlc-testreq.conf" diff --git a/tests-integration/projects/coverage-mix/example.rsl b/tests-integration/projects/coverage-mix/example.rsl new file mode 100644 index 00000000..21ca7117 --- /dev/null +++ b/tests-integration/projects/coverage-mix/example.rsl @@ -0,0 +1,22 @@ +package coverage_half_example + +type System_Requirement +{ + text String +} + +type Software_Requirement +{ + text String + derived_from optional System_Requirement [1 .. *] +} + +type Test_Requirement +{ + text String + derived_from optional Software_Requirement [1 .. *] + just_up optional String + just_down optional String +} + + diff --git a/tests-integration/projects/coverage-mix/lobster.conf b/tests-integration/projects/coverage-mix/lobster.conf new file mode 100644 index 00000000..781a6e0c --- /dev/null +++ b/tests-integration/projects/coverage-mix/lobster.conf @@ -0,0 +1,16 @@ +requirements "Software Requirements" +{ + source: "softreq.lobster"; + requires: "Test Requirements"; +} + +requirements "System Requirements" { + source: "sysreq.lobster"; + trace to: "Software Requirements"; +} + +requirements "Test Requirements" +{ + source: "testreq.lobster"; + trace to: "Software Requirements"; +} diff --git a/tests-integration/projects/coverage-mix/report.reference_output b/tests-integration/projects/coverage-mix/report.reference_output new file mode 100644 index 00000000..ea612e44 --- /dev/null +++ b/tests-integration/projects/coverage-mix/report.reference_output @@ -0,0 +1,155 @@ +{ + "schema": "lobster-report", + "version": 2, + "generator": "lobster_report", + "levels": [ + { + "name": "Software Requirements", + "kind": "requirements", + "items": [ + { + "tag": "req softreq_coverage_half_example.requirement_d", + "location": { + "kind": "file", + "file": ".\\softreq_example.trlc", + "line": 5, + "column": 44 + }, + "name": "softreq_coverage_half_example.requirement_d", + "messages": [], + "just_up": [], + "just_down": [], + "just_global": [], + "ref_up": [], + "ref_down": [ + "req testreq_coverage_half_example.requirement_f" + ], + "tracing_status": "OK", + "framework": "TRLC", + "kind": "Software_Requirement", + "text": "Requirement d", + "status": null + } + ], + "coverage": 100.0 + }, + { + "name": "System Requirements", + "kind": "requirements", + "items": [ + { + "tag": "req sysreq_coverage_half_example.requirement_e", + "location": { + "kind": "file", + "file": ".\\sysreq_example.trlc", + "line": 5, + "column": 42 + }, + "name": "sysreq_coverage_half_example.requirement_e", + "messages": [ + "missing up reference" + ], + "just_up": [], + "just_down": [], + "just_global": [], + "tracing_status": "MISSING", + "framework": "TRLC", + "kind": "System_Requirement", + "text": "Requirement e", + "status": null + } + ], + "coverage": 0.0 + }, + { + "name": "Test Requirements", + "kind": "requirements", + "items": [ + { + "tag": "req testreq_coverage_half_example.requirement_f", + "location": { + "kind": "file", + "file": ".\\testreq_example.trlc", + "line": 5, + "column": 40 + }, + "name": "testreq_coverage_half_example.requirement_f", + "messages": [], + "just_up": [ + "needed" + ], + "just_down": [ + "needed" + ], + "just_global": [], + "ref_up": [ + "req softreq_coverage_half_example.requirement_d" + ], + "ref_down": [], + "tracing_status": "JUSTIFIED", + "framework": "TRLC", + "kind": "Test_Requirement", + "text": "Requirement3", + "status": null + } + ], + "coverage": 100.0 + } + ], + "policy": { + "Software Requirements": { + "name": "Software Requirements", + "kind": "requirements", + "traces": [], + "source": [ + { + "file": "softreq.lobster", + "filters": [], + "valid_status": [] + } + ], + "needs_tracing_up": false, + "needs_tracing_down": true, + "breakdown_requirements": [ + [ + "Test Requirements" + ] + ] + }, + "System Requirements": { + "name": "System Requirements", + "kind": "requirements", + "traces": [ + "Software Requirements" + ], + "source": [ + { + "file": "sysreq.lobster", + "filters": [], + "valid_status": [] + } + ], + "needs_tracing_up": true, + "needs_tracing_down": false, + "breakdown_requirements": [] + }, + "Test Requirements": { + "name": "Test Requirements", + "kind": "requirements", + "traces": [ + "Software Requirements" + ], + "source": [ + { + "file": "testreq.lobster", + "filters": [], + "valid_status": [] + } + ], + "needs_tracing_up": true, + "needs_tracing_down": false, + "breakdown_requirements": [] + } + }, + "matrix": [] +} diff --git a/tests-integration/projects/coverage-mix/softreq_example.trlc b/tests-integration/projects/coverage-mix/softreq_example.trlc new file mode 100644 index 00000000..0c7113fe --- /dev/null +++ b/tests-integration/projects/coverage-mix/softreq_example.trlc @@ -0,0 +1,8 @@ +package softreq_coverage_half_example +import coverage_half_example +import sysreq_coverage_half_example + +coverage_half_example.Software_Requirement requirement_d +{ + text = '''Requirement d''' +} diff --git a/tests-integration/projects/coverage-mix/sysreq_example.trlc b/tests-integration/projects/coverage-mix/sysreq_example.trlc new file mode 100644 index 00000000..e09e458b --- /dev/null +++ b/tests-integration/projects/coverage-mix/sysreq_example.trlc @@ -0,0 +1,8 @@ +package sysreq_coverage_half_example +import coverage_half_example +import testreq_coverage_half_example + +coverage_half_example.System_Requirement requirement_e +{ + text = '''Requirement e''' +} \ No newline at end of file diff --git a/tests-integration/projects/coverage-mix/testreq_example.trlc b/tests-integration/projects/coverage-mix/testreq_example.trlc new file mode 100644 index 00000000..9e8140e8 --- /dev/null +++ b/tests-integration/projects/coverage-mix/testreq_example.trlc @@ -0,0 +1,11 @@ +package testreq_coverage_half_example +import coverage_half_example +import softreq_coverage_half_example + +coverage_half_example.Test_Requirement requirement_f +{ + text = '''Requirement3''' + derived_from = [softreq_coverage_half_example.requirement_d] + just_up = "needed" + just_down = "needed" +} \ No newline at end of file diff --git a/tests-integration/projects/coverage-mix/trlc-softreq.conf b/tests-integration/projects/coverage-mix/trlc-softreq.conf new file mode 100644 index 00000000..eade7502 --- /dev/null +++ b/tests-integration/projects/coverage-mix/trlc-softreq.conf @@ -0,0 +1,4 @@ +coverage_half_example.Software_Requirement { + description = text + tags "req" = derived_from +} diff --git a/tests-integration/projects/coverage-mix/trlc-sysreq.conf b/tests-integration/projects/coverage-mix/trlc-sysreq.conf new file mode 100644 index 00000000..c6c2f713 --- /dev/null +++ b/tests-integration/projects/coverage-mix/trlc-sysreq.conf @@ -0,0 +1,3 @@ +coverage_half_example.System_Requirement { + description = text +} \ No newline at end of file diff --git a/tests-integration/projects/coverage-mix/trlc-testreq.conf b/tests-integration/projects/coverage-mix/trlc-testreq.conf new file mode 100644 index 00000000..04bb739a --- /dev/null +++ b/tests-integration/projects/coverage-mix/trlc-testreq.conf @@ -0,0 +1,6 @@ +coverage_half_example.Test_Requirement { + description = text + tags "req" = derived_from + just_up = just_up + just_down = just_down +} diff --git a/tests-integration/projects/coverage-zero/.gitignore b/tests-integration/projects/coverage-zero/.gitignore new file mode 100644 index 00000000..d22c7166 --- /dev/null +++ b/tests-integration/projects/coverage-zero/.gitignore @@ -0,0 +1,2 @@ +*.lobster +*.html diff --git a/tests-integration/projects/coverage-zero/Makefile b/tests-integration/projects/coverage-zero/Makefile new file mode 100644 index 00000000..faf04cc3 --- /dev/null +++ b/tests-integration/projects/coverage-zero/Makefile @@ -0,0 +1,21 @@ +LOBSTER_ROOT:=../../.. + +PATH:=$(LOBSTER_ROOT)/test_install/bin:$(PATH) +PYTHONPATH:=$(wildcard $(LOBSTER_ROOT)/test_install/lib/python*/site-packages) + +THIS_TEST:=$(shell realpath --relative-to $(LOBSTER_ROOT) $(PWD)) +THIS_TEST_ESCAPED:=$(subst /,\\/,$(THIS_TEST)) + +html_report.html: softreq.lobster sysreq.lobster lobster.conf trlc-softreq.conf trlc-sysreq.conf + @lobster-report + @lobster-online-report + @cp report.lobster report.reference_output + @lobster-html-report + +softreq.lobster: example.rsl softreq_example.trlc sysreq_example.trlc + @lobster-trlc example.rsl softreq_example.trlc sysreq_example.trlc\ + --out="softreq.lobster" --config-file="trlc-softreq.conf" + +sysreq.lobster: example.rsl softreq_example.trlc sysreq_example.trlc + @lobster-trlc example.rsl softreq_example.trlc sysreq_example.trlc\ + --out="sysreq.lobster" --config-file="trlc-sysreq.conf" diff --git a/tests-integration/projects/coverage-zero/example.rsl b/tests-integration/projects/coverage-zero/example.rsl new file mode 100644 index 00000000..fa8be84b --- /dev/null +++ b/tests-integration/projects/coverage-zero/example.rsl @@ -0,0 +1,12 @@ +package coverage_example + +type System_Requirement +{ + text String +} + +type Software_Requirement +{ + text String + derived_from optional System_Requirement [1 .. *] +} diff --git a/tests-integration/projects/coverage-zero/lobster.conf b/tests-integration/projects/coverage-zero/lobster.conf new file mode 100644 index 00000000..2ae2e2f4 --- /dev/null +++ b/tests-integration/projects/coverage-zero/lobster.conf @@ -0,0 +1,9 @@ +requirements "System Requirements" { + source: "sysreq.lobster"; +} + +requirements "Software Requirements" +{ + source: "softreq.lobster"; + trace to: "System Requirements"; +} diff --git a/tests-integration/projects/coverage-zero/report.reference_output b/tests-integration/projects/coverage-zero/report.reference_output new file mode 100644 index 00000000..dabaa5e1 --- /dev/null +++ b/tests-integration/projects/coverage-zero/report.reference_output @@ -0,0 +1,123 @@ +{ + "schema": "lobster-report", + "version": 2, + "generator": "lobster_report", + "levels": [ + { + "name": "System Requirements", + "kind": "requirements", + "items": [ + { + "tag": "req sysreq_coverage_example.requirement_4a", + "location": { + "kind": "file", + "file": ".\\sysreq_example.trlc", + "line": 4, + "column": 37 + }, + "name": "sysreq_coverage_example.requirement_4a", + "messages": [ + "missing reference to Software Requirements" + ], + "just_up": [], + "just_down": [], + "just_global": [], + "tracing_status": "MISSING", + "framework": "TRLC", + "kind": "System_Requirement", + "text": "Requirement 4a", + "status": null + } + ], + "coverage": 0.0 + }, + { + "name": "Software Requirements", + "kind": "requirements", + "items": [ + { + "tag": "req softreq_coverage_example.requirement_3a", + "location": { + "kind": "file", + "file": ".\\softreq_example.trlc", + "line": 5, + "column": 39 + }, + "name": "softreq_coverage_example.requirement_3a", + "messages": [ + "missing up reference" + ], + "just_up": [], + "just_down": [], + "just_global": [], + "tracing_status": "MISSING", + "framework": "TRLC", + "kind": "Software_Requirement", + "text": "Requirement 3a", + "status": null + }, + { + "tag": "req softreq_coverage_example.requirement_3b", + "location": { + "kind": "file", + "file": ".\\softreq_example.trlc", + "line": 10, + "column": 39 + }, + "name": "softreq_coverage_example.requirement_3b", + "messages": [ + "missing up reference" + ], + "just_up": [], + "just_down": [], + "just_global": [], + "tracing_status": "MISSING", + "framework": "TRLC", + "kind": "Software_Requirement", + "text": "Requirement 3b", + "status": null + } + ], + "coverage": 0.0 + } + ], + "policy": { + "System Requirements": { + "name": "System Requirements", + "kind": "requirements", + "traces": [], + "source": [ + { + "file": "sysreq.lobster", + "filters": [], + "valid_status": [] + } + ], + "needs_tracing_up": false, + "needs_tracing_down": true, + "breakdown_requirements": [ + [ + "Software Requirements" + ] + ] + }, + "Software Requirements": { + "name": "Software Requirements", + "kind": "requirements", + "traces": [ + "System Requirements" + ], + "source": [ + { + "file": "softreq.lobster", + "filters": [], + "valid_status": [] + } + ], + "needs_tracing_up": true, + "needs_tracing_down": false, + "breakdown_requirements": [] + } + }, + "matrix": [] +} diff --git a/tests-integration/projects/coverage-zero/softreq_example.trlc b/tests-integration/projects/coverage-zero/softreq_example.trlc new file mode 100644 index 00000000..aa4850db --- /dev/null +++ b/tests-integration/projects/coverage-zero/softreq_example.trlc @@ -0,0 +1,13 @@ +package softreq_coverage_example +import coverage_example +import sysreq_coverage_example + +coverage_example.Software_Requirement requirement_3a +{ + text = '''Requirement 3a''' +} + +coverage_example.Software_Requirement requirement_3b +{ + text = '''Requirement 3b''' +} \ No newline at end of file diff --git a/tests-integration/projects/coverage-zero/sysreq_example.trlc b/tests-integration/projects/coverage-zero/sysreq_example.trlc new file mode 100644 index 00000000..f8dcfe97 --- /dev/null +++ b/tests-integration/projects/coverage-zero/sysreq_example.trlc @@ -0,0 +1,7 @@ +package sysreq_coverage_example +import coverage_example + +coverage_example.System_Requirement requirement_4a +{ + text = '''Requirement 4a''' +} diff --git a/tests-integration/projects/coverage-zero/trlc-softreq.conf b/tests-integration/projects/coverage-zero/trlc-softreq.conf new file mode 100644 index 00000000..88d154cd --- /dev/null +++ b/tests-integration/projects/coverage-zero/trlc-softreq.conf @@ -0,0 +1,4 @@ +coverage_example.Software_Requirement { + description = text + tags "req" = derived_from +} diff --git a/tests-integration/projects/coverage-zero/trlc-sysreq.conf b/tests-integration/projects/coverage-zero/trlc-sysreq.conf new file mode 100644 index 00000000..79a8ac0a --- /dev/null +++ b/tests-integration/projects/coverage-zero/trlc-sysreq.conf @@ -0,0 +1,3 @@ +coverage_example.System_Requirement { + description = text +} \ No newline at end of file diff --git a/tests-integration/projects/coverage/.gitignore b/tests-integration/projects/coverage/.gitignore new file mode 100644 index 00000000..d22c7166 --- /dev/null +++ b/tests-integration/projects/coverage/.gitignore @@ -0,0 +1,2 @@ +*.lobster +*.html diff --git a/tests-integration/projects/coverage/Makefile b/tests-integration/projects/coverage/Makefile new file mode 100644 index 00000000..faf04cc3 --- /dev/null +++ b/tests-integration/projects/coverage/Makefile @@ -0,0 +1,21 @@ +LOBSTER_ROOT:=../../.. + +PATH:=$(LOBSTER_ROOT)/test_install/bin:$(PATH) +PYTHONPATH:=$(wildcard $(LOBSTER_ROOT)/test_install/lib/python*/site-packages) + +THIS_TEST:=$(shell realpath --relative-to $(LOBSTER_ROOT) $(PWD)) +THIS_TEST_ESCAPED:=$(subst /,\\/,$(THIS_TEST)) + +html_report.html: softreq.lobster sysreq.lobster lobster.conf trlc-softreq.conf trlc-sysreq.conf + @lobster-report + @lobster-online-report + @cp report.lobster report.reference_output + @lobster-html-report + +softreq.lobster: example.rsl softreq_example.trlc sysreq_example.trlc + @lobster-trlc example.rsl softreq_example.trlc sysreq_example.trlc\ + --out="softreq.lobster" --config-file="trlc-softreq.conf" + +sysreq.lobster: example.rsl softreq_example.trlc sysreq_example.trlc + @lobster-trlc example.rsl softreq_example.trlc sysreq_example.trlc\ + --out="sysreq.lobster" --config-file="trlc-sysreq.conf" diff --git a/tests-integration/projects/coverage/example.rsl b/tests-integration/projects/coverage/example.rsl new file mode 100644 index 00000000..fa8be84b --- /dev/null +++ b/tests-integration/projects/coverage/example.rsl @@ -0,0 +1,12 @@ +package coverage_example + +type System_Requirement +{ + text String +} + +type Software_Requirement +{ + text String + derived_from optional System_Requirement [1 .. *] +} diff --git a/tests-integration/projects/coverage/lobster.conf b/tests-integration/projects/coverage/lobster.conf new file mode 100644 index 00000000..2ae2e2f4 --- /dev/null +++ b/tests-integration/projects/coverage/lobster.conf @@ -0,0 +1,9 @@ +requirements "System Requirements" { + source: "sysreq.lobster"; +} + +requirements "Software Requirements" +{ + source: "softreq.lobster"; + trace to: "System Requirements"; +} diff --git a/tests-integration/projects/coverage/report.reference_output b/tests-integration/projects/coverage/report.reference_output new file mode 100644 index 00000000..df48477b --- /dev/null +++ b/tests-integration/projects/coverage/report.reference_output @@ -0,0 +1,108 @@ +{ + "schema": "lobster-report", + "version": 2, + "generator": "lobster_report", + "levels": [ + { + "name": "System Requirements", + "kind": "requirements", + "items": [ + { + "tag": "req sysreq_coverage_example.requirement_1", + "location": { + "kind": "github", + "gh_root": "https://github.com/bmw-software-engineering/lobster", + "commit": "main", + "file": "tests-integration/projects/coverage/sysreq_example.trlc", + "line": 4 + }, + "name": "sysreq_coverage_example.requirement_1", + "messages": [], + "just_up": [], + "just_down": [], + "just_global": [], + "ref_up": [], + "ref_down": [ + "req softreq_coverage_example.requirement_2" + ], + "tracing_status": "OK", + "framework": "TRLC", + "kind": "System_Requirement", + "text": "Requirement 1", + "status": null + } + ], + "coverage": 100.0 + }, + { + "name": "Software Requirements", + "kind": "requirements", + "items": [ + { + "tag": "req softreq_coverage_example.requirement_2", + "location": { + "kind": "github", + "gh_root": "https://github.com/bmw-software-engineering/lobster", + "commit": "main", + "file": "tests-integration/projects/coverage/softreq_example.trlc", + "line": 5 + }, + "name": "softreq_coverage_example.requirement_2", + "messages": [], + "just_up": [], + "just_down": [], + "just_global": [], + "ref_up": [ + "req sysreq_coverage_example.requirement_1" + ], + "ref_down": [], + "tracing_status": "OK", + "framework": "TRLC", + "kind": "Software_Requirement", + "text": "Requirement2", + "status": null + } + ], + "coverage": 100.0 + } + ], + "policy": { + "System Requirements": { + "name": "System Requirements", + "kind": "requirements", + "traces": [], + "source": [ + { + "file": "sysreq.lobster", + "filters": [], + "valid_status": [] + } + ], + "needs_tracing_up": false, + "needs_tracing_down": true, + "breakdown_requirements": [ + [ + "Software Requirements" + ] + ] + }, + "Software Requirements": { + "name": "Software Requirements", + "kind": "requirements", + "traces": [ + "System Requirements" + ], + "source": [ + { + "file": "softreq.lobster", + "filters": [], + "valid_status": [] + } + ], + "needs_tracing_up": true, + "needs_tracing_down": false, + "breakdown_requirements": [] + } + }, + "matrix": [] +} diff --git a/tests-integration/projects/coverage/softreq_example.trlc b/tests-integration/projects/coverage/softreq_example.trlc new file mode 100644 index 00000000..bedbe63b --- /dev/null +++ b/tests-integration/projects/coverage/softreq_example.trlc @@ -0,0 +1,9 @@ +package softreq_coverage_example +import coverage_example +import sysreq_coverage_example + +coverage_example.Software_Requirement requirement_2 +{ + text = '''Requirement 2''' + derived_from = [sysreq_coverage_example.requirement_1] +} \ No newline at end of file diff --git a/tests-integration/projects/coverage/sysreq_example.trlc b/tests-integration/projects/coverage/sysreq_example.trlc new file mode 100644 index 00000000..d057ddba --- /dev/null +++ b/tests-integration/projects/coverage/sysreq_example.trlc @@ -0,0 +1,7 @@ +package sysreq_coverage_example +import coverage_example + +coverage_example.System_Requirement requirement_1 +{ + text = '''Requirement 1''' +} diff --git a/tests-integration/projects/coverage/trlc-softreq.conf b/tests-integration/projects/coverage/trlc-softreq.conf new file mode 100644 index 00000000..88d154cd --- /dev/null +++ b/tests-integration/projects/coverage/trlc-softreq.conf @@ -0,0 +1,4 @@ +coverage_example.Software_Requirement { + description = text + tags "req" = derived_from +} diff --git a/tests-integration/projects/coverage/trlc-sysreq.conf b/tests-integration/projects/coverage/trlc-sysreq.conf new file mode 100644 index 00000000..79a8ac0a --- /dev/null +++ b/tests-integration/projects/coverage/trlc-sysreq.conf @@ -0,0 +1,3 @@ +coverage_example.System_Requirement { + description = text +} \ No newline at end of file