diff mbox series

[libgpiod,4/7] tests: gpiosim: selftests: add more test cases

Message ID 20251006-gpiosim-valid-lines-v1-4-b399373e90a9@linaro.org
State New
Headers show
Series tests: update libgpiosim tests and add a uAPI test case for valid lines | expand

Commit Message

Bartosz Golaszewski Oct. 6, 2025, 11:27 a.m. UTC
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

Add simple self tests for libgpiosim functions that were not tested
before.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
 tests/gpiosim/gpiosim-selftest.c | 9 +++++++++
 1 file changed, 9 insertions(+)
diff mbox series

Patch

diff --git a/tests/gpiosim/gpiosim-selftest.c b/tests/gpiosim/gpiosim-selftest.c
index 749974b974a5b24205477bacee29e1b5df64668e..6ce63b4cceaa08f7b61741de310a8de5c26ebe47 100644
--- a/tests/gpiosim/gpiosim-selftest.c
+++ b/tests/gpiosim/gpiosim-selftest.c
@@ -91,6 +91,8 @@  int main(int argc UNUSED, char **argv UNUSED)
 	ret = gpiosim_dev_enable(dev);
 	expect_or_die(ret == 0, "Unable to enable the device");
 
+	expect_or_die(gpiosim_dev_is_live(dev), "Failed to enable the device");
+
 	printf("Setting the pull of a single line to pull-up\n");
 
 	ret = gpiosim_bank_set_pull(bank0, 6, GPIOSIM_PULL_UP);
@@ -118,9 +120,16 @@  int main(int argc UNUSED, char **argv UNUSED)
 
 	printf("Disabling the GPIO device\n");
 
+	expect_or_die(gpiosim_dev_is_live(dev), "Failed to disable the device");
+
 	ret = gpiosim_dev_disable(dev);
 	expect_or_die(ret == 0, "Error while disabling the device");
 
+	printf("Clearing the GPIO hog on bank #2\n");
+
+	ret = gpiosim_bank_clear_hog(bank1, 3);
+	expect_or_die(ret == 0, "Error while clearing the hog");
+
 	printf("Re-enabling the GPIO device\n");
 
 	ret = gpiosim_dev_enable(dev);