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

fix: fix heisenbug and simplify tests #12

Merged

Conversation

eduardacoppo
Copy link

@eduardacoppo eduardacoppo commented Feb 19, 2025

This PR fixes this heisenbug:

1) Failure:
 OroGen.linux_gpios.Task::using 'init' connection#test_0001_does not keep last written value when a new connection is established without 'init: true' [/buildbot/wetpaint-build/build/drivers/orogen/linux_gpios/test/task_test.rb:216]:
 1 unmet expectations
 OroGen.linux_gpios.Task<id:162>(conf: ["default"], name: state, orocos_name: state_task_under_test, read_only: false).r_states should not have received a new sample, but it received one: {
   time=2025-02-17 18:13:31.464762 +0000,
   states=[{
      time=2025-02-17 18:13:31.464762 +0000,
      data=0
  }]
}

and simplifies the tests.

A heisenbug was happening in the "does not keep last written value when a new connection is established with 'init: false'" test. The test expected no samples, but got 1.
This was due to how the test was structured, specifically the fact that the write and the disconnect-connect block of code were inside the same expect_execution block, causing a race condition.

The tests were also simplified by using a data_reader instead of the previous, unnecessary complicated, setup.
@eduardacoppo eduardacoppo force-pushed the fix_heisenbug_in_tests branch from cc4c345 to 2c82ea0 Compare February 19, 2025 13:58
@jhonasiv jhonasiv requested review from doudou and jhonasiv February 19, 2025 14:35
@jhonasiv jhonasiv self-assigned this Feb 19, 2025
@jhonasiv jhonasiv assigned eduardacoppo and unassigned jhonasiv Feb 19, 2025
@doudou doudou merged commit a51d1bf into rock-drivers:gpio_default_period Feb 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants