forked from rhboot/shim
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This makes some checks in `get_mem_attrs` and `update_mem_attrs` clearer. Also add `test-pe-util.c` with a test for the new macro. The file is named that way instead of `test-pe.c` to avoid having to get `pe.c` building in the unit test environment. Signed-off-by: Nicholas Bishop <[email protected]>
- Loading branch information
1 parent
c7b3051
commit e4f40ae
Showing
3 changed files
with
35 additions
and
2 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,30 @@ | ||
// SPDX-License-Identifier: BSD-2-Clause-Patent | ||
/* | ||
* test-pe-util.c - test PE utilities | ||
*/ | ||
|
||
#ifndef SHIM_UNIT_TEST | ||
#define SHIM_UNIT_TEST | ||
#endif | ||
#include "shim.h" | ||
|
||
static int | ||
test_is_page_aligned(void) | ||
{ | ||
assert_true_return(IS_PAGE_ALIGNED(0), -1, "\n"); | ||
assert_false_return(IS_PAGE_ALIGNED(1), -1, "\n"); | ||
assert_false_return(IS_PAGE_ALIGNED(4095), -1, "\n"); | ||
assert_true_return(IS_PAGE_ALIGNED(4096), -1, "\n"); | ||
assert_false_return(IS_PAGE_ALIGNED(4097), -1, "\n"); | ||
|
||
return 0; | ||
} | ||
|
||
int | ||
main(void) | ||
{ | ||
int status = 0; | ||
test(test_is_page_aligned); | ||
|
||
return status; | ||
} |