linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bartosz Golaszewski <brgl@bgdev.pl>
To: Kent Gibson <warthog618@gmail.com>,
	 Linus Walleij <linus.walleij@linaro.org>
Cc: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>,
	 linux-gpio@vger.kernel.org
Subject: [PATCH libgpiod 2/2] tools: tests: add a test case for gpioinfo output consistency
Date: Fri, 21 Mar 2025 12:05:25 +0100	[thread overview]
Message-ID: <20250321-gpioinfo-unnamed-quotes-v1-2-a806e9027adf@linaro.org> (raw)
In-Reply-To: <20250321-gpioinfo-unnamed-quotes-v1-0-a806e9027adf@linaro.org>

From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

Add a test case making sure that without the `--unquoted` switch, the
consumer name is still quoted both for named and unnamed lines.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
 tools/gpio-tools-test.bash | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/tools/gpio-tools-test.bash b/tools/gpio-tools-test.bash
index 359960a..898b348 100755
--- a/tools/gpio-tools-test.bash
+++ b/tools/gpio-tools-test.bash
@@ -478,6 +478,24 @@ test_gpioinfo_with_offset_out_of_range() {
 	status_is 1
 }
 
+test_gpioinfo_quoted_output_consistency() {
+	gpiosim_chip sim0 num_lines=2 line_name=0:foo
+
+	local sim0=${GPIOSIM_CHIP_NAME[sim0]}
+
+	dut_run gpioset --chip=$sim0 0=active 1=active
+
+	run_prog gpioinfo --chip=$sim0
+
+	status_is 0
+	num_lines_is 3
+	output_regex_match "line\\s+0:\\s+\"foo\"\\s+output\\s+consumer=\"gpioset\""
+	output_regex_match "line\\s+1:\\s+unnamed\\s+output\\s+consumer=\"gpioset\""
+
+	dut_kill
+	dut_wait
+}
+
 #
 # gpioget test cases
 #

-- 
2.45.2


  parent reply	other threads:[~2025-03-21 11:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-21 11:05 [PATCH libgpiod 0/2] tools: don't implicity unquote unnamed lines in gpioinfo Bartosz Golaszewski
2025-03-21 11:05 ` [PATCH libgpiod 1/2] tools: gpioinfo: don't implicity unquote unnamed lines Bartosz Golaszewski
2025-03-21 11:44   ` Kent Gibson
2025-03-21 11:05 ` Bartosz Golaszewski [this message]
2025-03-24  9:42 ` [PATCH libgpiod 0/2] tools: don't implicity unquote unnamed lines in gpioinfo Bartosz Golaszewski

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=20250321-gpioinfo-unnamed-quotes-v1-2-a806e9027adf@linaro.org \
    --to=brgl@bgdev.pl \
    --cc=bartosz.golaszewski@linaro.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.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).