diff mbox series

[libgpiod] tools: tests: accept the new gpio-sim label format in test cases

Message ID 20240506162506.176935-1-brgl@bgdev.pl
State New
Headers show
Series [libgpiod] tools: tests: accept the new gpio-sim label format in test cases | expand

Commit Message

Bartosz Golaszewski May 6, 2024, 4:25 p.m. UTC
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

Since kernel commit 840a97e2fbaf ("gpio: sim: delimit the fwnode name
with a ":" when generating labels") the gpio-sim automatic labels are
generated by delimiting the device name and the fwnode name with ':'
instead of '-' for better readability. This will break the tests once
linux v6.9 is out. Act in advance and accept both forms.

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

Patch

diff --git a/tools/gpio-tools-test.bash b/tools/gpio-tools-test.bash
index 5ef4ef6..b55c5eb 100755
--- a/tools/gpio-tools-test.bash
+++ b/tools/gpio-tools-test.bash
@@ -304,9 +304,9 @@  test_gpiodetect_all_chips() {
 
 	run_tool gpiodetect
 
-	output_contains_line "$sim0 [${sim0dev}-node0] (4 lines)"
-	output_contains_line "$sim1 [${sim1dev}-node0] (8 lines)"
-	output_contains_line "$sim2 [${sim2dev}-node0] (16 lines)"
+	output_regex_match "$sim0 \[${sim0dev}[-:]node0\] \(4 lines\)"
+	output_regex_match "$sim1 \[${sim1dev}[-:]node0\] \(8 lines\)"
+	output_regex_match "$sim2 \[${sim2dev}[-:]node0\] \(16 lines\)"
 	status_is 0
 
 	# ignoring symlinks
@@ -334,21 +334,21 @@  test_gpiodetect_a_chip() {
 	# by name
 	run_tool gpiodetect $sim0
 
-	output_contains_line "$sim0 [${sim0dev}-node0] (4 lines)"
+	output_regex_match "$sim0 \[${sim0dev}[-:]node0\] \(4 lines\)"
 	num_lines_is 1
 	status_is 0
 
 	# by path
 	run_tool gpiodetect ${GPIOSIM_CHIP_PATH[sim1]}
 
-	output_contains_line "$sim1 [${sim1dev}-node0] (8 lines)"
+	output_regex_match "$sim1 \[${sim1dev}[-:]node0\] \(8 lines\)"
 	num_lines_is 1
 	status_is 0
 
 	# by number
 	run_tool gpiodetect $(gpiosim_chip_number sim2)
 
-	output_contains_line "$sim2 [${sim2dev}-node0] (16 lines)"
+	output_regex_match "$sim2 \[${sim2dev}[-:]node0\] \(16 lines\)"
 	num_lines_is 1
 	status_is 0
 
@@ -356,7 +356,7 @@  test_gpiodetect_a_chip() {
 	gpiosim_chip_symlink sim2 .
 	run_tool gpiodetect $GPIOSIM_CHIP_LINK
 
-	output_contains_line "$sim2 [${sim2dev}-node0] (16 lines)"
+	output_regex_match "$sim2 \[${sim2dev}[-:]node0\] \(16 lines\)"
 	num_lines_is 1
 	status_is 0
 }
@@ -375,9 +375,9 @@  test_gpiodetect_multiple_chips() {
 
 	run_tool gpiodetect $sim0 $sim1 $sim2
 
-	output_contains_line "$sim0 [${sim0dev}-node0] (4 lines)"
-	output_contains_line "$sim1 [${sim1dev}-node0] (8 lines)"
-	output_contains_line "$sim2 [${sim2dev}-node0] (16 lines)"
+	output_regex_match "$sim0 \[${sim0dev}[-:]node0\] \(4 lines\)"
+	output_regex_match "$sim1 \[${sim1dev}[-:]node0\] \(8 lines\)"
+	output_regex_match "$sim2 \[${sim2dev}[-:]node0\] \(16 lines\)"
 	num_lines_is 3
 	status_is 0
 }