]> git.proxmox.com Git - efi-boot-shim.git/blame - test-pe-relocate.c
bump version to 15.8-1+pmx1
[efi-boot-shim.git] / test-pe-relocate.c
CommitLineData
fd2d9f03
SM
1// SPDX-License-Identifier: BSD-2-Clause-Patent
2/*
3 * test-pe-reloc.c - attempt to test relocate_coff()
4 * Copyright Peter Jones <pjones@redhat.com>
5 */
6
7#ifndef SHIM_UNIT_TEST
8#define SHIM_UNIT_TEST
9#endif
10#include "shim.h"
11
12static int
13test_image_address(void)
14{
15 char image[4];
16 void *ret;
17
18 assert_equal_return(ImageAddress(image, sizeof(image), 0), &image[0], -1, "got %p expected %p\n");
19 assert_equal_return(ImageAddress(image, sizeof(image), 4), NULL, -1, "got %p expected %p\n");
20 assert_equal_return(ImageAddress((void *)1, 2, 3), NULL, -1, "got %p expected %p\n");
21 assert_equal_return(ImageAddress((void *)-1ull, UINT64_MAX, UINT64_MAX), NULL, -1, "got %p expected %p\n");
22 assert_equal_return(ImageAddress((void *)0, UINT64_MAX, UINT64_MAX), NULL, -1, "got %p expected %p\n");
23 assert_equal_return(ImageAddress((void *)1, UINT64_MAX, UINT64_MAX), NULL, -1, "got %p expected %p\n");
24 assert_equal_return(ImageAddress((void *)2, UINT64_MAX, UINT64_MAX), NULL, -1, "got %p expected %p\n");
25 assert_equal_return(ImageAddress((void *)3, UINT64_MAX, UINT64_MAX), NULL, -1, "got %p expected %p\n");
26
27 return 0;
28}
29
30int
31main(void)
32{
33 int status = 0;
34 test(test_image_address);
35
36 return status;
37}
38
39// vim:fenc=utf-8:tw=75:noet