From ce7b34d0317cbb45c680cc7be2772a8a0538cd26 Mon Sep 17 00:00:00 2001 From: deadprogram Date: Mon, 24 Apr 2017 18:25:47 +0200 Subject: [PATCH] aio: correct order for test to avoid race Signed-off-by: deadprogram --- drivers/aio/analog_sensor_driver_test.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/aio/analog_sensor_driver_test.go b/drivers/aio/analog_sensor_driver_test.go index aef0837ab..c20bad370 100644 --- a/drivers/aio/analog_sensor_driver_test.go +++ b/drivers/aio/analog_sensor_driver_test.go @@ -40,12 +40,6 @@ func TestAnalogSensorDriverStart(t *testing.T) { a := newAioTestAdaptor() d := NewAnalogSensorDriver(a, "1") - // send data - a.TestAdaptorAnalogRead(func() (val int, err error) { - val = 100 - return - }) - gobottest.Assert(t, d.Start(), nil) // expect data to be received @@ -54,6 +48,12 @@ func TestAnalogSensorDriverStart(t *testing.T) { sem <- true }) + // send data + a.TestAdaptorAnalogRead(func() (val int, err error) { + val = 100 + return + }) + select { case <-sem: case <-time.After(1 * time.Second):