Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coverage integration test for requirements #152

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,4 @@ jobs:
runs-on: ubuntu-24.04
steps:
- name: Failure
run: exit 1
run: exit 1
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ clang-tidy:
integration-tests: packages
(cd tests-integration/projects/basic; make)
(cd tests-integration/projects/filter; 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)
rm -f MODULE.bazel MODULE.bazel.lock

system-tests:
Expand Down
2 changes: 2 additions & 0 deletions tests-integration/projects/coverage-half/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.lobster
*.html
21 changes: 21 additions & 0 deletions tests-integration/projects/coverage-half/Makefile
Original file line number Diff line number Diff line change
@@ -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"
12 changes: 12 additions & 0 deletions tests-integration/projects/coverage-half/example.rsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package coverage_example

type System_Requirement
{
text String
}

type Software_Requirement
{
text String
derived_from optional System_Requirement [1 .. *]
}
9 changes: 9 additions & 0 deletions tests-integration/projects/coverage-half/lobster.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
requirements "System Requirements" {
source: "sysreq.lobster";
}

requirements "Software Requirements"
{
source: "softreq.lobster";
trace to: "System Requirements";
}
130 changes: 130 additions & 0 deletions tests-integration/projects/coverage-half/report.reference_output
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
{
"schema": "lobster-report",
"version": 2,
"generator": "lobster_report",
"levels": [
{
"name": "System Requirements",
"kind": "requirements",
"items": [
{
"tag": "req sysreq_coverage_example.requirement_1a",
"location": {
"kind": "github",
"gh_root": "https://github.com/bmw-software-engineering/lobster",
"commit": "main",
"file": "tests-integration/projects/coverage-half/sysreq_example.trlc",
"line": 4
},
"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": "github",
"gh_root": "https://github.com/bmw-software-engineering/lobster",
"commit": "main",
"file": "tests-integration/projects/coverage-half/softreq_example.trlc",
"line": 5
},
"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": "Requirement 2a",
"status": null
},
{
"tag": "req softreq_coverage_example.requirement_2b",
"location": {
"kind": "github",
"gh_root": "https://github.com/bmw-software-engineering/lobster",
"commit": "main",
"file": "tests-integration/projects/coverage-half/softreq_example.trlc",
"line": 11
},
"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": "Requirement 2b",
"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": []
}
14 changes: 14 additions & 0 deletions tests-integration/projects/coverage-half/softreq_example.trlc
Original file line number Diff line number Diff line change
@@ -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'''
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package sysreq_coverage_example
import coverage_example

coverage_example.System_Requirement requirement_1a
{
text = '''Requirement 1a'''
}
4 changes: 4 additions & 0 deletions tests-integration/projects/coverage-half/trlc-softreq.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
coverage_example.Software_Requirement {
description = text
tags "req" = derived_from
}
3 changes: 3 additions & 0 deletions tests-integration/projects/coverage-half/trlc-sysreq.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
coverage_example.System_Requirement {
description = text
}
2 changes: 2 additions & 0 deletions tests-integration/projects/coverage-mix/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.lobster
*.html
25 changes: 25 additions & 0 deletions tests-integration/projects/coverage-mix/Makefile
Original file line number Diff line number Diff line change
@@ -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"
22 changes: 22 additions & 0 deletions tests-integration/projects/coverage-mix/example.rsl
Original file line number Diff line number Diff line change
@@ -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
}


16 changes: 16 additions & 0 deletions tests-integration/projects/coverage-mix/lobster.conf
Original file line number Diff line number Diff line change
@@ -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";
}
Loading
Loading