1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-14 06:42:58 +08:00

test add move tests to test_cases and test_runners directories

This commit is contained in:
Gabor Kiss-Vamosi 2021-06-17 12:39:56 +02:00
parent d6dbbaaa34
commit d2e735ef36
6 changed files with 12 additions and 48 deletions

View File

@ -4,6 +4,7 @@
CC ?= gcc CC ?= gcc
LVGL_DIR ?= ${shell pwd}/../.. LVGL_DIR ?= ${shell pwd}/../..
LVGL_DIR_NAME ?= lvgl LVGL_DIR_NAME ?= lvgl
OBJDIR = objs
WARNINGS = -Werror -Wall -Wextra \ WARNINGS = -Werror -Wall -Wextra \
-Wshadow -Wundef -Wmaybe-uninitialized -Wmissing-prototypes -Wpointer-arith -Wuninitialized \ -Wshadow -Wundef -Wmaybe-uninitialized -Wmissing-prototypes -Wpointer-arith -Wuninitialized \
@ -45,14 +46,13 @@ OBJS = $(AOBJS) $(COBJS)
all: default all: default
%.o: %.c $(OBJDIR)/%.o: %.c
@$(CC) $(CFLAGS) -c $< -o $@ @$(CC) $(CFLAGS) -c -o $@ $<
# @echo "CC $<" @echo "CC $<"
default: $(AOBJS) $(COBJS) $(MAINOBJ) default: $(AOBJS) $(COBJS) $(MAINOBJ)
$(CC) -o $(BIN) $(MAINOBJ) $(AOBJS) $(COBJS) $(LDFLAGS) $(CC) -o $(BIN) $(MAINOBJ) $(AOBJS) $(COBJS) $(LDFLAGS)
clean: clean:
rm -f $(BIN) $(AOBJS) $(COBJS) $(MAINOBJ) find . -type f -name '*.o' -exec rm -f {} +
rm -f $(BIN)

View File

@ -24,6 +24,7 @@ def build(defines, test_name):
d_all += '"' d_all += '"'
test_file_name = test_name + ".c" test_file_name = test_name + ".c"
test_file_runner_name = test_name + "_Runner.c" test_file_runner_name = test_name + "_Runner.c"
test_file_runner_name = test_file_runner_name.replace("/test_cases/", "/test_runners/")
# -s makes it silence # -s makes it silence
cmd = "make -s -j BIN=test.bin MAINSRC=" + test_file_name + " TEST_SRC=" + test_file_runner_name + " LVGL_DIR_NAME=" + lvgldirname + " DEFINES=" + d_all + " OPTIMIZATION=" + optimization cmd = "make -s -j BIN=test.bin MAINSRC=" + test_file_name + " TEST_SRC=" + test_file_runner_name + " LVGL_DIR_NAME=" + lvgldirname + " DEFINES=" + d_all + " OPTIMIZATION=" + optimization

View File

@ -2,9 +2,11 @@ import os
import glob import glob
def prepare(): def prepare():
os.system("rm src/test_*_Runner.c") os.system("rm src/test_runners/test_*_Runner.c")
os.system("rm src/*.o") os.system("rm src/*.o")
files = glob.glob("./src/test_*.c") files = glob.glob("./src/test_cases/test_*.c")
for f in files: for f in files:
os.system("ruby unity/generate_test_runner.rb " + f + " config.yml") r = f[:-2] + "_Runner.c"
r = r.replace("/test_cases/", "/test_runners/")
os.system("ruby unity/generate_test_runner.rb " + f + " " + r + " config.yml")
return files return files

View File

@ -1,39 +0,0 @@
#include "../../lvgl.h"
#if LV_BUILD_TEST
#include "unity/unity.h"
void test_obj_tree_1(void);
void test_obj_tree_2(void);
void test_obj_tree_1(void)
{
TEST_ASSERT_EQUAL(lv_obj_get_child_cnt(lv_scr_act()), 0);
}
void test_obj_tree_2(void)
{
lv_obj_create(lv_scr_act());
lv_obj_t * o2 = lv_obj_create(lv_scr_act());
lv_obj_create(lv_scr_act());
TEST_ASSERT_EQUAL(lv_obj_get_child_cnt(lv_scr_act()), 3);
lv_obj_del(o2);
TEST_ASSERT_EQUAL(lv_obj_get_child_cnt(lv_scr_act()), 2);
lv_obj_clean(lv_scr_act());
TEST_ASSERT_EQUAL(lv_obj_get_child_cnt(lv_scr_act()), 0);
lv_color_t c1 = lv_color_hex(0x444444);
lv_color_t c2 = lv_color_hex3(0x444);
TEST_ASSERT_EQUAL_COLOR(c1, c2);
lv_obj_remove_style_all(lv_scr_act());
lv_obj_set_style_bg_color(lv_scr_act(), lv_color_hex(0x112233), 0);
lv_obj_set_style_bg_opa(lv_scr_act(), LV_OPA_COVER, 0);
TEST_ASSERT_EQUAL_SCREENSHOT("scr1.png")
}
#endif