From ceae16d5a959d10b89190bc7d5421345375307a9 Mon Sep 17 00:00:00 2001 From: Nguyen Anh Quynh Date: Sun, 19 Jan 2014 16:04:23 +0800 Subject: [PATCH] tests: report error when cs_open() failure --- tests/test_arm.c | 5 ++++- tests/test_arm64.c | 5 ++++- tests/test_detail.c | 5 ++++- tests/test_mips.c | 5 ++++- tests/test_ppc.c | 5 ++++- tests/test_x86.c | 5 ++++- 6 files changed, 24 insertions(+), 6 deletions(-) diff --git a/tests/test_arm.c b/tests/test_arm.c index 71ccbb97e..fe5bbd85b 100644 --- a/tests/test_arm.c +++ b/tests/test_arm.c @@ -193,8 +193,11 @@ static void test() int i; for (i = 0; i < sizeof(platforms)/sizeof(platforms[0]); i++) { - if (cs_open(platforms[i].arch, platforms[i].mode, &handle)) + cs_err err = cs_open(platforms[i].arch, platforms[i].mode, &handle); + if (err) { + printf("Failed on cs_open() with error returned: %u\n", err); return; + } cs_option(handle, CS_OPT_DETAIL, CS_OPT_ON); diff --git a/tests/test_arm64.c b/tests/test_arm64.c index 3fd3d22da..d99579a67 100644 --- a/tests/test_arm64.c +++ b/tests/test_arm64.c @@ -151,8 +151,11 @@ static void test() int i; for (i = 0; i < sizeof(platforms)/sizeof(platforms[0]); i++) { - if (cs_open(platforms[i].arch, platforms[i].mode, &handle)) + cs_err err = cs_open(platforms[i].arch, platforms[i].mode, &handle); + if (err) { + printf("Failed on cs_open() with error returned: %u\n", err); return; + } cs_option(handle, CS_OPT_DETAIL, CS_OPT_ON); diff --git a/tests/test_detail.c b/tests/test_detail.c index 2174b8d29..18738add5 100644 --- a/tests/test_detail.c +++ b/tests/test_detail.c @@ -149,8 +149,11 @@ static void test() int i; for (i = 0; i < sizeof(platforms)/sizeof(platforms[0]); i++) { - if (cs_open(platforms[i].arch, platforms[i].mode, &handle)) + cs_err err = cs_open(platforms[i].arch, platforms[i].mode, &handle); + if (err) { + printf("Failed on cs_open() with error returned: %u\n", err); return; + } if (platforms[i].opt_type) cs_option(handle, platforms[i].opt_type, platforms[i].opt_value); diff --git a/tests/test_mips.c b/tests/test_mips.c index a18f10079..02f8d88f8 100644 --- a/tests/test_mips.c +++ b/tests/test_mips.c @@ -98,8 +98,11 @@ static void test() int i; for (i = 0; i < sizeof(platforms)/sizeof(platforms[0]); i++) { - if (cs_open(platforms[i].arch, platforms[i].mode, &handle)) + cs_err err = cs_open(platforms[i].arch, platforms[i].mode, &handle); + if (err) { + printf("Failed on cs_open() with error returned: %u\n", err); return; + } cs_option(handle, CS_OPT_DETAIL, CS_OPT_ON); diff --git a/tests/test_ppc.c b/tests/test_ppc.c index 30d1d2d02..578415339 100644 --- a/tests/test_ppc.c +++ b/tests/test_ppc.c @@ -90,8 +90,11 @@ static void test() int i; for (i = 0; i < sizeof(platforms)/sizeof(platforms[0]); i++) { - if (cs_open(platforms[i].arch, platforms[i].mode, &handle)) + cs_err err = cs_open(platforms[i].arch, platforms[i].mode, &handle); + if (err) { + printf("Failed on cs_open() with error returned: %u\n", err); return; + } cs_option(handle, CS_OPT_DETAIL, CS_OPT_ON); diff --git a/tests/test_x86.c b/tests/test_x86.c index 7be66ad0f..444a4e551 100644 --- a/tests/test_x86.c +++ b/tests/test_x86.c @@ -165,8 +165,11 @@ static void test() int i; for (i = 0; i < sizeof(platforms)/sizeof(platforms[0]); i++) { - if (cs_open(platforms[i].arch, platforms[i].mode, &handle)) + cs_err err = cs_open(platforms[i].arch, platforms[i].mode, &handle); + if (err) { + printf("Failed on cs_open() with error returned: %u\n", err); return; + } if (platforms[i].opt_type) cs_option(handle, platforms[i].opt_type, platforms[i].opt_value);