From: Bartosz Golaszewski <brgl@bgdev.pl>
To: Kent Gibson <warthog618@gmail.com>,
Linus Walleij <linus.walleij@linaro.org>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Viresh Kumar <viresh.kumar@linaro.org>,
Erik Schilling <erik.schilling@linaro.org>
Cc: linux-gpio@vger.kernel.org,
Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Subject: [libgpiod][PATCH v2 2/5] tests: add a test-case for gpiod_line_request_get_chip_name()
Date: Thu, 20 Jul 2023 16:47:44 +0200 [thread overview]
Message-ID: <20230720144747.73276-3-brgl@bgdev.pl> (raw)
In-Reply-To: <20230720144747.73276-1-brgl@bgdev.pl>
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Add a test case for the chip name getter on line-request objects.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
tests/tests-line-request.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/tests/tests-line-request.c b/tests/tests-line-request.c
index 0b985e2..1a58275 100644
--- a/tests/tests-line-request.c
+++ b/tests/tests-line-request.c
@@ -675,3 +675,24 @@ GPIOD_TEST_CASE(get_requested_offsets_less_and_more)
g_assert_cmpuint(retrieved[2], ==, 2);
g_assert_cmpuint(retrieved[3], ==, 3);
}
+
+GPIOD_TEST_CASE(get_chip_name)
+{
+ static const guint offset = 4;
+
+ g_autoptr(GPIOSimChip) sim = g_gpiosim_chip_new("num-lines", 8, NULL);
+ g_autoptr(struct_gpiod_chip) chip = NULL;
+ g_autoptr(struct_gpiod_line_config) line_cfg = NULL;
+ g_autoptr(struct_gpiod_line_request) request = NULL;
+
+ chip = gpiod_test_open_chip_or_fail(g_gpiosim_chip_get_dev_path(sim));
+ line_cfg = gpiod_test_create_line_config_or_fail();
+
+ gpiod_test_line_config_add_line_settings_or_fail(line_cfg, &offset, 1,
+ NULL);
+
+ request = gpiod_test_chip_request_lines_or_fail(chip, NULL, line_cfg);
+
+ g_assert_cmpstr(g_gpiosim_chip_get_name(sim), ==,
+ gpiod_line_request_get_chip_name(request));
+}
--
2.39.2
next prev parent reply other threads:[~2023-07-20 14:48 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-20 14:47 [libgpiod][PATCH v2 0/5] core: provide information about the parent chip in line requests Bartosz Golaszewski
2023-07-20 14:47 ` [libgpiod][PATCH v2 1/5] core: provide gpiod_line_request_get_chip_name() Bartosz Golaszewski
2023-07-20 14:47 ` Bartosz Golaszewski [this message]
2023-07-20 14:47 ` [libgpiod][PATCH v2 3/5] bindings: cxx: provide line_request::chip_name() Bartosz Golaszewski
2023-07-20 14:47 ` [libgpiod][PATCH v2 4/5] bindings: python: provide the chip_name property in line_request Bartosz Golaszewski
2023-07-20 14:47 ` [libgpiod][PATCH v2 5/5] bindings: rust: provide LineRequest::chip_name() Bartosz Golaszewski
2023-07-20 14:53 ` Erik Schilling
2023-07-21 3:15 ` Kent Gibson
2023-07-21 18:35 ` Bartosz Golaszewski
2023-07-22 2:07 ` Kent Gibson
2023-07-22 12:30 ` Bartosz Golaszewski
2023-07-21 3:27 ` Kent Gibson
2023-07-21 6:55 ` Viresh Kumar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230720144747.73276-3-brgl@bgdev.pl \
--to=brgl@bgdev.pl \
--cc=andriy.shevchenko@linux.intel.com \
--cc=bartosz.golaszewski@linaro.org \
--cc=erik.schilling@linaro.org \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=viresh.kumar@linaro.org \
--cc=warthog618@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).