Skip to content

Commit

Permalink
prototype for checking if bidib is still running during test exec
Browse files Browse the repository at this point in the history
  • Loading branch information
BLuedtke committed Dec 5, 2024
1 parent 1575444 commit 6351b60
Showing 1 changed file with 40 additions and 1 deletion.
41 changes: 40 additions & 1 deletion test/physical/swtbahn-full/testsuite.c
Original file line number Diff line number Diff line change
Expand Up @@ -578,11 +578,15 @@ static void *route99(void *arg) {

obs1_info->stop_requested = true;
pthread_join(route99_observer_thread, NULL);
if (!bidib_is_running()) {
printf("testsuite: route99 - stop, bidib is not running anymore");
free_obs_info_util(obs1_info);
pthread_exit(NULL);
}

testsuite_set_signal("signal30", "aspect_stop");



obs1_info->stop_requested = false;
free(obs1_info->forbidden_segment);
obs1_info->forbidden_segment = strdup("seg66"); // skip 1 to give enough time for drive_to.
Expand All @@ -592,6 +596,11 @@ static void *route99(void *arg) {

obs1_info->stop_requested = true;
pthread_join(route99_observer_thread, NULL);
if (!bidib_is_running()) {
printf("testsuite: route99 - stop, bidib is not running anymore");
free_obs_info_util(obs1_info);
pthread_exit(NULL);
}

testsuite_set_signal("signal33", "aspect_stop");
testsuite_set_signal("signal35a", "aspect_stop");
Expand All @@ -607,6 +616,11 @@ static void *route99(void *arg) {

obs1_info->stop_requested = true;
pthread_join(route99_observer_thread, NULL);
if (!bidib_is_running()) {
printf("testsuite: route99 - stop, bidib is not running anymore");
free_obs_info_util(obs1_info);
pthread_exit(NULL);
}

testsuite_set_signal("signal37", "aspect_stop");

Expand All @@ -620,11 +634,21 @@ static void *route99(void *arg) {

obs1_info->stop_requested = true;
pthread_join(route99_observer_thread, NULL);
if (!bidib_is_running()) {
printf("testsuite: route99 - stop, bidib is not running anymore");
free_obs_info_util(obs1_info);
pthread_exit(NULL);
}

sleep(1);
testsuite_driveToStop("seg47", 20, train1);

sleep(4);
if (!bidib_is_running()) {
printf("testsuite: route99 - stop, bidib is not running anymore");
free_obs_info_util(obs1_info);
pthread_exit(NULL);
}

// train1: backwards
testsuite_set_signal("signal26", "aspect_go");
Expand All @@ -644,6 +668,11 @@ static void *route99(void *arg) {

obs1_info->stop_requested = true;
pthread_join(route99_observer_thread, NULL);
if (!bidib_is_running()) {
printf("testsuite: route99 - stop, bidib is not running anymore");
free_obs_info_util(obs1_info);
pthread_exit(NULL);
}

testsuite_set_signal("signal26", "aspect_stop");

Expand All @@ -657,6 +686,11 @@ static void *route99(void *arg) {

obs1_info->stop_requested = true;
pthread_join(route99_observer_thread, NULL);
if (!bidib_is_running()) {
printf("testsuite: route99 - stop, bidib is not running anymore");
free_obs_info_util(obs1_info);
pthread_exit(NULL);
}

testsuite_set_signal("signal38", "aspect_stop");
testsuite_set_signal("signal36", "aspect_stop");
Expand All @@ -670,6 +704,11 @@ static void *route99(void *arg) {
testsuite_driveTo("seg62", -50, train1);
obs1_info->stop_requested = true;
pthread_join(route99_observer_thread, NULL);
if (!bidib_is_running()) {
printf("testsuite: route99 - stop, bidib is not running anymore");
free_obs_info_util(obs1_info);
pthread_exit(NULL);
}

testsuite_set_signal("signal34", "aspect_stop");
testsuite_set_signal("signal32", "aspect_stop");
Expand Down

0 comments on commit 6351b60

Please sign in to comment.