-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ut: Tests added for cm_malloc/free functions
Multiple changes to re-use already written tests for kmalloc/kfree to also test similar cm_malloc/cm_free functions.
- Loading branch information
1 parent
6d4a8e2
commit 06a3d6f
Showing
10 changed files
with
239 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#pragma once | ||
|
||
#include <unittest/fake.h> | ||
#include <cm/cm.h> | ||
|
||
DECLARE_FUNC (void*, cm_memset, void*, U8, size_t); | ||
DECLARE_FUNC (char*, cm_strncpy, char*, const char*, size_t); | ||
DECLARE_FUNC (S32, syscall, U32, U32, U32, U32, U32, U32); | ||
|
||
void resetCMFake(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#include <mock/cm/cm.h> | ||
#include <unittest/fake.h> | ||
|
||
DEFINE_FUNC (void*, cm_memset, void*, U8, size_t); | ||
DEFINE_FUNC (char*, cm_strncpy, char*, const char*, size_t); | ||
DEFINE_FUNC (S32, syscall, U32, U32, U32, U32, U32, U32); | ||
|
||
void resetCMFake() | ||
{ | ||
RESET_FAKE(cm_memset); | ||
RESET_FAKE(cm_strncpy); | ||
RESET_FAKE(syscall); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
* ---------------------------------------------------------------------------- | ||
* Common functions to for use in MeghaOS LibCM unitests | ||
* ---------------------------------------------------------------------------- | ||
*/ | ||
|
||
#include <unittest/unittest.h> | ||
#include <stdio.h> | ||
#include <types.h> | ||
#include <stdarg.h> | ||
#include <kernel.h> | ||
#include <mosunittest.h> | ||
|
||
/* MOS Unittest Macro mock global structure */ | ||
MockedMacro g_utmm = { 0 }; | ||
|
||
/* Error number */ | ||
uint32_t cm_error_num; | ||
|
||
/* Panic handler */ | ||
bool cm_panic_invoked; | ||
void cm_unittest_panic_handler() | ||
{ | ||
cm_panic_invoked = true; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../kernel/kmalloc_test.c |
Oops, something went wrong.