tests: Dont have test cases link directly against example dtb data

Several tests (truncated_property, truncated_string, truncated_memrsv and
unterminated_memrsv), rather than loading their example dtb from a file,
instead link directly to trees.o and get the data from directly in their
own data segment.  This was a clever trick once, but it's kind of awkward,
and makes it harder to generalise how we generate those trees.

Change them to load their example data from file, like most of the tests
already do.

Assisted-by: Claude:claude-opus-4-6
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
David Gibson 2026-06-13 20:07:37 +10:00
parent 9b53b9a4c2
commit f116f4800e
7 changed files with 18 additions and 29 deletions

View file

@ -13,18 +13,16 @@
#include <libfdt.h>
#include "tests.h"
#include "testdata.h"
int main(int argc, char *argv[])
{
void *fdt = &truncated_string;
void *fdt;
const struct fdt_property *good, *bad;
int off, len;
const char *name;
test_init(argc, argv);
vg_prepare_blob(fdt, fdt_totalsize(fdt));
fdt = load_blob_arg(argc, argv);
off = fdt_first_property_offset(fdt, 0);
good = fdt_get_property_by_offset(fdt, off, NULL);