-
Notifications
You must be signed in to change notification settings - Fork 9
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
Lobster cpptest requirement input files using trlc #150
Open
TannazVhdBMWExt
wants to merge
9
commits into
bmw-software-engineering:main
Choose a base branch
from
vispiron-swe:lobster-cpptest-requirement-inputFiles-using-TRLC
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
0d854ef
Tests adaptation
TannazVhdBMWExt 5dfff31
Merge branch 'bmw-software-engineering:main' into main
TannazVhdBMWExt c1ba65f
Add requirements to the cpptest tool
TannazVhdBMWExt 3d01128
Merge branch 'bmw-software-engineering:main' into main
TannazVhdBMWExt b243242
Merge branch 'bmw-software-engineering:main' into main
TannazVhdBMWExt 969f68a
Merge branch 'main' into lobster-cpptest-requirement-inputFiles-using…
TannazVhdBMWExt 652b38a
rename expected-output to expected-output-template
TannazVhdBMWExt 6801a8c
Merge branch 'bmw-software-engineering:main' into main
TannazVhdBMWExt eeadad6
Merge branch 'main' into lobster-cpptest-requirement-inputFiles-using…
TannazVhdBMWExt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,75 @@ | ||
package cpptest_req | ||
import req | ||
|
||
req.Software_Requirement Dummy_Requirement { | ||
req.Tool_Definition Source_Input_Valid { | ||
title = '''Valid source input given''' | ||
description = ''' | ||
This is not really a requirement. It will be used only to generate a minimal tracing report for each tool. | ||
It can be deleted as soon as all the tools get their real requirements. | ||
Valid source input means that the tool was called with | ||
a list of terms as a command line argument. | ||
Each term is an existing file or an existing directory path | ||
''' | ||
} | ||
|
||
req.Software_Requirement Dummy_Requirement_Unit_Test { | ||
req.Tool_Definition No_Source_Input { | ||
title = '''No source input given''' | ||
description = ''' | ||
This is not really a requirement. It will be used only to generate a minimal tracing report for each tool. | ||
It can be deleted as soon as all the tools get their real requirements. | ||
No source input means that the tool was called with nothing specified | ||
in the command line argument. | ||
''' | ||
} | ||
|
||
req.Tool_Definition Source_Inputs_Invalid { | ||
title = '''Invalid source input given''' | ||
description = ''' | ||
Invalid source input means that the tool was called with | ||
a list of terms as a command line argument. | ||
At least one term is an non-existent file or an non-existent directory path | ||
''' | ||
} | ||
|
||
req.Tool_Definition Source_Input_Files { | ||
title = '''Source input files given''' | ||
description = ''' | ||
Valid existing source input files in the case of [[Source_Inputs_Valid]] | ||
''' | ||
} | ||
|
||
req.Tool_Definition Config_File { | ||
title = '''Config file''' | ||
description = ''' | ||
This file consists of the configuration of the tool. | ||
''' | ||
} | ||
|
||
req.Tool_Config_Parameter Source_Input_File_Paths { | ||
description = ''' | ||
The input terms can be specified in space separated format | ||
as a command line argument. | ||
Only files ending on [".cpp", ".cc", ".c", ".h"] are considered. | ||
''' | ||
} | ||
|
||
req.Tool_Config_Parameter Config_File_Path { | ||
description = ''' | ||
This parameter specifies the path to [[Config_File]]. | ||
''' | ||
} | ||
|
||
req.System_Requirement Valid_Source_Input_File_Paths { | ||
description = ''' | ||
If [[Source_Inputs_Valid]] and [[Config_File_Path]] is specified, the output file/s containing the extracted tests | ||
from [[Source_Input_Files]] will be written with user-specific markers to the file specified in [[Config_File]]. | ||
''' | ||
} | ||
|
||
req.System_Requirement_Else No_Source_Input_File_Path { | ||
description = ''' | ||
Else if [[No_Source_Input]], the tool shall exit with return code 1. | ||
''' | ||
} | ||
|
||
req.System_Requirement_Else Invalid_Source_Input_File_Paths { | ||
description = ''' | ||
Else if [[Source_Inputs_Invalid]], the tool shall exit with return code 1. | ||
''' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
tests-system/lobster-cpptest/data/other-data/test_case.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
|
||
/** ensure version are parsed correctly */ | ||
|
||
/// @version 1 | ||
TEST(VersionTagTest, VersionTagTestInOnline) {} | ||
|
||
/// @version 1, 42 | ||
TEST(VersionTagTest, MultipleVersionTagTestInOnline) {} | ||
|
||
/// @requirement CB-#0815 | ||
/// @version 12, 70 | ||
TEST(VersionTagTest, MoreVersionsThanRequirements) {} | ||
|
||
/// @requirement CB-#0815, CB-#0816 | ||
/// @version 28 | ||
TEST(VersionTagTest, MoreRequirementsThanVersions) {} | ||
|
||
/// @requirement CB-#123 CB-#456 | ||
/// @version 28 99 | ||
TEST(VersionTagTest, VersionSpaceSeparated) {} | ||
|
||
/** ensure everything is parsed correctly at once */ | ||
|
||
/// | ||
/// @test foo | ||
/// @brief this test tests something | ||
/// @version 42, 2 | ||
/// @requirement CB-#0815, CB-#0816 | ||
/// @requiredby FOO0::BAR0 | ||
/// @testmethods TM_BOUNDARY, TM_REQUIREMENT | ||
/// | ||
TEST(AllTogetherTest, ImplementationMultipleLines) { | ||
EXPECT_EQ(true, DummyFunctionForValidCondition()); | ||
} | ||
|
||
/** | ||
* commented test cases | ||
*/ | ||
// TEST(LayoutTest1, SingleComment){} | ||
/* TEST(LayoutTest2, InlineComment){} */ | ||
/* | ||
* TEST(LayoutTest2, Comment) {} | ||
*/ | ||
|
||
/** | ||
* invalid test cases | ||
* the following tests should not be parsed | ||
* as valid test cases | ||
*/ | ||
TEST(InvalidTest1,) {} | ||
TEST(, InvalidTest2) {} | ||
TEST(,) {} | ||
TEST() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,183 @@ | ||
/** ensure all desired test macros are parsed */ | ||
|
||
TEST_P_INSTANCE(TestMacrosTest, TestPInstance) {} | ||
TEST(TestMacrosTest, TestTest) {} | ||
TEST_F(TestMacrosTest1, TestTestF) {} | ||
TEST_P(TestMacrosTest1, TestTestP) {} | ||
TYPED_TEST(TestMacrosTest2, TestTypedTest) {} | ||
TYPED_TEST_P(TestMacrosTest2, TestTypedTestP) {} | ||
TYPED_TEST_SUITE(TestMacrosTest2, TestTypedTestSuite) {} | ||
TEST_F_INSTANCE(TestMacrosTest3, TestFInstance) {} | ||
|
||
/** ensure test implementation is correctly parsed */ | ||
|
||
TEST( | ||
ImplementationTest, | ||
TestMultiLine | ||
) {} | ||
|
||
TEST(ImplementationTest, EmptyImplementation) {} | ||
|
||
TEST(ImplementationTest, ImplementationMultipleLines) { | ||
EXPECT_EQ(true, DummyFunctionForValidCondition()); | ||
} | ||
|
||
TEST(ImplementationTest, MultipleLinesWithComments) | ||
{ | ||
// Some comments | ||
EXPECT_EQ(true, DummyFunctionForValidCondition()); | ||
// Some other comments | ||
} | ||
|
||
/** ensure test tag is correctly parsed */ | ||
|
||
/// @test foo1 | ||
TEST(TestTagTest, TestTagInOnline) {} | ||
|
||
/// | ||
/// @test foo2 | ||
TEST(TestTagTest, TestTagPrecededByComment) {} | ||
|
||
/// @test foo3 | ||
/// | ||
TEST(TestTagTest, TestTagFollowedByComment) {} | ||
|
||
/// | ||
/// @test foo4 | ||
/// | ||
TEST(TestTagTest, TestTagWithCommentsAround) {} | ||
|
||
/// @test lorem ipsum | ||
TEST(TestTagTest, TestTagAsText) {} | ||
|
||
/** ensure brief are parsed correctly */ | ||
|
||
/// @brief Some nasty bug1 | ||
TEST(BriefTagTest, BriefTagInOnline) {} | ||
|
||
/// @brief This is a brief field | ||
/// with a long description | ||
TEST(BriefTagTest, BriefTagMultipleLines) {} | ||
|
||
/** ensure requirement tags are parse correctly */ | ||
|
||
/// @requirement CB-#0815 | ||
TEST(RequirementTagTest, Requirement) {} | ||
|
||
/** @requirement CB-#0815 CB-#0816 */ | ||
TEST(RequirementTagTest1, RequirementAsOneLineComments) {} | ||
|
||
/** | ||
* @requirement CB-#0815 CB-#0816 | ||
*/ | ||
TEST(RequirementTagTest1, RequirementAsComments) {} | ||
|
||
/** | ||
* @requirement CB-#0815, CB-#0816, | ||
* CB-#0817 | ||
* @requirement CB-#0818 CB-#0819 | ||
* CB-#0820 | ||
*/ | ||
TEST(RequirementTagTest1, RequirementsAsMultipleComments) {} | ||
|
||
/// | ||
/// @requirement https://codebeamer.company.net/cb/issue/0815 | ||
/// | ||
TEST(RequirementTagTest2, URLRequirement) {} | ||
|
||
/// | ||
/// @requirement https://codebeamer.company.net/cb/issue/0815, | ||
/// https://codebeamer.company.net/cb/issue/0816 | ||
/// | ||
TEST(RequirementTagTest2, URLRequirementsCommaSeparated) {} | ||
|
||
/** | ||
* @requirement https://codebeamer.company.net/cb/issue/0815 | ||
* https://codebeamer.company.net/cb/issue/0816 | ||
*/ | ||
TEST(RequirementTagTest2, URLRequirementsAsCommentsSpaceSeparated) {} | ||
|
||
/** | ||
* @requirement https://codebeamer.company.net/cb/issue/0815, https://codebeamer.company.net/cb/issue/0816 | ||
* @requirement https://codebeamer.company.net/cb/issue/0817 | ||
* https://codebeamer.company.net/cb/issue/0818 | ||
*/ | ||
TEST(RequirementTagTest2, MultipleURLRequirements) {} | ||
|
||
/// | ||
/// @requirement https://codebeamer.company.net/cb/issue/0815 | ||
/// @requirement CB-#0816 | ||
/// | ||
TEST(RequirementTagTest3, MixedRequirements) {} | ||
|
||
/// | ||
/// @requirement something_arbitrary | ||
/// | ||
TEST(RequirementTagTest4, InvalidRequirement) {} | ||
|
||
/// | ||
/// @requirement | ||
/// | ||
TEST(RequirementTagTest4, MissingRequirementReference) {} | ||
|
||
/** ensure required-by tags are parsed correctly */ | ||
|
||
/// | ||
/// @requiredby FOO0::BAR0 | ||
/// | ||
TEST(RequirementByTest1, RequiredByWithAt) {} | ||
|
||
/// | ||
/// @requiredby FOO0::BAR0, FOO1::BAR1 | ||
/// | ||
TEST(RequirementByTest1, MultipleRequiredByCommaSeparated) {} | ||
|
||
/** | ||
* @requiredby FOO0::BAR0, FOO1::BAR1, | ||
* FOO2::BAR2 | ||
* @requiredby FOO3::BAR3 FOO4::BAR4, | ||
* FOO5::BAR5 | ||
* @requiredby FOO6::BAR6 FOO7::BAR7 | ||
* FOO8::BAR8 | ||
*/ | ||
TEST(RequirementByTest1, MultipleRequiredByAsComments) {} | ||
|
||
/// @test lorem ipsum | ||
/// @requiredby FOO0::BAR0, | ||
/// FOO1::BAR1, | ||
/// FOO2::BAR2, | ||
/// FOO3::BAR3, | ||
/// FOO4::BAR4, | ||
/// FOO5::BAR5, | ||
/// FOO6::BAR6, | ||
/// FOO7::BAR7, | ||
/// FOO8::BAR8 | ||
/// | ||
TEST(RequirementByTest2, RequiredByWithNewLines) {} | ||
|
||
/** ensure testmethods are parsed correctly */ | ||
|
||
/// @testmethods TM_REQUIREMENT | ||
TEST(TestMethodsTagTest, TestMethod) {} | ||
|
||
/** | ||
* @testmethods TM_PAIRWISE TM_BOUNDARY | ||
*/ | ||
TEST(TestMethodsTagTest2, TestMethodAsCommentsSpaceSeparated) {} | ||
|
||
/// @testmethods TM_REQUIREMENT, TM_EQUIVALENCE | ||
TEST(TestMethodsTagTest2, TestMethodAsCommentsCommaSeparated) {} | ||
|
||
// /// @testmethods TM_REQUIREMENT, TM_EQUIVALENCE | ||
// /// @testmethods TM_BOUNDARY, TM_CONDITION | ||
// TEST(TestMethodsTagTest2, TestMethodAsCommentsMultipleLines) {} | ||
|
||
/// | ||
/// @testmethods something_arbitrary | ||
/// | ||
TEST(TestMethodsTagTest3, InvalidTestMethod) {} | ||
|
||
/// | ||
/// @testmethods | ||
/// | ||
TEST(TestMethodsTagTest4, MissingTestMethod) {} |
1 change: 1 addition & 0 deletions
1
...id-source-input-file-paths/invalid-directory-input-scenario/expected-output/exit-code.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
2 |
File renamed without changes.
2 changes: 2 additions & 0 deletions
2
...valid-source-input-file-paths/invalid-directory-input-scenario/expected-output/stderr.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
usage: lobster-cpptest [-h] --config-file CONFIG_FILE FILE|DIR [FILE|DIR ...] | ||
lobster-cpptest: error: "../../../dattta" is not a file or directory. |
Empty file.
2 changes: 2 additions & 0 deletions
2
...ptest/rbt-invalid-source-input-file-paths/invalid-directory-input-scenario/input/args.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
../../../dattta | ||
--config-file=cpptest_output.conf |
10 changes: 10 additions & 0 deletions
10
...nvalid-source-input-file-paths/invalid-directory-input-scenario/input/cpptest_output.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"output": { | ||
"output.lobster" : | ||
{ | ||
"markers": ["@requirement"], | ||
"kind": "req" | ||
} | ||
}, | ||
"codebeamer_url": "https://codebeamer.com" | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A question here:
Source_Inputs_Valid
is given if all input files and directories exist.Source_Input_Files
is given if all input files and directories exist and the files are C++ files. Is this the intention here?If not, then what is the difference between these two definitions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Source_Inputs_Valid
is a boolean definition that indicates "is the given input valid?". Thats why we used it in if statementSource_Input_Files
is the file/s themselves if the given input is valid. We used it in the description of our requirement.