aboutsummaryrefslogtreecommitdiffstats
path: root/com32/lib
diff options
context:
space:
mode:
authorMatt Fleming <matt.fleming@intel.com>2013-07-24 12:00:11 +0100
committerMatt Fleming <matt.fleming@intel.com>2013-07-24 12:00:11 +0100
commita93ecd3a4ed47a8ec57f5100919323e752cb83ef (patch)
tree454fcf97125aa1c1c29b89fb8680739a02bce531 /com32/lib
parentd6c6b67fe70af665e4fb1fd6a3fffa6365b0eeda (diff)
downloadsyslinux-a93ecd3a4ed47a8ec57f5100919323e752cb83ef.tar.gz
syslinux-a93ecd3a4ed47a8ec57f5100919323e752cb83ef.tar.xz
syslinux-a93ecd3a4ed47a8ec57f5100919323e752cb83ef.zip
tests: make mmap_entry globally available to unit tests
There's a bunch of places that need to deal with mmap_entry entries when doing tests, so make the structure readily available. Since we're going to get a collection of header files that could be considered the "unit test infrastructure" we might as well create a new directory for them. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Diffstat (limited to 'com32/lib')
-rw-r--r--com32/lib/syslinux/tests/memscan.c2
-rw-r--r--com32/lib/syslinux/tests/movebits.c7
-rw-r--r--com32/lib/syslinux/tests/test-harness.c3
-rw-r--r--com32/lib/syslinux/tests/test.h17
-rw-r--r--com32/lib/syslinux/tests/zonelist.c5
5 files changed, 9 insertions, 25 deletions
diff --git a/com32/lib/syslinux/tests/memscan.c b/com32/lib/syslinux/tests/memscan.c
index bc43a3ed..ea46ca9a 100644
--- a/com32/lib/syslinux/tests/memscan.c
+++ b/com32/lib/syslinux/tests/memscan.c
@@ -1,4 +1,4 @@
-#include "test.h"
+#include "unittest/unittest.h"
#include "../memscan.c"
diff --git a/com32/lib/syslinux/tests/movebits.c b/com32/lib/syslinux/tests/movebits.c
index 09c02cb0..cce269aa 100644
--- a/com32/lib/syslinux/tests/movebits.c
+++ b/com32/lib/syslinux/tests/movebits.c
@@ -1,4 +1,5 @@
-#include "test.h"
+#include "unittest/unittest.h"
+#include "unittest/memmap.h"
#include <setjmp.h>
#include "../../../include/minmax.h"
@@ -11,7 +12,7 @@ static int move_to_terminal_region(void)
addr_t dst, src;
size_t len;
int rv = -1;
- struct mmap_entry entries[] = {
+ struct test_memmap_entry entries[] = {
{ 0x00000, 0x90000, SMT_RESERVED },
{ 0x90000, 0x10000, SMT_TERMINAL },
{ 0xa0000, 0xf000, SMT_FREE },
@@ -46,7 +47,7 @@ static int move_to_overlapping_region(void)
addr_t dst, src;
size_t len;
int rv = -1;
- struct mmap_entry entries[] = {
+ struct test_memmap_entry entries[] = {
{ 0x00000, 0x90000, SMT_RESERVED },
{ 0x90000, 0x10000, SMT_TERMINAL },
{ 0xa0000, 0xf000, SMT_FREE },
diff --git a/com32/lib/syslinux/tests/test-harness.c b/com32/lib/syslinux/tests/test-harness.c
index 49e32f87..d50d0c9c 100644
--- a/com32/lib/syslinux/tests/test-harness.c
+++ b/com32/lib/syslinux/tests/test-harness.c
@@ -1,9 +1,8 @@
-#include "test.h"
#include "../addlist.c"
#include "../freelist.c"
#include "../movebits.c"
-struct syslinux_memmap *test_build_mmap(struct mmap_entry *entries,
+struct syslinux_memmap *test_build_mmap(struct test_memmap_entry *entries,
size_t nr_entries)
{
struct syslinux_memmap *mmap;
diff --git a/com32/lib/syslinux/tests/test.h b/com32/lib/syslinux/tests/test.h
deleted file mode 100644
index 91ba860d..00000000
--- a/com32/lib/syslinux/tests/test.h
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef _TEST_H_
-#define _TEST_H_
-
-#include "unittest.h"
-#include "syslinux/movebits.h"
-
-#define array_sz(x) (sizeof((x)) / sizeof((x)[0]))
-
-struct mmap_entry {
- addr_t start;
- addr_t size;
- enum syslinux_memmap_types type;
-};
-
-extern struct syslinux_memmap *build_mmap(struct mmap_entry *entries,
- size_t nr_entries);
-#endif /* _TEST_H_ */
diff --git a/com32/lib/syslinux/tests/zonelist.c b/com32/lib/syslinux/tests/zonelist.c
index ac7c1743..039d5c57 100644
--- a/com32/lib/syslinux/tests/zonelist.c
+++ b/com32/lib/syslinux/tests/zonelist.c
@@ -15,7 +15,8 @@
* run on the development host we must include all headers with absolute
* paths.
*/
-#include "test.h"
+#include "unittest/unittest.h"
+#include "unittest/memmap.h"
#include "../zonelist.c"
#include "test-harness.c"
@@ -172,7 +173,7 @@ static int demote_free_region_to_terminal(void)
enum syslinux_memmap_types type;
struct syslinux_memmap *mmap;
int rv = -1;
- struct mmap_entry entries[] = {
+ struct test_memmap_entry entries[] = {
{ 0x100000, 0x300000, SMT_TERMINAL },
{ 0x400000, 0x300000, SMT_FREE },
{ 0x700000, 0x20000, SMT_FREE },