[arch][test] add a new unittest for the arch mmu code

Just a skeleton at the moment, simply creates an arch aspace
and destroys it.
This commit is contained in:
Travis Geiselbrecht
2021-03-30 00:51:04 -07:00
parent 7102838b49
commit 3be4698671
3 changed files with 44 additions and 0 deletions

33
arch/test/mmu.c Normal file
View File

@@ -0,0 +1,33 @@
/*
* Copyright (c) 2020 Travis Geiselbrecht
*
* Use of this source code is governed by a MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT
*/
#if ARCH_HAS_MMU
#include <arch/mmu.h>
#include <lk/err.h>
#include <lib/unittest.h>
#include <kernel/vm.h>
static bool create_user_aspace(void) {
BEGIN_TEST;
arch_aspace_t as;
status_t err = arch_mmu_init_aspace(&as, USER_ASPACE_BASE, USER_ASPACE_SIZE, 0);
EXPECT_EQ(NO_ERROR, err, "init");
err = arch_mmu_destroy_aspace(&as);
EXPECT_EQ(NO_ERROR, err, "destroy");
END_TEST;
}
BEGIN_TEST_CASE(arch_mmu_tests)
RUN_TEST(create_user_aspace);
END_TEST_CASE(arch_mmu_tests)
#endif // ARCH_HAS_MMU

10
arch/test/rules.mk Normal file
View File

@@ -0,0 +1,10 @@
LOCAL_DIR := $(GET_LOCAL_DIR)
MODULE := $(LOCAL_DIR)
MODULE_SRCS := $(LOCAL_DIR)/mmu.c
MODULE_DEPS := lib/unittest
include make/module.mk

View File

@@ -4,6 +4,7 @@ MODULES += \
app/shell \
app/stringtests \
app/tests \
arch/test \
lib/aes \
lib/aes/test \
lib/cksum \