* [libgpiod][PATCH 1/3] tests: don't use the same chip object from different threads
@ 2023-09-19 9:31 Bartosz Golaszewski
2023-09-19 9:31 ` [libgpiod][PATCH 2/3] bindings: cxx: tests: don't use the same chip " Bartosz Golaszewski
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Bartosz Golaszewski @ 2023-09-19 9:31 UTC (permalink / raw)
To: Kent Gibson, Linus Walleij, Andy Shevchenko, Viresh Kumar
Cc: linux-gpio, Bartosz Golaszewski, Erik Schilling
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
There are no thread-safety guarantees in libgpiod. Let's not reuse the
chip object created in one thread to generate info events in another but
create a second chip for that purpose instead.
Reported-by: Erik Schilling <erik.schilling@linaro.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
tests/tests-info-event.c | 62 +++++++++++++++++++++-------------------
1 file changed, 33 insertions(+), 29 deletions(-)
diff --git a/tests/tests-info-event.c b/tests/tests-info-event.c
index d069811..cbd9e9e 100644
--- a/tests/tests-info-event.c
+++ b/tests/tests-info-event.c
@@ -49,43 +49,59 @@ GPIOD_TEST_CASE(event_timeout)
}
struct request_ctx {
- struct gpiod_chip *chip;
- struct gpiod_line_config *line_cfg;
- struct gpiod_line_settings *settings;
+ const char *path;
guint offset;
};
static gpointer request_reconfigure_release_line(gpointer data)
{
+ g_autoptr(struct_gpiod_line_settings) settings = NULL;
+ g_autoptr(struct_gpiod_line_config) line_cfg = NULL;
g_autoptr(struct_gpiod_line_request) request = NULL;
+ g_autoptr(struct_gpiod_chip) chip = NULL;
struct request_ctx *ctx = data;
gint ret;
+ chip = gpiod_chip_open(ctx->path);
+ g_assert_nonnull(chip);
+ if (g_test_failed())
+ return NULL;
+
+ line_cfg = gpiod_line_config_new();
+ g_assert_nonnull(line_cfg);
+ if (g_test_failed())
+ return NULL;
+
+ settings = gpiod_line_settings_new();
+ g_assert_nonnull(settings);
+ if (g_test_failed())
+ return NULL;
+
g_usleep(1000);
- ret = gpiod_line_config_add_line_settings(ctx->line_cfg, &ctx->offset,
- 1, ctx->settings);
+ ret = gpiod_line_config_add_line_settings(line_cfg, &ctx->offset,
+ 1, settings);
g_assert_cmpint(ret, ==, 0);
if (g_test_failed())
return NULL;
- request = gpiod_chip_request_lines(ctx->chip, NULL, ctx->line_cfg);
+ request = gpiod_chip_request_lines(chip, NULL, line_cfg);
g_assert_nonnull(request);
if (g_test_failed())
return NULL;
g_usleep(1000);
- gpiod_line_config_reset(ctx->line_cfg);
- gpiod_line_settings_set_direction(ctx->settings,
+ gpiod_line_config_reset(line_cfg);
+ gpiod_line_settings_set_direction(settings,
GPIOD_LINE_DIRECTION_OUTPUT);
- ret = gpiod_line_config_add_line_settings(ctx->line_cfg, &ctx->offset,
- 1, ctx->settings);
+ ret = gpiod_line_config_add_line_settings(line_cfg, &ctx->offset,
+ 1, settings);
g_assert_cmpint(ret, ==, 0);
if (g_test_failed())
return NULL;
- ret = gpiod_line_request_reconfigure_lines(request, ctx->line_cfg);
+ ret = gpiod_line_request_reconfigure_lines(request, line_cfg);
g_assert_cmpint(ret, ==, 0);
if (g_test_failed())
return NULL;
@@ -106,25 +122,19 @@ GPIOD_TEST_CASE(request_reconfigure_release_events)
g_autoptr(struct_gpiod_info_event) request_event = NULL;
g_autoptr(struct_gpiod_info_event) reconfigure_event = NULL;
g_autoptr(struct_gpiod_info_event) release_event = NULL;
- g_autoptr(struct_gpiod_line_config) line_cfg = NULL;
- g_autoptr(struct_gpiod_line_settings) settings = NULL;
g_autoptr(GThread) thread = NULL;
struct gpiod_line_info *request_info, *reconfigure_info, *release_info;
guint64 request_ts, reconfigure_ts, release_ts;
struct request_ctx ctx;
+ const char *chip_path = g_gpiosim_chip_get_dev_path(sim);
gint ret;
- chip = gpiod_test_open_chip_or_fail(g_gpiosim_chip_get_dev_path(sim));
- line_cfg = gpiod_test_create_line_config_or_fail();
- settings = gpiod_test_create_line_settings_or_fail();
-
+ chip = gpiod_test_open_chip_or_fail(chip_path);
info = gpiod_test_chip_watch_line_info_or_fail(chip, 3);
g_assert_false(gpiod_line_info_is_used(info));
- ctx.chip = chip;
- ctx.line_cfg = line_cfg;
- ctx.settings = settings;
+ ctx.path = chip_path;
ctx.offset = 3;
thread = g_thread_new("request-release",
@@ -199,26 +209,20 @@ GPIOD_TEST_CASE(chip_fd_can_be_polled)
g_autoptr(struct_gpiod_chip) chip = NULL;
g_autoptr(struct_gpiod_line_info) info = NULL;
g_autoptr(struct_gpiod_info_event) event = NULL;
- g_autoptr(struct_gpiod_line_config) line_cfg = NULL;
- g_autoptr(struct_gpiod_line_settings) settings = NULL;
g_autoptr(GThread) thread = NULL;
+ const char *chip_path = g_gpiosim_chip_get_dev_path(sim);
struct gpiod_line_info *evinfo;
struct request_ctx ctx;
struct timespec ts;
struct pollfd pfd;
gint ret, fd;
- chip = gpiod_test_open_chip_or_fail(g_gpiosim_chip_get_dev_path(sim));
- settings = gpiod_test_create_line_settings_or_fail();
- line_cfg = gpiod_test_create_line_config_or_fail();
-
+ chip = gpiod_test_open_chip_or_fail(chip_path);
info = gpiod_test_chip_watch_line_info_or_fail(chip, 3);
g_assert_false(gpiod_line_info_is_used(info));
- ctx.chip = chip;
- ctx.line_cfg = line_cfg;
- ctx.settings = settings;
+ ctx.path = chip_path;
ctx.offset = 3;
thread = g_thread_new("request-release",
--
2.39.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [libgpiod][PATCH 2/3] bindings: cxx: tests: don't use the same chip from different threads
2023-09-19 9:31 [libgpiod][PATCH 1/3] tests: don't use the same chip object from different threads Bartosz Golaszewski
@ 2023-09-19 9:31 ` Bartosz Golaszewski
2023-09-19 11:33 ` Erik Schilling
2023-09-19 9:31 ` [libgpiod][PATCH 3/3] bindings: python: " Bartosz Golaszewski
2023-09-19 11:33 ` [libgpiod][PATCH 1/3] tests: don't use the same chip object " Erik Schilling
2 siblings, 1 reply; 6+ messages in thread
From: Bartosz Golaszewski @ 2023-09-19 9:31 UTC (permalink / raw)
To: Kent Gibson, Linus Walleij, Andy Shevchenko, Viresh Kumar
Cc: linux-gpio, Bartosz Golaszewski, Erik Schilling
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
There are no thread-safety guarantees in libgpiod. Let's not reuse the
chip object created in one thread to generate info events in another but
create a second chip for that purpose instead.
Reported-by: Erik Schilling <erik.schilling@linaro.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
bindings/cxx/tests/tests-info-event.cpp | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/bindings/cxx/tests/tests-info-event.cpp b/bindings/cxx/tests/tests-info-event.cpp
index 249b1e8..21c0ef0 100644
--- a/bindings/cxx/tests/tests-info-event.cpp
+++ b/bindings/cxx/tests/tests-info-event.cpp
@@ -3,6 +3,7 @@
#include <catch2/catch.hpp>
#include <chrono>
+#include <filesystem>
#include <gpiod.hpp>
#include <sstream>
#include <thread>
@@ -17,11 +18,11 @@ using event_type = ::gpiod::info_event::event_type;
namespace {
-void request_reconfigure_release_line(::gpiod::chip& chip)
+void request_reconfigure_release_line(const ::std::filesystem::path& chip_path)
{
::std::this_thread::sleep_for(::std::chrono::milliseconds(10));
- auto request = chip
+ auto request = ::gpiod::chip(chip_path)
.prepare_request()
.add_line_settings(7, ::gpiod::line_settings())
.do_request();
@@ -48,7 +49,9 @@ TEST_CASE("Lines can be watched", "[info-event][chip]")
.set_num_lines(8)
.build();
- ::gpiod::chip chip(sim.dev_path());
+ const auto chip_path = sim.dev_path();
+
+ ::gpiod::chip chip(chip_path);
SECTION("watch_line_info() returns line info")
{
@@ -74,7 +77,7 @@ TEST_CASE("Lines can be watched", "[info-event][chip]")
REQUIRE(info.direction() == direction::INPUT);
- ::std::thread thread(request_reconfigure_release_line, ::std::ref(chip));
+ ::std::thread thread(request_reconfigure_release_line, ::std::ref(chip_path));
REQUIRE(chip.wait_info_event(::std::chrono::seconds(1)));
auto event = chip.read_info_event();
--
2.39.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [libgpiod][PATCH 3/3] bindings: python: tests: don't use the same chip from different threads
2023-09-19 9:31 [libgpiod][PATCH 1/3] tests: don't use the same chip object from different threads Bartosz Golaszewski
2023-09-19 9:31 ` [libgpiod][PATCH 2/3] bindings: cxx: tests: don't use the same chip " Bartosz Golaszewski
@ 2023-09-19 9:31 ` Bartosz Golaszewski
2023-09-19 11:33 ` Erik Schilling
2023-09-19 11:33 ` [libgpiod][PATCH 1/3] tests: don't use the same chip object " Erik Schilling
2 siblings, 1 reply; 6+ messages in thread
From: Bartosz Golaszewski @ 2023-09-19 9:31 UTC (permalink / raw)
To: Kent Gibson, Linus Walleij, Andy Shevchenko, Viresh Kumar
Cc: linux-gpio, Bartosz Golaszewski, Erik Schilling
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
There are no thread-safety guarantees in libgpiod. Let's not reuse the
chip object created in one thread to generate info events in another but
use a global request function instead.
Reported-by: Erik Schilling <erik.schilling@linaro.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
bindings/python/tests/tests_info_event.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/bindings/python/tests/tests_info_event.py b/bindings/python/tests/tests_info_event.py
index f3926d9..6bb09d5 100644
--- a/bindings/python/tests/tests_info_event.py
+++ b/bindings/python/tests/tests_info_event.py
@@ -37,9 +37,9 @@ class InfoEventDataclassBehavior(TestCase):
event.line_info = 4
-def request_reconfigure_release_line(chip, offset):
+def request_reconfigure_release_line(chip_path, offset):
time.sleep(0.1)
- with chip.request_lines(config={offset: None}) as request:
+ with gpiod.request_lines(chip_path, config={offset: None}) as request:
time.sleep(0.1)
request.reconfigure_lines(
config={offset: gpiod.LineSettings(direction=Direction.OUTPUT)}
@@ -95,7 +95,7 @@ class WatchingInfoEventWorks(TestCase):
self.assertEqual(info.direction, Direction.INPUT)
self.thread = threading.Thread(
- target=partial(request_reconfigure_release_line, self.chip, 7)
+ target=partial(request_reconfigure_release_line, self.sim.dev_path, 7)
)
self.thread.start()
--
2.39.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [libgpiod][PATCH 1/3] tests: don't use the same chip object from different threads
2023-09-19 9:31 [libgpiod][PATCH 1/3] tests: don't use the same chip object from different threads Bartosz Golaszewski
2023-09-19 9:31 ` [libgpiod][PATCH 2/3] bindings: cxx: tests: don't use the same chip " Bartosz Golaszewski
2023-09-19 9:31 ` [libgpiod][PATCH 3/3] bindings: python: " Bartosz Golaszewski
@ 2023-09-19 11:33 ` Erik Schilling
2 siblings, 0 replies; 6+ messages in thread
From: Erik Schilling @ 2023-09-19 11:33 UTC (permalink / raw)
To: Bartosz Golaszewski, Kent Gibson, Linus Walleij, Andy Shevchenko,
Viresh Kumar
Cc: linux-gpio, Bartosz Golaszewski
On Tue Sep 19, 2023 at 11:31 AM CEST, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
>
> There are no thread-safety guarantees in libgpiod. Let's not reuse the
> chip object created in one thread to generate info events in another but
> create a second chip for that purpose instead.
>
> Reported-by: Erik Schilling <erik.schilling@linaro.org>
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Erik Schilling <erik.schilling@linaro.org>
> ---
> tests/tests-info-event.c | 62 +++++++++++++++++++++-------------------
> 1 file changed, 33 insertions(+), 29 deletions(-)
>
> diff --git a/tests/tests-info-event.c b/tests/tests-info-event.c
> index d069811..cbd9e9e 100644
> --- a/tests/tests-info-event.c
> +++ b/tests/tests-info-event.c
> @@ -49,43 +49,59 @@ GPIOD_TEST_CASE(event_timeout)
> }
>
> struct request_ctx {
> - struct gpiod_chip *chip;
> - struct gpiod_line_config *line_cfg;
> - struct gpiod_line_settings *settings;
> + const char *path;
> guint offset;
> };
>
> static gpointer request_reconfigure_release_line(gpointer data)
> {
> + g_autoptr(struct_gpiod_line_settings) settings = NULL;
> + g_autoptr(struct_gpiod_line_config) line_cfg = NULL;
> g_autoptr(struct_gpiod_line_request) request = NULL;
> + g_autoptr(struct_gpiod_chip) chip = NULL;
> struct request_ctx *ctx = data;
> gint ret;
>
> + chip = gpiod_chip_open(ctx->path);
> + g_assert_nonnull(chip);
> + if (g_test_failed())
> + return NULL;
> +
> + line_cfg = gpiod_line_config_new();
> + g_assert_nonnull(line_cfg);
> + if (g_test_failed())
> + return NULL;
> +
> + settings = gpiod_line_settings_new();
> + g_assert_nonnull(settings);
> + if (g_test_failed())
> + return NULL;
> +
> g_usleep(1000);
>
> - ret = gpiod_line_config_add_line_settings(ctx->line_cfg, &ctx->offset,
> - 1, ctx->settings);
> + ret = gpiod_line_config_add_line_settings(line_cfg, &ctx->offset,
> + 1, settings);
> g_assert_cmpint(ret, ==, 0);
> if (g_test_failed())
> return NULL;
>
> - request = gpiod_chip_request_lines(ctx->chip, NULL, ctx->line_cfg);
> + request = gpiod_chip_request_lines(chip, NULL, line_cfg);
> g_assert_nonnull(request);
> if (g_test_failed())
> return NULL;
>
> g_usleep(1000);
>
> - gpiod_line_config_reset(ctx->line_cfg);
> - gpiod_line_settings_set_direction(ctx->settings,
> + gpiod_line_config_reset(line_cfg);
> + gpiod_line_settings_set_direction(settings,
> GPIOD_LINE_DIRECTION_OUTPUT);
> - ret = gpiod_line_config_add_line_settings(ctx->line_cfg, &ctx->offset,
> - 1, ctx->settings);
> + ret = gpiod_line_config_add_line_settings(line_cfg, &ctx->offset,
> + 1, settings);
> g_assert_cmpint(ret, ==, 0);
> if (g_test_failed())
> return NULL;
>
> - ret = gpiod_line_request_reconfigure_lines(request, ctx->line_cfg);
> + ret = gpiod_line_request_reconfigure_lines(request, line_cfg);
> g_assert_cmpint(ret, ==, 0);
> if (g_test_failed())
> return NULL;
> @@ -106,25 +122,19 @@ GPIOD_TEST_CASE(request_reconfigure_release_events)
> g_autoptr(struct_gpiod_info_event) request_event = NULL;
> g_autoptr(struct_gpiod_info_event) reconfigure_event = NULL;
> g_autoptr(struct_gpiod_info_event) release_event = NULL;
> - g_autoptr(struct_gpiod_line_config) line_cfg = NULL;
> - g_autoptr(struct_gpiod_line_settings) settings = NULL;
> g_autoptr(GThread) thread = NULL;
> struct gpiod_line_info *request_info, *reconfigure_info, *release_info;
> guint64 request_ts, reconfigure_ts, release_ts;
> struct request_ctx ctx;
> + const char *chip_path = g_gpiosim_chip_get_dev_path(sim);
> gint ret;
>
> - chip = gpiod_test_open_chip_or_fail(g_gpiosim_chip_get_dev_path(sim));
> - line_cfg = gpiod_test_create_line_config_or_fail();
> - settings = gpiod_test_create_line_settings_or_fail();
> -
> + chip = gpiod_test_open_chip_or_fail(chip_path);
> info = gpiod_test_chip_watch_line_info_or_fail(chip, 3);
>
> g_assert_false(gpiod_line_info_is_used(info));
>
> - ctx.chip = chip;
> - ctx.line_cfg = line_cfg;
> - ctx.settings = settings;
> + ctx.path = chip_path;
> ctx.offset = 3;
>
> thread = g_thread_new("request-release",
> @@ -199,26 +209,20 @@ GPIOD_TEST_CASE(chip_fd_can_be_polled)
> g_autoptr(struct_gpiod_chip) chip = NULL;
> g_autoptr(struct_gpiod_line_info) info = NULL;
> g_autoptr(struct_gpiod_info_event) event = NULL;
> - g_autoptr(struct_gpiod_line_config) line_cfg = NULL;
> - g_autoptr(struct_gpiod_line_settings) settings = NULL;
> g_autoptr(GThread) thread = NULL;
> + const char *chip_path = g_gpiosim_chip_get_dev_path(sim);
> struct gpiod_line_info *evinfo;
> struct request_ctx ctx;
> struct timespec ts;
> struct pollfd pfd;
> gint ret, fd;
>
> - chip = gpiod_test_open_chip_or_fail(g_gpiosim_chip_get_dev_path(sim));
> - settings = gpiod_test_create_line_settings_or_fail();
> - line_cfg = gpiod_test_create_line_config_or_fail();
> -
> + chip = gpiod_test_open_chip_or_fail(chip_path);
> info = gpiod_test_chip_watch_line_info_or_fail(chip, 3);
>
> g_assert_false(gpiod_line_info_is_used(info));
>
> - ctx.chip = chip;
> - ctx.line_cfg = line_cfg;
> - ctx.settings = settings;
> + ctx.path = chip_path;
> ctx.offset = 3;
>
> thread = g_thread_new("request-release",
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [libgpiod][PATCH 2/3] bindings: cxx: tests: don't use the same chip from different threads
2023-09-19 9:31 ` [libgpiod][PATCH 2/3] bindings: cxx: tests: don't use the same chip " Bartosz Golaszewski
@ 2023-09-19 11:33 ` Erik Schilling
0 siblings, 0 replies; 6+ messages in thread
From: Erik Schilling @ 2023-09-19 11:33 UTC (permalink / raw)
To: Bartosz Golaszewski, Kent Gibson, Linus Walleij, Andy Shevchenko,
Viresh Kumar
Cc: linux-gpio, Bartosz Golaszewski
On Tue Sep 19, 2023 at 11:31 AM CEST, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
>
> There are no thread-safety guarantees in libgpiod. Let's not reuse the
> chip object created in one thread to generate info events in another but
> create a second chip for that purpose instead.
>
> Reported-by: Erik Schilling <erik.schilling@linaro.org>
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Erik Schilling <erik.schilling@linaro.org>
> ---
> bindings/cxx/tests/tests-info-event.cpp | 11 +++++++----
> 1 file changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/bindings/cxx/tests/tests-info-event.cpp b/bindings/cxx/tests/tests-info-event.cpp
> index 249b1e8..21c0ef0 100644
> --- a/bindings/cxx/tests/tests-info-event.cpp
> +++ b/bindings/cxx/tests/tests-info-event.cpp
> @@ -3,6 +3,7 @@
>
> #include <catch2/catch.hpp>
> #include <chrono>
> +#include <filesystem>
> #include <gpiod.hpp>
> #include <sstream>
> #include <thread>
> @@ -17,11 +18,11 @@ using event_type = ::gpiod::info_event::event_type;
>
> namespace {
>
> -void request_reconfigure_release_line(::gpiod::chip& chip)
> +void request_reconfigure_release_line(const ::std::filesystem::path& chip_path)
> {
> ::std::this_thread::sleep_for(::std::chrono::milliseconds(10));
>
> - auto request = chip
> + auto request = ::gpiod::chip(chip_path)
> .prepare_request()
> .add_line_settings(7, ::gpiod::line_settings())
> .do_request();
> @@ -48,7 +49,9 @@ TEST_CASE("Lines can be watched", "[info-event][chip]")
> .set_num_lines(8)
> .build();
>
> - ::gpiod::chip chip(sim.dev_path());
> + const auto chip_path = sim.dev_path();
> +
> + ::gpiod::chip chip(chip_path);
>
> SECTION("watch_line_info() returns line info")
> {
> @@ -74,7 +77,7 @@ TEST_CASE("Lines can be watched", "[info-event][chip]")
>
> REQUIRE(info.direction() == direction::INPUT);
>
> - ::std::thread thread(request_reconfigure_release_line, ::std::ref(chip));
> + ::std::thread thread(request_reconfigure_release_line, ::std::ref(chip_path));
>
> REQUIRE(chip.wait_info_event(::std::chrono::seconds(1)));
> auto event = chip.read_info_event();
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [libgpiod][PATCH 3/3] bindings: python: tests: don't use the same chip from different threads
2023-09-19 9:31 ` [libgpiod][PATCH 3/3] bindings: python: " Bartosz Golaszewski
@ 2023-09-19 11:33 ` Erik Schilling
0 siblings, 0 replies; 6+ messages in thread
From: Erik Schilling @ 2023-09-19 11:33 UTC (permalink / raw)
To: Bartosz Golaszewski, Kent Gibson, Linus Walleij, Andy Shevchenko,
Viresh Kumar
Cc: linux-gpio, Bartosz Golaszewski
On Tue Sep 19, 2023 at 11:31 AM CEST, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
>
> There are no thread-safety guarantees in libgpiod. Let's not reuse the
> chip object created in one thread to generate info events in another but
> use a global request function instead.
>
> Reported-by: Erik Schilling <erik.schilling@linaro.org>
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Erik Schilling <erik.schilling@linaro.org>
> ---
> bindings/python/tests/tests_info_event.py | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/bindings/python/tests/tests_info_event.py b/bindings/python/tests/tests_info_event.py
> index f3926d9..6bb09d5 100644
> --- a/bindings/python/tests/tests_info_event.py
> +++ b/bindings/python/tests/tests_info_event.py
> @@ -37,9 +37,9 @@ class InfoEventDataclassBehavior(TestCase):
> event.line_info = 4
>
>
> -def request_reconfigure_release_line(chip, offset):
> +def request_reconfigure_release_line(chip_path, offset):
> time.sleep(0.1)
> - with chip.request_lines(config={offset: None}) as request:
> + with gpiod.request_lines(chip_path, config={offset: None}) as request:
> time.sleep(0.1)
> request.reconfigure_lines(
> config={offset: gpiod.LineSettings(direction=Direction.OUTPUT)}
> @@ -95,7 +95,7 @@ class WatchingInfoEventWorks(TestCase):
> self.assertEqual(info.direction, Direction.INPUT)
>
> self.thread = threading.Thread(
> - target=partial(request_reconfigure_release_line, self.chip, 7)
> + target=partial(request_reconfigure_release_line, self.sim.dev_path, 7)
> )
> self.thread.start()
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-09-19 11:33 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-19 9:31 [libgpiod][PATCH 1/3] tests: don't use the same chip object from different threads Bartosz Golaszewski
2023-09-19 9:31 ` [libgpiod][PATCH 2/3] bindings: cxx: tests: don't use the same chip " Bartosz Golaszewski
2023-09-19 11:33 ` Erik Schilling
2023-09-19 9:31 ` [libgpiod][PATCH 3/3] bindings: python: " Bartosz Golaszewski
2023-09-19 11:33 ` Erik Schilling
2023-09-19 11:33 ` [libgpiod][PATCH 1/3] tests: don't use the same chip object " Erik Schilling
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).