[Pdbg] [PATCH] tests: Fix the core address calculation

Amitay Isaacs amitay at ozlabs.org
Wed Mar 27 17:44:57 AEDT 2019


fake.dts was changed to have fixed addresses for core (to be able to
test exact dn name match).

Signed-off-by: Amitay Isaacs <amitay at ozlabs.org>
---
 src/tests/libpdbg_target_test.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/tests/libpdbg_target_test.c b/src/tests/libpdbg_target_test.c
index eb5e0f4..73a831b 100644
--- a/src/tests/libpdbg_target_test.c
+++ b/src/tests/libpdbg_target_test.c
@@ -161,9 +161,9 @@ int main(void)
 		assert(!strncmp(name, "pib", 3));
 	}
 
-	i = 0;
 	pdbg_for_each_class_target("core", target) {
 		uint64_t addr, size;
+		uint32_t index;
 
 		parent = pdbg_target_parent("fsi", target);
 		assert(parent);
@@ -207,10 +207,10 @@ int main(void)
 		name = pdbg_target_dn_name(target);
 		assert(!strncmp(name, "core", 4));
 
+		index = pdbg_target_index(target);
 		addr = pdbg_target_address(target, &size);
 		assert(size == 0);
-		assert(addr == 0x10000 + (i / 4)*0x1000 + ((i % 4) + 1)*0x10);
-		i++;
+		assert(addr == 0x10000 + (index + 1)*0x10);
 	}
 
 	pdbg_for_each_class_target("thread", target) {
-- 
2.20.1



More information about the Pdbg mailing list