mirror of
https://github.com/yuzu-emu/unicorn
synced 2024-11-24 08:38:25 +00:00
added test for unmap of doubly mapped region
This commit is contained in:
parent
53a989a751
commit
fa2da819b6
2 changed files with 14 additions and 1 deletions
|
@ -29,4 +29,4 @@ test_mem_map_ptr: test_mem_map_ptr.c
|
|||
test_mem_high: test_mem_high.c
|
||||
|
||||
${ALL_TESTS}:
|
||||
gcc ${CFLAGS} -o $@ $^
|
||||
clang ${CFLAGS} -o $@ $^
|
||||
|
|
|
@ -129,6 +129,18 @@ static void test_bad_unmap(void **state)
|
|||
}
|
||||
|
||||
|
||||
/* Try to unmap memory that has not been mapped twice*/
|
||||
static void test_unmap_double_map(void **state)
|
||||
{
|
||||
uc_engine *uc = *state;
|
||||
|
||||
/* TODO: Which error should this return? */
|
||||
uc_assert_success(uc_mem_map(uc, 0, 0x4000, 0)); /* 0x0000 - 0x1000 */
|
||||
uc_assert_success(uc_mem_map(uc, 0x0000, 0x1000, 0)); /* 0x1000 - 0x2000 */
|
||||
|
||||
uc_assert_fail(uc_mem_unmap(uc, 0x2000, 0x2000));
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
#define test(x) cmocka_unit_test_setup_teardown(x, setup, teardown)
|
||||
const struct CMUnitTest tests[] = {
|
||||
|
@ -137,6 +149,7 @@ int main(void) {
|
|||
//test(test_bad_write),
|
||||
test(test_bad_unmap),
|
||||
test(test_rw_across_boundaries),
|
||||
test(test_unmap_double_map),
|
||||
};
|
||||
#undef test
|
||||
return cmocka_run_group_tests(tests, NULL, NULL);
|
||||
|
|
Loading…
Reference in a new issue