From f5b3e2cad0952284128e79e039bda84b244376c8 Mon Sep 17 00:00:00 2001 From: Denis 'GNUtoo' Carikli Date: Wed, 2 Jun 2021 15:29:57 +0200 Subject: test: convert remaing system() to use run_command Signed-off-by: Denis 'GNUtoo' Carikli --- tests.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/tests.c b/tests.c index b32bd8a..e2e84d8 100644 --- a/tests.c +++ b/tests.c @@ -63,8 +63,9 @@ static int test_output_value_with_libgpiod(int debug, char *devmem, int fd, char *gpioset_low_command; int rc; - rc = asprintf(&gpioset_high_command, "gpioset %s %d=1 > /dev/null", - bank, gpio_offset); + + rc = asprintf(&gpioset_high_command, "gpioset %s %d=1", bank, + gpio_offset); if (rc == -1) { rc = errno; printf("%s: asprintf failed with error %d: %s\n", @@ -72,7 +73,7 @@ static int test_output_value_with_libgpiod(int debug, char *devmem, int fd, assert(false); } - rc = system(gpioset_high_command); + rc = run_command(debug, gpioset_high_command); assert(rc == 0); free(gpioset_high_command); @@ -82,7 +83,7 @@ static int test_output_value_with_libgpiod(int debug, char *devmem, int fd, rc = gpio_get_output_value(devmem, fd, page_size, bank, gpio_offset); assert (rc == GPIO_VALUE_HIGH); - rc = asprintf(&gpioset_low_command, "gpioset %s %d=0 > /dev/null", bank, + rc = asprintf(&gpioset_low_command, "gpioset %s %d=0", bank, gpio_offset); if (rc == -1) { rc = errno; @@ -91,7 +92,7 @@ static int test_output_value_with_libgpiod(int debug, char *devmem, int fd, assert(false); } - rc = system(gpioset_low_command); + rc = run_command(debug, gpioset_low_command); assert(rc == 0); rc = gpio_get_direction(devmem, fd, page_size, bank, gpio_offset); @@ -165,7 +166,7 @@ static int test_direction_with_libgpiod(int debug, char *devmem, int fd, char *gpioset_command; int rc; - rc = asprintf(&gpioget_command, "gpioget %s %d > /dev/null", bank, + rc = asprintf(&gpioget_command, "gpioget %s %d", bank, gpio_offset); if (rc == -1) { rc = errno; @@ -174,7 +175,7 @@ static int test_direction_with_libgpiod(int debug, char *devmem, int fd, assert(false); } - rc = system(gpioget_command); + rc = run_command(debug, gpioget_command); assert(rc == 0); free(gpioget_command); @@ -182,7 +183,7 @@ static int test_direction_with_libgpiod(int debug, char *devmem, int fd, rc = gpio_get_direction(devmem, fd, page_size, bank, gpio_offset); assert (rc == GPIO_INPUT); - rc = asprintf(&gpioset_command, "gpioset %s %d=1 > /dev/null", bank, + rc = asprintf(&gpioset_command, "gpioset %s %d=1", bank, gpio_offset); if (rc == -1) { rc = errno; @@ -191,7 +192,7 @@ static int test_direction_with_libgpiod(int debug, char *devmem, int fd, assert(false); } - rc = system(gpioset_command); + rc = run_command(debug, gpioset_command); assert(rc == 0); rc = gpio_get_direction(devmem, fd, page_size, bank, gpio_offset); -- cgit v1.2.3