Skip to content

Commit

Permalink
Coverage integration tests
Browse files Browse the repository at this point in the history
four different coverage tests have been added
  • Loading branch information
TannazVhdBMWExt committed Dec 12, 2024
1 parent 95db70b commit fc04145
Show file tree
Hide file tree
Showing 40 changed files with 829 additions and 44 deletions.
42 changes: 0 additions & 42 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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:
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";
}
127 changes: 127 additions & 0 deletions tests-integration/projects/coverage-half/report.reference_output
Original file line number Diff line number Diff line change
@@ -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": []
}
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'''
}
7 changes: 7 additions & 0 deletions tests-integration/projects/coverage-half/sysreq_example.trlc
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

0 comments on commit fc04145

Please sign in to comment.