netutils/cjson: Enable cjson test

This commit is contained in:
caofuqi1 2022-12-29 15:29:55 +08:00 committed by Petro Karashchenko
parent e9c6fa0497
commit 248a9f772b
3 changed files with 33 additions and 0 deletions

View File

@ -20,4 +20,16 @@ config NETUTILS_CJSON_VERSION
string "Version number"
default "1.7.12"
config NETUTILS_CJSON_TEST
bool "Enable cJSON test"
default n
if NETUTILS_CJSON_TEST
config CJSON_UNITY_TEST_DIR
string "cJSON test directory"
default "/data"
endif
endif

View File

@ -58,6 +58,26 @@ $(CJSON_UNPACKNAME): $(CJSON_TARBALL)
$(Q) touch $(CJSON_UNPACKNAME)
endif
ifneq ($(CONFIG_NETUTILS_CJSON_TEST),)
PROGNAME += cjson_test
MAINSRC += $(CJSON_SRCDIR)$(DELIM)test.c
UNITY_CJSONTESTS := parse_examples parse_number parse_hex4 parse_string parse_array \
parse_object parse_value print_string print_number print_array print_object \
print_value cjson_add parse_with_opts compare_tests readme_examples minify_tests \
misc_tests json_patch_tests old_utils_tests misc_utils_tests
UNITY_CJSONTESTCS := $(foreach n, $(UNITY_CJSONTESTS), $(CJSON_SRCDIR)$(DELIM)tests$(DELIM)$(n).c)
CJSONTEST_MAIN := $(foreach n, $(UNITY_CJSONTESTS), cjson_$(n))
PROGNAME += $(CJSONTEST_MAIN)
MAINSRC += $(UNITY_CJSONTESTCS)
CSRCS += $(CJSON_SRCDIR)/tests/unity_setup.c
CFLAGS += -Wno-unused-function
PRIORITY = SCHED_PRIORITY_DEFAULT
STACKSIZE = $(CONFIG_DEFAULT_TASK_STACKSIZE)
endif
$(CJSON_SRCDIR)$(DELIM)cJSON.h: $(CJSON_UNPACKNAME)
$(CJSON_SRCDIR)$(DELIM)cJSON_Utils.h: $(CJSON_UNPACKNAME)

View File

@ -42,6 +42,7 @@ APPS_INCDIR = $(APPDIR)$(DELIM)include$(DELIM)testing
CFLAGS += ${INCDIR_PREFIX}$(APPS_INCDIR)
CFLAGS += -DUNITY_INCLUDE_CONFIG_H
CFLAGS += -DUNITY_INCLUDE_DOUBLE
CSRCS = $(UNITY_SRCDIR)$(DELIM)unity.c