diff options
author | Bartosz Golaszewski <bgolaszewski@baylibre.com> | 2019-05-29 17:30:53 +0200 |
---|---|---|
committer | Bartosz Golaszewski <bgolaszewski@baylibre.com> | 2019-05-29 17:30:53 +0200 |
commit | 812c7fd84d66dd0ae755d1adfb0eca9e64429c86 (patch) | |
tree | ed2c7a9d8b290a1ad26bb1f974f92741e50cc18b | |
parent | e1615824b53260b1b9520a81c32c029788b810b5 (diff) | |
download | libgpiod-812c7fd84d66dd0ae755d1adfb0eca9e64429c86.tar.gz |
tests: fix mapping of chip numbers
After recent changes the tests stopped working when other (non mockup)
GPIO chips are present in the system. The reason for that is broken
mapping of chip numbers to chip indexes. This patch fixes it.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
-rw-r--r-- | tests/gpiod-test.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/tests/gpiod-test.c b/tests/gpiod-test.c index ca9761ad..b8551310 100644 --- a/tests/gpiod-test.c +++ b/tests/gpiod-test.c @@ -1138,7 +1138,8 @@ int test_debugfs_get_value(unsigned int chip_index, unsigned int line_offset) char buf; int fd; - fd = test_debugfs_open(chip_index, line_offset, O_RDONLY); + fd = test_debugfs_open(globals.test_ctx.chips[chip_index]->number, + line_offset, O_RDONLY); rd = read(fd, &buf, 1); if (rd < 0) @@ -1159,7 +1160,8 @@ void test_debugfs_set_value(unsigned int chip_index, ssize_t wr; int fd; - fd = test_debugfs_open(chip_index, line_offset, O_WRONLY); + fd = test_debugfs_open(globals.test_ctx.chips[chip_index]->number, + line_offset, O_WRONLY); buf[0] = val ? '1' : 0; buf[1] = '\n'; @@ -1221,7 +1223,7 @@ void test_set_event(unsigned int chip_index, ev->running = true; } - ev->chip_index = chip_index; + ev->chip_index = globals.test_ctx.chips[chip_index]->number; ev->line_offset = line_offset; ev->freq = freq; |