Make tests fail loudly

This commit is contained in:
Yegor Derevenets 2015-05-30 21:10:23 +02:00
parent 2c073468d8
commit 50c352c9d6
13 changed files with 27 additions and 14 deletions

View File

@ -302,7 +302,7 @@ static void test()
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);
continue;
abort();
}
cs_option(handle, CS_OPT_DETAIL, CS_OPT_ON);
@ -331,6 +331,7 @@ static void test()
printf("Platform: %s\n", platforms[i].comment);
print_string_hex("Code:", platforms[i].code, platforms[i].size);
printf("ERROR: Failed to disasm given code!\n");
abort();
}
printf("\n");

View File

@ -196,7 +196,7 @@ static void test()
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);
continue;
abort();
}
cs_option(handle, CS_OPT_DETAIL, CS_OPT_ON);
@ -223,6 +223,7 @@ static void test()
printf("Platform: %s\n", platforms[i].comment);
print_string_hex("Code: ", platforms[i].code, platforms[i].size);
printf("ERROR: Failed to disasm given code!\n");
abort();
}
printf("\n");

View File

@ -239,7 +239,7 @@ static void test()
err = cs_open(platforms[i].arch, platforms[i].mode, &handle);
if (err) {
printf("Failed on cs_open() with error returned: %u\n", err);
continue;
abort();
}
if (platforms[i].opt_type)
@ -267,6 +267,7 @@ static void test()
printf("Platform: %s\n", platforms[i].comment);
print_string_hex(platforms[i].code, platforms[i].size);
printf("ERROR: Failed to disasm given code!\n");
abort();
}
printf("\n");

View File

@ -35,8 +35,10 @@ static void print_insn(csh handle)
printf("\t%s\t%s\n", insn[0].mnemonic, insn[0].op_str);
// Free memory allocated by cs_disasm()
cs_free(insn, count);
} else
} else {
printf("ERROR: Failed to disasm given code!\n");
abort();
}
}
static void test()
@ -51,7 +53,7 @@ static void test()
err = cs_open(CS_ARCH_X86, CS_MODE_32, &handle);
if (err) {
printf("Failed on cs_open() with error returned: %u\n", err);
return;
abort();
}
// 1. Print out the instruction in default setup.

View File

@ -231,7 +231,7 @@ static void test()
err = cs_open(platforms[i].arch, platforms[i].mode, &handle);
if (err) {
printf("Failed on cs_open() with error returned: %u\n", err);
continue;
abort();
}
if (platforms[i].opt_type)
@ -293,6 +293,7 @@ static void test()
printf("Platform: %s\n", platforms[i].comment);
print_string_hex(platforms[i].code, platforms[i].size);
printf("ERROR: Failed to disasm given code!\n");
abort();
}
printf("\n");

View File

@ -193,7 +193,7 @@ static void test()
err = cs_open(platforms[i].arch, platforms[i].mode, &handle);
if (err) {
printf("Failed on cs_open() with error returned: %u\n", err);
continue;
abort();
}
if (platforms[i].opt_type)

View File

@ -123,7 +123,7 @@ static void test()
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);
continue;
abort();
}
cs_option(handle, CS_OPT_DETAIL, CS_OPT_ON);
@ -150,6 +150,7 @@ static void test()
printf("Platform: %s\n", platforms[i].comment);
print_string_hex("Code:", platforms[i].code, platforms[i].size);
printf("ERROR: Failed to disasm given code!\n");
abort();
}
printf("\n");

View File

@ -142,7 +142,7 @@ static void test()
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);
continue;
abort();
}
cs_option(handle, CS_OPT_DETAIL, CS_OPT_ON);
@ -169,6 +169,7 @@ static void test()
printf("Platform: %s\n", platforms[i].comment);
print_string_hex("Code:", platforms[i].code, platforms[i].size);
printf("ERROR: Failed to disasm given code!\n");
abort();
}
printf("\n");

View File

@ -101,7 +101,7 @@ static void test()
err = cs_open(platforms[i].arch, platforms[i].mode, &handle);
if (err) {
printf("Failed on cs_open() with error returned: %u\n", err);
continue;
abort();
}
if (platforms[i].opt_type)
@ -133,6 +133,7 @@ static void test()
printf("Platform: %s\n", platforms[i].comment);
print_string_hex(platforms[i].code, platforms[i].size);
printf("ERROR: Failed to disasm given code!\n");
abort();
}
printf("\n");

View File

@ -108,7 +108,7 @@ static void test()
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);
continue;
abort();
}
cs_option(handle, CS_OPT_DETAIL, CS_OPT_ON);
@ -135,6 +135,7 @@ static void test()
printf("Platform: %s\n", platforms[i].comment);
print_string_hex("Code:", platforms[i].code, platforms[i].size);
printf("ERROR: Failed to disasm given code!\n");
abort();
}
printf("\n");

View File

@ -101,7 +101,7 @@ static void test()
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);
continue;
abort();
}
cs_option(handle, CS_OPT_DETAIL, CS_OPT_ON);
@ -128,6 +128,7 @@ static void test()
printf("Platform: %s\n", platforms[i].comment);
print_string_hex("Code:", platforms[i].code, platforms[i].size);
printf("ERROR: Failed to disasm given code!\n");
abort();
}
printf("\n");

View File

@ -363,7 +363,7 @@ static void test()
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);
continue;
abort();
}
if (platforms[i].opt_type)
@ -393,6 +393,7 @@ static void test()
printf("Platform: %s\n", platforms[i].comment);
print_string_hex("Code:", platforms[i].code, platforms[i].size);
printf("ERROR: Failed to disasm given code!\n");
abort();
}
printf("\n");

View File

@ -96,7 +96,7 @@ static void test()
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);
continue;
abort();
}
cs_option(handle, CS_OPT_DETAIL, CS_OPT_ON);
@ -123,6 +123,7 @@ static void test()
printf("Platform: %s\n", platforms[i].comment);
print_string_hex("Code:", platforms[i].code, platforms[i].size);
printf("ERROR: Failed to disasm given code!\n");
abort();
}
printf("\n");