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

Merge Fixes for physical test #45

Draft
wants to merge 25 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
1c24089
dont drive short test route forever
BLuedtke Aug 5, 2024
5c32aa7
Added section in test readme remarking issue with feedback gathering …
uniba-swt-management Aug 7, 2024
b451c97
fix possible read from unitialized var (not directly related to physi…
BLuedtke Nov 27, 2024
22d5b6e
improve accessory feedback recording and add some logging utilities
BLuedtke Nov 27, 2024
6d42374
add debug logs for swtbahn-full testing track output and power states
BLuedtke Nov 27, 2024
3928a69
update function name in readme
BLuedtke Nov 27, 2024
3083140
fix year
BLuedtke Nov 27, 2024
2b44b56
add debug stuff to full physical test
BLuedtke Nov 27, 2024
2cd00d0
Merge branch 'master' into fix-physical-test
BLuedtke Dec 4, 2024
75a0ce3
consistency for physical testsuites, improvements on checking point s…
BLuedtke Dec 4, 2024
cf45862
point aspect validation for swtbahn-standard physical test + bugfix
BLuedtke Dec 4, 2024
77fdf25
Merge branch 'master' into fix-physical-test
BLuedtke Dec 5, 2024
eec2489
fix oversight in merging master into fix-physical-test
BLuedtke Dec 5, 2024
1575444
added "is bidib running" util and a physical test occupancy observer/…
BLuedtke Dec 5, 2024
6351b60
prototype for checking if bidib is still running during test exec
BLuedtke Dec 5, 2024
5686a72
helper function for setting and checking points, and for setting signals
BLuedtke Dec 6, 2024
3bfc75f
more observer prototyping
BLuedtke Dec 6, 2024
b3ae4a3
wrapper for testsuite drive and observe
BLuedtke Dec 6, 2024
addbca8
node state adjustment: allow more responses to be queued.
BLuedtke Dec 6, 2024
22960ba
reverted large amount of responses to not overload node, reduce log l…
BLuedtke Dec 6, 2024
fea8069
fix missing conditional negation and missing linebreaks in printf
BLuedtke Dec 6, 2024
a53717c
fix typo
BLuedtke Dec 6, 2024
e97938e
adjust second train end of route
BLuedtke Dec 6, 2024
ffbd7bf
add observer heartbeat
BLuedtke Dec 6, 2024
6f103ae
minor sleep and speed test adjustments
BLuedtke Dec 6, 2024
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
10 changes: 9 additions & 1 deletion include/highlevel/bidib_highlevel_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,20 @@ uint8_t *bidib_read_error_message(void);
*/
void bidib_flush(void);

/**
* Check if bidib is currently running.
*
* @return true if bidib is running
* @return false otherwise
*/
bool bidib_is_running();

/**
* Customised syslog function to prepend libbidib to log messages.
* This is needed to differentiate log messages that originate from this bidib
* library or from a user application.
*/
void syslog_libbidib(int priority, const char *format, ...);
void syslog_libbidib(int priority, const char *format, ...);


#endif
4 changes: 4 additions & 0 deletions src/highlevel/bidib_highlevel_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,10 @@ void bidib_stop(void) {
}
}

bool bidib_is_running() {
return bidib_running;
}

void syslog_libbidib(int priority, const char *format, ...) {
char string[1024];
va_list arg;
Expand Down
10 changes: 9 additions & 1 deletion src/state/bidib_state_setter.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,22 @@ void bidib_state_accessory_state(t_bidib_node_address node_address, uint8_t numb
free(accessory_state->data.state_id);
}
accessory_state->data.state_id = NULL;
t_bidib_aspect *aspect_mapping;
t_bidib_aspect *aspect_mapping = NULL;
for (size_t i = 0; i < accessory_mapping->aspects->len; i++) {
aspect_mapping = &g_array_index(accessory_mapping->aspects, t_bidib_aspect, i);
if (aspect_mapping->value == aspect) {
accessory_state->data.state_id = strdup(aspect_mapping->id->str);
break;
}
}
if (aspect_mapping == NULL) {
syslog_libbidib(LOG_ERR,
"bidib_state_accessory_state: aspect mapping for accessory %s is NULL",
accessory_mapping->id->str);
pthread_rwlock_unlock(&bidib_boards_rwlock);
pthread_mutex_unlock(&trackstate_accessories_mutex);
return;
}
if (accessory_state->data.state_id == NULL) {
syslog_libbidib(LOG_WARNING,
"Aspect 0x%02x of accessory %s is not mapped in config files",
Expand Down
3 changes: 1 addition & 2 deletions test/physical/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ For each point and signal, the `bidib_switch_point()` and `bidib_set_signal()`
functions are used to set their aspect.

The `t_testsuite_point_result` struct records the feedback state returned by a point, and is
updated by the `testsuite_logTestResult()` function. The following is an example of the
updated by the `testsuite_recordTestResult()` function. The following is an example of the
feedback that is logged for a point:

```
Expand All @@ -80,7 +80,6 @@ point10
-> unknownState: 0
```


## Dependencies

**SWTbahn Platform**
Expand Down
12 changes: 10 additions & 2 deletions test/physical/swtbahn-full/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,16 @@ int main(int argc, char **argv) {

printf("testsuite: Test case %d\n", atoi(argv[1]));
t_testsuite_test_result *result = testsuite_initTestSuite();

const int repetitions = atoi(argv[2]);

// For cases 1-3, the track output state is set to OFF,
// as they do not involve any trains that should be driving around.
// If a previous test was aborted/failed/crashed, the system might not have
// been shut down properly, so trains might still have a set speed.
// In a new test execution, trains would then start to drive around.
// With the track output set to off, that's not a problem, and thus
// test cases 1-3 can be run even when a prior execution did not shut
// down properly.
switch (atoi(argv[1])) {
case 1:
bidib_set_track_output_state_all(BIDIB_CS_OFF);
Expand Down Expand Up @@ -168,7 +176,7 @@ void printWelcome() {
"* SWTbahn-testsuite *",
"* *",
"************************",
"* UniBa-SWT-2023 *",
"* UniBa-SWT-2024 *",
"************************",
""
};
Expand Down
Loading
Loading