Skip to content

Commit

Permalink
test-coffee: Fix the file modification test
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
bthebaudeau committed May 30, 2016
1 parent 150b9fb commit 003b4b0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions examples/cfs-coffee/test-coffee.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -303,6 +303,8 @@ coffee_test_modify(void)
TEST_FAIL(8);
}
}

cfs_close(wfd);
}

error = 0;
Expand Down
2 changes: 1 addition & 1 deletion regression-tests/03-base/02-sky-coffee.csc
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ make test-coffee.sky TARGET=sky</commands>
<plugin>
org.contikios.cooja.plugins.ScriptRunner
<plugin_config>
<script>TIMEOUT(80000);
<script>TIMEOUT(180000);

fileOK = null;
gcOK = null;
Expand Down

0 comments on commit 003b4b0

Please sign in to comment.