From 6914f414ba55a645170dbc7ec29c1638fc3b2992 Mon Sep 17 00:00:00 2001 From: Bartosz Golaszewski Date: Sun, 11 Jun 2017 20:13:04 +0200 Subject: [PATCH] tests: fix a test case for gpiofind We must not hardcode the chip names. Use test_chip_name() instead. Signed-off-by: Bartosz Golaszewski --- tests/tests-gpiofind.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/tests-gpiofind.c b/tests/tests-gpiofind.c index 3a88330..ba9f897 100644 --- a/tests/tests-gpiofind.c +++ b/tests/tests-gpiofind.c @@ -10,15 +10,23 @@ #include "gpiod-test.h" +#include + static void gpiofind_found(void) { + TEST_CLEANUP(test_free_str) char *output = NULL; + int rv; + + rv = asprintf(&output, "%s 7\n", test_chip_name(1)); + TEST_ASSERT(rv > 0); + test_gpiotool_run("gpiofind", "gpio-mockup-B-7", (char *)NULL); test_tool_wait(); TEST_ASSERT(test_tool_exited()); TEST_ASSERT_RET_OK(test_tool_exit_status()); TEST_ASSERT_NOT_NULL(test_tool_stdout()); - TEST_ASSERT_STR_EQ(test_tool_stdout(), "gpiochip1 7\n"); + TEST_ASSERT_STR_EQ(test_tool_stdout(), output); TEST_ASSERT_NULL(test_tool_stderr()); } TEST_DEFINE(gpiofind_found, -- 2.30.2