From 003b4b0d6345f94fdc5b3f13e0f061252b67e01d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Th=C3=A9baudeau?= Date: Sun, 29 May 2016 22:23:15 +0200 Subject: [PATCH] test-coffee: Fix the file modification test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The r variable was used instead of i to fill the buffer, resulting in the end of the test loop after only a single iteration. The file was not even closed at the end of each iteration although it is opened at the beginning of each iteration, so the available file descriptors would very quickly be exhausted. Signed-off-by: Benoît Thébaudeau --- examples/cfs-coffee/test-coffee.c | 6 ++++-- regression-tests/03-base/02-sky-coffee.csc | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/examples/cfs-coffee/test-coffee.c b/examples/cfs-coffee/test-coffee.c index 9f134ae44..28cd3b5c6 100644 --- a/examples/cfs-coffee/test-coffee.c +++ b/examples/cfs-coffee/test-coffee.c @@ -276,8 +276,8 @@ coffee_test_modify(void) offset = random_rand() % FILE_SIZE; - for(r = 0; r < sizeof(buf); r++) { - buf[r] = r; + for(i = 0; i < sizeof(buf); i++) { + buf[i] = i; } if(cfs_seek(wfd, offset, CFS_SEEK_SET) != offset) { @@ -303,6 +303,8 @@ coffee_test_modify(void) TEST_FAIL(8); } } + + cfs_close(wfd); } error = 0; diff --git a/regression-tests/03-base/02-sky-coffee.csc b/regression-tests/03-base/02-sky-coffee.csc index 035f72843..050b4abc9 100644 --- a/regression-tests/03-base/02-sky-coffee.csc +++ b/regression-tests/03-base/02-sky-coffee.csc @@ -89,7 +89,7 @@ make test-coffee.sky TARGET=sky org.contikios.cooja.plugins.ScriptRunner -