aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2018-09-10 12:41:20 +1000
committerDavid Gibson <david@gibson.dropbear.id.au>2018-09-10 13:09:38 +1000
commitc3f50c9a86d91758d9ca3885adcad0622eac66aa (patch)
tree1fdd83cd6ce919967c10fccdeb9ce22efd7d3961
parent0ac9fdee37c7afe42285bbf197e6e3152b6c6c45 (diff)
downloaddtc-c3f50c9a86d91758d9ca3885adcad0622eac66aa.zip
dtc-c3f50c9a86d91758d9ca3885adcad0622eac66aa.tar.gz
dtc-c3f50c9a86d91758d9ca3885adcad0622eac66aa.tar.bz2
tests: Allow dtbs_equal_unordered to ignore mem reserves
For some upcoming tests we want to be able to test if two trees are equal, but we don't care about the memory reservation map. So, this adds an option to the dtbs_equal_unordered test helper which tells it to ignore the reserve map. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
-rw-r--r--tests/dtbs_equal_unordered.c36
1 files changed, 28 insertions, 8 deletions
diff --git a/tests/dtbs_equal_unordered.c b/tests/dtbs_equal_unordered.c
index baf2ae7..47baa84 100644
--- a/tests/dtbs_equal_unordered.c
+++ b/tests/dtbs_equal_unordered.c
@@ -30,6 +30,7 @@
#include "testdata.h"
static int notequal; /* = 0 */
+static int ignore_memrsv; /* = 0 */
#define MISMATCH(fmt, ...) \
do { \
@@ -195,22 +196,41 @@ static void compare_node(const void *fdt1, int offset1,
compare_subnodes(fdt2, offset2, fdt1, offset1, 0);
}
+static void badargs(char **argv)
+{
+ CONFIG("Usage: %s [-n] [-m] <dtb file> <dtb file>", argv[0]);
+}
+
int main(int argc, char *argv[])
{
void *fdt1, *fdt2;
uint32_t cpuid1, cpuid2;
+ char **args;
+ int argsleft;
test_init(argc, argv);
- if ((argc != 3)
- && ((argc != 4) || !streq(argv[1], "-n")))
- CONFIG("Usage: %s [-n] <dtb file> <dtb file>", argv[0]);
- if (argc == 4)
- notequal = 1;
- fdt1 = load_blob(argv[argc-2]);
- fdt2 = load_blob(argv[argc-1]);
+ args = &argv[1];
+ argsleft = argc - 1;
+
+ while (argsleft > 2) {
+ if (streq(args[0], "-n"))
+ notequal = 1;
+ else if (streq(args[0], "-m"))
+ ignore_memrsv = 1;
+ else
+ badargs(argv);
+ args++;
+ argsleft--;
+ }
+ if (argsleft != 2)
+ badargs(argv);
+
+ fdt1 = load_blob(args[0]);
+ fdt2 = load_blob(args[1]);
- compare_mem_rsv(fdt1, fdt2);
+ if (!ignore_memrsv)
+ compare_mem_rsv(fdt1, fdt2);
compare_node(fdt1, 0, fdt2, 0);
cpuid1 = fdt_boot_cpuid_phys(fdt1);