[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:
33
arch/test/mmu.c
Normal file
33
arch/test/mmu.c
Normal 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
10
arch/test/rules.mk
Normal 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
|
||||
|
||||
@@ -4,6 +4,7 @@ MODULES += \
|
||||
app/shell \
|
||||
app/stringtests \
|
||||
app/tests \
|
||||
arch/test \
|
||||
lib/aes \
|
||||
lib/aes/test \
|
||||
lib/cksum \
|
||||
|
||||
Reference in New Issue
Block a user