[CRIU] [PATCH 3/6] compel/tests: test binary should return error

Dmitry Safonov dsafonov at virtuozzo.com
Mon May 30 05:48:48 PDT 2016


To check test's result in travis.

Cc: Cyrill Gorcunov <gorcunov at openvz.org>
Signed-off-by: Dmitry Safonov <dsafonov at virtuozzo.com>
---
 test/compel/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 082c00dfb648..ae16ac57eec3 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 b06c814ba7b1..4ef42ae1135c 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 67c4c84304b3..846095ea1a8f 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;
 }
-- 
2.8.2



More information about the CRIU mailing list