Commit d6cea810 authored by Dmitry Safonov's avatar Dmitry Safonov Committed by Andrei Vagin

compel/tests: test binary should return error

To check test's result in travis.

Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarDmitry Safonov <dsafonov@virtuozzo.com>
Reviewed-by: 's avatarCyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent 5e0b4d00
...@@ -34,12 +34,16 @@ static __maybe_unused void arch_test_set_elf_hdr_machine(Ehdr_t *hdr) ...@@ -34,12 +34,16 @@ static __maybe_unused void arch_test_set_elf_hdr_machine(Ehdr_t *hdr)
#endif /* CONFIG_X86_32 */ #endif /* CONFIG_X86_32 */
extern void run_tests_64(void *mem, const char *msg); extern int run_tests_64(void *mem, const char *msg);
extern void run_tests_32(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)"); int ret;
run_tests_32(mem, "(32-bit ELF)");
ret = run_tests_64(mem, "(64-bit ELF)");
ret += run_tests_32(mem, "(32-bit ELF)");
return ret;
} }
#endif /* __ARCH_TEST_HANDLE_BINARY__ */ #endif /* __ARCH_TEST_HANDLE_BINARY__ */
...@@ -88,11 +88,12 @@ static int test_prepare_elf_header(void *elf) ...@@ -88,11 +88,12 @@ static int test_prepare_elf_header(void *elf)
return 0; return 0;
} }
void __run_tests(void *mem, const char *msg) int __run_tests(void *mem, const char *msg)
{ {
elf_addr = (uintptr_t)mem; elf_addr = (uintptr_t)mem;
test_bitness = msg; test_bitness = msg;
if (test_prepare_elf_header(mem)) if (test_prepare_elf_header(mem))
return; return 1;
return 0;
} }
...@@ -56,8 +56,9 @@ int launch_test(void *mem, int expected_ret, const char *test_fmt, ...) ...@@ -56,8 +56,9 @@ int launch_test(void *mem, int expected_ret, const char *test_fmt, ...)
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
void *elf_buf = malloc(test_elf_buf_size); void *elf_buf = malloc(test_elf_buf_size);
int ret;
arch_run_tests(elf_buf); ret = arch_run_tests(elf_buf);
free(elf_buf); free(elf_buf);
return 0; return ret;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment