On windows, we try to open the "cmd.exe" file, but without the full path
the test fails unless it runs from the system directory.
We now use the full path to test the eina_file_open function.
On windows, we try to open the "cmd.exe" file, but without the full path
the test fails unless it runs from the system directory.
We now use the full path to test the eina_file_open function.
meson test eina
Automatic diff as part of commit; lint not applicable. |
Automatic diff as part of commit; unit tests not applicable. |
src/tests/eina/eina_test_file.c | ||
---|---|---|
499 | isn't len-MAX_PATH-1 negative ? instead of strncat, i would do a test before, and append with 2 strcat something like : if (len + 1 /* '\' */+ 7 /* "cmd.exe" */ + 1 /* nul */ < MAX_PATH) we fail then the 2 strcat. That way, we are sure than the path is really the one of cmd.exe. Otherwise, it can be truncated (though the probability to have it truncated is almost 0) |
src/tests/eina/eina_test_file.c | ||
---|---|---|
499 | I have fixed the path calculation. As discussed in IRC, I avoided the use of strcat because it triggers a warning on modern compilers. |
src/tests/eina/eina_test_file.c | ||
---|---|---|
499 | missing - :-) |
last thing for me : we declare variables always at the beginning of the block (exception in eo/eolian)
otherwise, good for me (tested)
Isn't this just because of older compilers/versions of C (i.e. <c99)? Or ist it an EFL coding convention?
src/tests/eina/eina_test_file.c | ||
---|---|---|
495 | sizeof(test_file) != sizeof("cmd.exe") if test_file is a pointer. In this case, there is a coincidence that the string is 8 bytes long, exactly the same size as a pointer in 64 bit systems. That's the reasoning behind the use of a matrix. As an alternative, I could make it a macro. |
src/tests/eina/eina_test_file.c | ||
---|---|---|
495 | you're right, sorry, needs to be an array |
src/tests/eina/eina_test_file.c | ||
---|---|---|
495 | it's sizeof("foooooooooo"); which returns strlen("foooooooooo") + 1 |