ETSI's Bug Tracker - Part 01: TTCN-3 Core Language
View Issue Details

ID | Project | Category | View Status | Date Submitted | Last Update
0007994 | Part 01: TTCN-3 Core Language | New Feature | public | 08-12-2020 12:03 | 07-12-2022 08:20

Reporter | Jacob Wieland - Spirent |
Assigned To | Jens Grabowski |
Priority | normal | Severity | minor | Reproducibility | have not tried
Status | closed | Resolution | won't fix |
Platform |  | OS |  | OS Version |
Product Version |  |
Target Version |  | Fixed in Version |  |
Clause Reference(s) | ?
Source (company - Author) | Spirent - Jacob Wieland

Summary | 0007994: Allow coordinated shared access to component variables.

Description

At the moment, there are no shared global variables in TTCN-3. If data are to be shared, they must be communicated over message channels between components, causing the usual problems of keeping everything in sync. This obfuscates the intention of the test code and makes it unmanageable.
We propose a new statement of the form
on <component-ref> [@readonly] StatementBlock
where inside StatementBlock expressions of the form <component-ref>.<component-var> are allowed, in case of a @readonly on-statement only on the right-hand side, otherwise also on the left hand side of assignments (i.e. also as out parameters to functions).
An on-statement can only be entered if the referenced component itself is either not running a behavior or is in the waiting state of an alt-statement, and no other component is inside an write-on-statement block. A write-on-statement block can also not be entered if at least one other component is in a readonly on-statement. readonly on-statements are not mutually exclusive, though, so concurrent read-access is possible.
For example:
on inventoryComp { // acquire read-write lock on inventoryComp
if (inventoryCom.inventory > 0) {
inventoryComp.inventory := inventoryComp.inventory - 1;
state := "in_stock";
} else {
state := "out_of_stock";
}
sut.send("purchase");
alt {
[] sut.receive(state) { setverdict(pass) }
[] sut.receive { setverdict(fail) }
}
} // leave on-block and release read-write-lock of inventoryComp

Steps To Reproduce | This idea was developed for a use case of concurrent testing of web-service where one PTC can change the state of the SUT and thus a global oracle needs to be updated so that the other PTCs know what response of the SUT to expect. See the paper discussing different approaches to solve this problem here: https://www.thinkmind.org/articles/soft_v13_n34_2020_7.pdf [^]
Additional Information |
Tags | No tags attached.
Relationships |
Attached Files |

Issue History
Date Modified | Username | Field | Change
08-12-2020 12:03 | Jacob Wieland - Spirent | New Issue |
08-12-2020 12:06 | Jacob Wieland - Spirent | Note Added: 0015810 |
09-12-2020 09:09 | Jens Grabowski | Project | TTCN-3 Change Requests => Part 01: TTCN-3 Core Language
09-12-2020 09:32 | Jens Grabowski | Assigned To | => Jacob Wieland - Spirent
09-12-2020 09:32 | Jens Grabowski | Status | new => assigned
09-12-2020 09:33 | Jens Grabowski | Assigned To | Jacob Wieland - Spirent => Tomas Urban
10-12-2020 13:49 | Jacob Wieland - Spirent | Note Added: 0015842 |
18-12-2020 15:39 | Gyorgy Rethy | Note Added: 0015894 |
10-09-2021 14:32 | Jens Grabowski | Note Added: 0015983 |
10-09-2021 14:32 | Jens Grabowski | Assigned To | Tomas Urban => Gusztáv Adamis
10-11-2021 12:36 | Jens Grabowski | Note Added: 0016052 |
10-11-2021 12:36 | Jens Grabowski | Assigned To | Gusztáv Adamis => Jacob Wieland - Spirent
11-11-2021 15:06 | Jacob Wieland - Spirent | Steps to Reproduce Updated | bug_revision_view_page.php?rev_id=574#r574
11-11-2021 15:06 | Jacob Wieland - Spirent | Note Added: 0016068 |
11-11-2021 15:07 | Jacob Wieland - Spirent | Assigned To | Jacob Wieland - Spirent => Gusztáv Adamis
17-08-2022 08:09 | Jens Grabowski | Assigned To | Gusztáv Adamis => Matthias Simon
10-11-2022 20:51 | Matthias Simon | Note Added: 0016300 |
10-11-2022 20:53 | Matthias Simon | Assigned To | Matthias Simon => Jens Grabowski
07-12-2022 08:20 | Jens Grabowski | Note Added: 0016362 |
07-12-2022 08:20 | Jens Grabowski | Status | assigned => closed
07-12-2022 08:20 | Jens Grabowski | Resolution | open => won't fix

Notes

(0015810)
Jacob Wieland - Spirent
08-12-2020 12:06

In the object-oriented setting, this feature could also grant access to call methods in another component's objects.

(0015842)
Jacob Wieland - Spirent
10-12-2020 13:49

Concerns so far:
1) New/additional way of communication/data transfer between components.
2) Maybe too coarse on the component level, possibly the concept of a (readonly or read-write) monitor associated with variables to be accessible through it should be introduced.
The on statement would then work on that monitor.
The component could be a default monitor allowing access to its members.
In this approach, also the owning component needs to access its monitored variables through the monitor, i.e. it would also need to use on-blocks in its own behaviour (though this added explicitness is probably a good thing). With the originally proposed approach, this is implicitly done with the 'runs on' clause.
3) Maybe access to variables should be somehow explicitly granted in the component or class definition so that normal members can not be accessed by foreign components but specifically accessible members can be. That way, the implementation has full control over its internal variables and exposes only those it wants others to access/change. Needs a new "external accessibility" concept similar to visibility. Access could be granted as readonly or read-write.
This would also make it easier to implement performantly as otherwise, monitoring capabilities would need to be provided potentially for all component members.
4) Changing the variable holding the component/monitor reference in an on-block shall be disallowed to ensure static checkability.

(0015894)
Gyorgy Rethy
18-12-2020 15:39

Global variables were available in TTCN-2/TTCN-2+. It was an deliberate design decision NOT TO INCLUDE GLOBAL VARIABLES in TTCN-3, due to the bad experience in TTCN-2. In case of distributed test environment, what is very common, they would result execution ambiguity due to race conditions, what would hurt one of the basic principles of testing: repeatability. Ericsson doesn't support this idea.

(0015983)
Jens Grabowski
10-09-2021 14:32

STF discussion: will be discussed during the next session.

(0016052)
Jens Grabowski
10-11-2021 12:36

STF discussion: Jacob to provide complete use case and further information (link to paper) about the proposal. Proposal: implement feature in deployment and configuration package.

(0016068)
Jacob Wieland - Spirent
11-11-2021 15:06

Added a link to the paper in (Steps to Reproduce above).

(0016300)
Matthias Simon
10-11-2022 20:51

Access to component variables seems like a good compromise to create a shared state without global variables. However I don't support this CR, because there are still too many open questions.

(0016362)
Jens Grabowski
07-12-2022 08:20

TTF discussion: The TTF decides to close the topic. More examples of usage would be helpful. The CR may be reopened in case of new insights.