fix: make C tests work again
This commit is contained in:
@@ -14,7 +14,6 @@
|
|||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <errno.h>
|
|
||||||
#else
|
#else
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -118,17 +117,7 @@ static void * fs_open(lv_fs_drv_t * drv, const char * path, lv_fs_mode_t mode)
|
|||||||
char buf[MAX_PATH_LEN];
|
char buf[MAX_PATH_LEN];
|
||||||
lv_snprintf(buf, sizeof(buf), LV_FS_STDIO_PATH "%s", path);
|
lv_snprintf(buf, sizeof(buf), LV_FS_STDIO_PATH "%s", path);
|
||||||
|
|
||||||
void * a = fopen(buf, flags);
|
return fopen(buf, flags);
|
||||||
|
|
||||||
printf("%s\n", path);
|
|
||||||
printf("%d\n", errno);
|
|
||||||
|
|
||||||
char buf2[512];
|
|
||||||
getcwd(buf2, 512);
|
|
||||||
printf("%s\n", buf2);
|
|
||||||
printf("%p\n", a);
|
|
||||||
|
|
||||||
return a;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -68,38 +68,8 @@ typedef struct {
|
|||||||
int lv_snprintf_builtin(char * buffer, size_t count, const char * format, ...);
|
int lv_snprintf_builtin(char * buffer, size_t count, const char * format, ...);
|
||||||
int lv_vsnprintf_builtin(char * buffer, size_t count, const char * format, va_list va);
|
int lv_vsnprintf_builtin(char * buffer, size_t count, const char * format, va_list va);
|
||||||
|
|
||||||
/**
|
#define lv_snprintf LV_SNPRINTF
|
||||||
* Tiny snprintf/vsnprintf implementation
|
#define lv_vsnprintf LV_VSNPRINTF
|
||||||
* \param buffer A pointer to the buffer where to store the formatted string
|
|
||||||
* \param count The maximum number of characters to store in the buffer, including a terminating null character
|
|
||||||
* \param format A string that specifies the format of the output
|
|
||||||
* \param va A value identifying a variable arguments list
|
|
||||||
* \return The number of characters that COULD have been written into the buffer, not counting the terminating
|
|
||||||
* null character. A value equal or larger than count indicates truncation. Only when the returned value
|
|
||||||
* is non-negative and less than count, the string has been completely written.
|
|
||||||
*/
|
|
||||||
LV_FORMAT_ATTRIBUTE(3, 4) static inline int lv_snprintf(char * buffer, size_t count, const char * format, ...)
|
|
||||||
{
|
|
||||||
|
|
||||||
/* Declare a va_list type variable */
|
|
||||||
va_list args;
|
|
||||||
|
|
||||||
/* Initialise the va_list variable with the ... after fmt */
|
|
||||||
va_start(args, format);
|
|
||||||
|
|
||||||
/* Forward the '...' to vprintf */
|
|
||||||
int ret = LV_SNPRINTF(buffer, count, format, args);
|
|
||||||
|
|
||||||
/* Clean up the va_list */
|
|
||||||
va_end(args);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
LV_FORMAT_ATTRIBUTE(3, 0) static inline int lv_vsnprintf(char * buffer, size_t count, const char * format, va_list va)
|
|
||||||
{
|
|
||||||
return LV_VSNPRINTF(buffer, count, format, va);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ void test_arc_click_area_with_adv_hittest(void)
|
|||||||
lv_obj_set_size(arc, 100, 100);
|
lv_obj_set_size(arc, 100, 100);
|
||||||
lv_obj_set_style_arc_width(arc, 10, 0);
|
lv_obj_set_style_arc_width(arc, 10, 0);
|
||||||
lv_obj_add_flag(arc, LV_OBJ_FLAG_ADV_HITTEST);
|
lv_obj_add_flag(arc, LV_OBJ_FLAG_ADV_HITTEST);
|
||||||
lv_obj_add_event_cb(arc, dummy_event_cb, LV_EVENT_VALUE_CHANGED, NULL);
|
lv_obj_add_event_cb(arc, dummy_event_cb, LV_EVENT_PRESSED, NULL);
|
||||||
lv_obj_set_ext_click_area(arc, 5);
|
lv_obj_set_ext_click_area(arc, 5);
|
||||||
|
|
||||||
/*No click detected at the middle*/
|
/*No click detected at the middle*/
|
||||||
|
|||||||
@@ -17,13 +17,22 @@ void tearDown(void)
|
|||||||
/* Function run after every test */
|
/* Function run after every test */
|
||||||
}
|
}
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <unistd.h>
|
||||||
void test_read(void)
|
void test_read(void)
|
||||||
{
|
{
|
||||||
lv_fs_res_t res;
|
lv_fs_res_t res;
|
||||||
|
|
||||||
|
char cur[512];
|
||||||
|
getcwd(cur, 512);
|
||||||
|
errno = 0;
|
||||||
|
void * a = fopen("src/test_files/readtest.txt", "rd");
|
||||||
|
printf("%s, %d, %p\n", cur, errno, a);
|
||||||
|
fclose(a);
|
||||||
|
|
||||||
/*'A' has cache*/
|
/*'A' has cache*/
|
||||||
lv_fs_file_t fa;
|
lv_fs_file_t fa;
|
||||||
res = lv_fs_open(&fa, "A:readtest.txt", LV_FS_MODE_RD);
|
res = lv_fs_open(&fa, "A:src/test_files/readtest.txt", LV_FS_MODE_RD);
|
||||||
TEST_ASSERT_EQUAL(LV_FS_RES_OK, res);
|
TEST_ASSERT_EQUAL(LV_FS_RES_OK, res);
|
||||||
|
|
||||||
/*'B' has no cache*/
|
/*'B' has no cache*/
|
||||||
|
|||||||
Reference in New Issue
Block a user