summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>2021-06-02 15:29:57 +0200
committerDenis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>2021-06-02 15:32:11 +0200
commitf5b3e2cad0952284128e79e039bda84b244376c8 (patch)
treef8630d0fd2586b7978687afed8a0fc3d4c5fe419
parent65fbb827310bbf33c747fd183797362ba4d09705 (diff)
downloadexynos-gpio-tool-f5b3e2cad0952284128e79e039bda84b244376c8.tar.gz
exynos-gpio-tool-f5b3e2cad0952284128e79e039bda84b244376c8.tar.bz2
exynos-gpio-tool-f5b3e2cad0952284128e79e039bda84b244376c8.zip
test: convert remaing system() to use run_command
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
-rw-r--r--tests.c19
1 files 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);