diff mbox series

[v3,09/16] main: Fix probe() to print targets correctly

Message ID 20181115071929.206974-10-amitay@ozlabs.org
State Superseded
Headers show
Series Device tree path based targeting | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch success master/apply_patch Successfully applied
snowpatch_ozlabs/build-multiarch success Test build-multiarch on branch master

Commit Message

Amitay Isaacs Nov. 15, 2018, 7:19 a.m. UTC
Signed-off-by: Amitay Isaacs <amitay@ozlabs.org>
---
 src/main.c              | 11 -----------
 tests/test_selection.sh | 43 +++--------------------------------------
 2 files changed, 3 insertions(+), 51 deletions(-)
diff mbox series

Patch

diff --git a/src/main.c b/src/main.c
index 0a3a8fb..3b20bf0 100644
--- a/src/main.c
+++ b/src/main.c
@@ -678,8 +678,6 @@  void print_target(struct pdbg_target *target, int level)
 	struct pdbg_target *next;
 	enum pdbg_target_status status;
 
-	pdbg_target_probe(target);
-
 	/* Does this target actually exist? */
 	status = pdbg_target_status(target);
 	if (status != PDBG_TARGET_ENABLED)
@@ -708,9 +706,6 @@  void print_target(struct pdbg_target *target, int level)
 	}
 
 	pdbg_for_each_child_target(target, next) {
-		if (!target_selected(next))
-			continue;
-
 		print_target(next, level + 1);
 	}
 }
@@ -720,15 +715,9 @@  static int probe(void)
 	struct pdbg_target *target;
 
 	pdbg_for_each_class_target("pib", target) {
-		if (!target_selected(target))
-			continue;
-
 		print_target(target, 0);
 	}
 
-	printf("\nNote that only selected targets will be shown above. If none are shown\n"
-			"try adding '-a' to select all targets\n");
-
 	return 1;
 }
 OPTCMD_DEFINE_CMD(probe, probe);
diff --git a/tests/test_selection.sh b/tests/test_selection.sh
index 2b23ec1..8909796 100755
--- a/tests/test_selection.sh
+++ b/tests/test_selection.sh
@@ -13,10 +13,9 @@  do_skip ()
 	fi
 }
 
-test_result 0 <<EOF
-
-Note that only selected targets will be shown above. If none are shown
-try adding '-a' to select all targets
+test_result 1 <<EOF
+No valid targets found or specified. Try adding -p/-c/-t options to specify a target.
+Alternatively run 'pdbg -a probe' to get a list of all valid targets
 EOF
 
 do_skip
@@ -128,9 +127,6 @@  p7: Fake PIB
     c3: Fake Core
         t0: Fake Thread
         t1: Fake Thread
-
-Note that only selected targets will be shown above. If none are shown
-try adding '-a' to select all targets
 EOF
 
 do_skip
@@ -151,9 +147,6 @@  p0: Fake PIB
     c3: Fake Core
         t0: Fake Thread
         t1: Fake Thread
-
-Note that only selected targets will be shown above. If none are shown
-try adding '-a' to select all targets
 EOF
 
 do_skip
@@ -193,9 +186,6 @@  p7: Fake PIB
     c0: Fake Core
         t0: Fake Thread
         t1: Fake Thread
-
-Note that only selected targets will be shown above. If none are shown
-try adding '-a' to select all targets
 EOF
 
 do_skip
@@ -275,9 +265,6 @@  p7: Fake PIB
         t0: Fake Thread
     c3: Fake Core
         t0: Fake Thread
-
-Note that only selected targets will be shown above. If none are shown
-try adding '-a' to select all targets
 EOF
 
 do_skip
@@ -289,9 +276,6 @@  p0: Fake PIB
     c2: Fake Core
         t0: Fake Thread
         t1: Fake Thread
-
-Note that only selected targets will be shown above. If none are shown
-try adding '-a' to select all targets
 EOF
 
 do_skip
@@ -302,9 +286,6 @@  test_result 0 <<EOF
 p0: Fake PIB
     c2: Fake Core
         t1: Fake Thread
-
-Note that only selected targets will be shown above. If none are shown
-try adding '-a' to select all targets
 EOF
 
 do_skip
@@ -328,9 +309,6 @@  p6: Fake PIB
     c0: Fake Core
         t0: Fake Thread
 
-Note that only selected targets will be shown above. If none are shown
-try adding '-a' to select all targets
-
 EOF
 
 do_skip
@@ -339,9 +317,6 @@  test_run pdbg -b fake -p1-3,5,5-6 -c0 -t0 probe
 
 test_result 0 <<EOF
 p0: Fake PIB
-
-Note that only selected targets will be shown above. If none are shown
-try adding '-a' to select all targets
 EOF
 
 do_skip
@@ -391,9 +366,6 @@  test_run pdbg -b fake -t0 -p0 probe
 test_result 0 <<EOF
 p0: Fake PIB
     c0: Fake Core
-
-Note that only selected targets will be shown above. If none are shown
-try adding '-a' to select all targets
 EOF
 
 do_skip
@@ -404,9 +376,6 @@  test_result 0 <<EOF
 p0: Fake PIB
     c0: Fake Core
         t0: Fake Thread
-
-Note that only selected targets will be shown above. If none are shown
-try adding '-a' to select all targets
 EOF
 
 do_skip
@@ -434,9 +403,6 @@  p7: Fake PIB
         t0: Fake Thread
     c3: Fake Core
         t0: Fake Thread
-
-Note that only selected targets will be shown above. If none are shown
-try adding '-a' to select all targets
 EOF
 
 do_skip
@@ -464,9 +430,6 @@  p7: Fake PIB
         t1: Fake Thread
     c3: Fake Core
         t1: Fake Thread
-
-Note that only selected targets will be shown above. If none are shown
-try adding '-a' to select all targets
 EOF
 
 do_skip