From d6cea8104761b237c90b29c85f3dbdd269e2a89f Mon Sep 17 00:00:00 2001 From: Dmitry Safonov Date: Mon, 30 May 2016 15:48:48 +0300 Subject: [PATCH] compel/tests: test binary should return error To check test's result in travis. Cc: Cyrill Gorcunov Signed-off-by: Dmitry Safonov Reviewed-by: Cyrill Gorcunov Signed-off-by: Pavel Emelyanov Signed-off-by: Andrei Vagin --- .../arch/x86/include/arch_test_handle_binary.h | 14 +++++++++----- test/compel/handle_binary.c | 5 +++-- test/compel/main.c | 5 +++-- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/test/compel/arch/x86/include/arch_test_handle_binary.h b/test/compel/arch/x86/include/arch_test_handle_binary.h index 082c00dfb..ae16ac57e 100644 --- a/test/compel/arch/x86/include/arch_test_handle_binary.h +++ b/test/compel/arch/x86/include/arch_test_handle_binary.h @@ -34,12 +34,16 @@ static __maybe_unused void arch_test_set_elf_hdr_machine(Ehdr_t *hdr) #endif /* CONFIG_X86_32 */ -extern void run_tests_64(void *mem, const char *msg); -extern void run_tests_32(void *mem, const char *msg); +extern int run_tests_64(void *mem, const char *msg); +extern int run_tests_32(void *mem, const char *msg); -static __maybe_unused void arch_run_tests(void *mem) +static __maybe_unused int arch_run_tests(void *mem) { - run_tests_64(mem, "(64-bit ELF)"); - run_tests_32(mem, "(32-bit ELF)"); + int ret; + + ret = run_tests_64(mem, "(64-bit ELF)"); + ret += run_tests_32(mem, "(32-bit ELF)"); + + return ret; } #endif /* __ARCH_TEST_HANDLE_BINARY__ */ diff --git a/test/compel/handle_binary.c b/test/compel/handle_binary.c index b06c814ba..4ef42ae11 100644 --- a/test/compel/handle_binary.c +++ b/test/compel/handle_binary.c @@ -88,11 +88,12 @@ static int test_prepare_elf_header(void *elf) return 0; } -void __run_tests(void *mem, const char *msg) +int __run_tests(void *mem, const char *msg) { elf_addr = (uintptr_t)mem; test_bitness = msg; if (test_prepare_elf_header(mem)) - return; + return 1; + return 0; } diff --git a/test/compel/main.c b/test/compel/main.c index 67c4c8430..846095ea1 100644 --- a/test/compel/main.c +++ b/test/compel/main.c @@ -56,8 +56,9 @@ int launch_test(void *mem, int expected_ret, const char *test_fmt, ...) int main(int argc, char **argv) { void *elf_buf = malloc(test_elf_buf_size); + int ret; - arch_run_tests(elf_buf); + ret = arch_run_tests(elf_buf); free(elf_buf); - return 0; + return ret; }