2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-30 13:58:34 +00:00

compel/tests: test binary should return error

To check test's result in travis.

Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Reviewed-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
This commit is contained in:
Dmitry Safonov
2016-05-30 15:48:48 +03:00
committed by Andrei Vagin
parent 5e0b4d0060
commit d6cea81047
3 changed files with 15 additions and 9 deletions

View File

@@ -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__ */

View File

@@ -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;
}

View File

@@ -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;
}