deleted file mode 100644
@@ -1,65 +0,0 @@
-## Author: Christian Storm
-## Copyright (C) 2017, Siemens AG
-##
-## This program is free software; you can redistribute it and/or
-## modify it under the terms of the GNU General Public License as
-## published by the Free Software Foundation; either version 2 of
-## the License, or (at your option) any later version.
-##
-## This program is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with this program; if not, write to the Free Software
-## Foundation, Inc.
-
-tests-$(CONFIG_SURICATTA_HAWKBIT) += test_json
-tests-$(CONFIG_SURICATTA_HAWKBIT) += test_server_hawkbit
-
-ccflags-y += -I$(src)/../
-
-TARGETS = $(addprefix $(obj)/, $(tests-y))
-tests-objs = $(addsuffix .o, $(TARGETS))
-tests-lnk = $(addsuffix .lnk, $(TARGETS))
-targets += $(addsuffix .o, $(tests-y))
-
-ifneq ($(CONFIG_EXTRA_LDFLAGS),)
-EXTRA_LDFLAGS += $(strip $(subst ",,$(CONFIG_EXTRA_LDFLAGS)))#"))
-endif
-
-## transfer __mock_*() functions to according linker flags via rudimentary regex awk parsing
-LDMOCKS = `/usr/bin/awk '/^[^(extern)|(static)]*([\*_[:alnum:]]+[[:blank:]]+)+[\*]*__wrap_/{where = match($$0,"__wrap_[_[:alnum:]]+"); if (RSTART > 0) { print "-Wl,--wrap=" substr($$0, RSTART+7, RLENGTH-7);}}' $(basename $@).c`
-
-quiet_cmd_linktestexe = LD $(basename $@)
- cmd_linktestexe = $(srctree)/scripts/trylink \
- "$(basename $@)" \
- "$(CC)" \
- "$(KBUILD_CFLAGS)" \
- "$(LDFLAGS) $(EXTRA_LDFLAGS) $(LDMOCKS)" \
- "$(basename $@).o $(subst core/built-in.o,core/built-in.o.tmp,$(SWOBJS))" \
- "$(SWLIBS)" \
- "$(LDLIBS) cmocka"
-
-EXECUTE_TEST = echo "RUN $(subst $(obj)/,,$(var))"; CMOCKA_MESSAGE_OUTPUT=TAP $(var)
-
-PHONY += default
-default:
- $(info please run 'make suricatta-tests' in swupdate main directory)
-
-PHONY += tests
-ifneq "$(tests-y)" ""
-tests: $(tests-objs) $(tests-lnk)
- @+$(foreach var,$(TARGETS),$(EXECUTE_TEST);)
-else
-tests:
- @$(info suricatta is disabled, nothing to test.)
- @:
-endif
-
-$(obj)/%.lnk: $(objtree)/core/built-in.o
- $(Q)strip -N main -o $(objtree)/core/built-in.o.tmp $(objtree)/core/built-in.o
- $(Q)$(call cmd,linktestexe)
-
-.PHONY: $(PHONY)
@@ -20,6 +20,8 @@ tests-$(CONFIG_HASH_VERIFY) += test_hash
ifeq ($(CONFIG_SIGALG_RAWRSA),y)
tests-$(CONFIG_SIGNED_IMAGES) += test_verify
endif
+tests-$(CONFIG_SURICATTA_HAWKBIT) += test_json
+tests-$(CONFIG_SURICATTA_HAWKBIT) += test_server_hawkbit
ccflags-y += -I$(src)/../
@@ -57,7 +59,7 @@ tests: $(tests-objs) $(tests-lnk)
@+$(foreach var,$(TARGETS),$(EXECUTE_TEST);)
else
tests:
- @$(info crypto functions are disabled, nothing to test.)
+ @$(info nothing to test.)
@:
endif
similarity index 100%
rename from suricatta/test/test_json.c
rename to test/test_json.c
similarity index 98%
rename from suricatta/test/test_server_hawkbit.c
rename to test/test_server_hawkbit.c
@@ -26,11 +26,12 @@
#include <cmocka.h>
#include <network_ipc.h>
#include <swupdate_status.h>
+#include <util.h>
#include "suricatta/suricatta.h"
-#include "server_hawkbit.h"
+#include "../suricatta/server_hawkbit.h"
#include "channel.h"
#include "channel_curl.h"
-#include "suricatta/state.h"
+#include "state.h"
#define JSON_OBJECT_FREED 1
#define JSONQUOTE(...) #__VA_ARGS__
@@ -39,7 +40,7 @@
extern channel_op_res_t channel_close(channel_t *this);
extern channel_op_res_t channel_open(channel_t *this, void *cfg);
extern channel_op_res_t channel_put(channel_t *this, void *data);
-extern channel_op_res_t channel_get_file(channel_t *this, void *data, int file_handle);
+extern channel_op_res_t channel_get_file(channel_t *this, void *data);
extern channel_op_res_t channel_get(channel_t *this, void *data);
extern channel_op_res_t channel_curl_init(void);
@@ -86,9 +87,9 @@ channel_op_res_t __wrap_channel_put(channel_t *this, void *data)
return mock_type(channel_op_res_t);
}
-extern channel_op_res_t __real_channel_get_file(channel_t *this, void *data, int file_handle);
-channel_op_res_t __wrap_channel_get_file(channel_t *this, void *data, int file_handle);
-channel_op_res_t __wrap_channel_get_file(channel_t *this, void *data, int file_handle)
+extern channel_op_res_t __real_channel_get_file(channel_t *this, void *data);
+channel_op_res_t __wrap_channel_get_file(channel_t *this, void *data);
+channel_op_res_t __wrap_channel_get_file(channel_t *this, void *data)
{
#ifdef CONFIG_SURICATTA_SSL
channel_data_t *channel_data = (channel_data_t *)data;
@@ -97,7 +98,6 @@ channel_op_res_t __wrap_channel_get_file(channel_t *this, void *data, int file_h
#else
(void)data;
#endif
- (void)file_handle;
(void)this;
return mock_type(channel_op_res_t);
}
Fix build of test unit under suricatta. Move them to the general directory for testing, and factorize Makefile Signed-off-by: Stefano Babic <sbabic@denx.de> --- suricatta/test/Makefile | 65 ------------------- test/Makefile | 4 +- {suricatta/test => test}/test_json.c | 0 .../test => test}/test_server_hawkbit.c | 14 ++-- 4 files changed, 10 insertions(+), 73 deletions(-) delete mode 100644 suricatta/test/Makefile rename {suricatta/test => test}/test_json.c (100%) rename {suricatta/test => test}/test_server_hawkbit.c (98%)