This test could sometimes fail because of a lack of free contiguous
pages in the file system. Fix this by removing the created files at the
end of each test. Besides, the test files do not have to be removed at
the beginning of each test since the file system is initially formatted.
Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
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 <benoit.thebaudeau.dev@gmail.com>
The filenames were mixed up between some of the tests, thus breaking the
purpose of these tests.
Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
Remove the file at the beginning of the test, before opening it for
writing, in order to start the test with an empty file system, not only
after flashing the test, but also following every reboot.
Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
Fix this build warning, which is generated if micro logs are enabled:
In file included from ../../core/cfs/cfs-coffee.c:59:0:
../../core/cfs/cfs-coffee.c: In function 'read_log_page':
../../cpu/cc2538/./cfs-coffee-arch.h:145:24: warning: passing argument 1 of 'cfs_coffee_arch_read' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
cfs_coffee_arch_read((buf), (size), (offset))
^
../../core/cfs/cfs-coffee.c:757:3: note: in expansion of macro 'COFFEE_READ'
COFFEE_READ(lp->buf, lp->size, base);
^
../../cpu/cc2538/./cfs-coffee-arch.h:176:6: note: expected 'void *' but argument is of type 'const char *'
void cfs_coffee_arch_read(void *buf, unsigned int size, cfs_offset_t offset);
^
COFFEE_READ() needs to write to lp->buf, so the target type of this
pointer cannot be qualified as "const".
Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
Currently, http-socket uses a `parse_url` method which only works correctly with IPv4 hosts (e.g. `http://192.168.1.1:3000`). When using an IPv6 host (e.g. `http://[abcd::1]:3000`), the port number is not parsed due to a pointer increment error, which leads to the algorithm assuming a default port of 80 even when the user code has specified otherwise. This fix provides full URL parsing for IPv6 hosts, and does not break IPv4 functionality.