Makefile: Group run_test.sh tests under TESTS

List all test groups in a single TESTS variable for programmatic access.

Group all 'test: <test-group>' rules into a single 'test: $(TESTS)'.

Make all TESTS depend on their required (host) KERNEL_IMAGE.

Note that the 'test' target now directly depends on individual tests
instead of relying on the indirection of test-{boot,crosvm-helloworld}.

Note that dynamically generated tests are not included in TESTS,
although still marked as dependencies of 'test'.

Bug: 195395681
Test: make test
Change-Id: I5740201824ab0d4e11c37229c170693d5d6008f2
diff --git a/Makefile b/Makefile
index 97c6c42..cfed8e1 100644
--- a/Makefile
+++ b/Makefile
@@ -393,16 +393,14 @@
 		-a "boot_test_mode=$(2)"
 endef
 
-test: test-boot
-
 .PHONY: test-boot
 test-boot: $(BOOT_TESTS)
 
 TEST_LISTS += test-list-boot
 test-list-boot: LISTED_TESTS = $(BOOT_TESTS)
 
-.PHONY: $(BOOT_TESTS)
-$(BOOT_TESTS): $(KERNEL_IMAGE)
+TESTS += $(BOOT_TESTS)
+$(BOOT_TESTS):
 	@ $(call gen_boot_test,$@,$(call hyphensuffix,$@))
 
 #
@@ -426,17 +424,18 @@
 		-R $(PREBUILTS_CROSVM_EXT4)
 endef
 
-test: test-crosvm-helloworld
 .PHONY: test-crosvm-helloworld
 test-crosvm-helloworld: $(CROSVM_HELLOWORLD_TESTS)
 
 TEST_LISTS += test-list-crosvm-helloworld
 test-list-crosvm-helloworld: LISTED_TESTS = $(CROSVM_HELLOWORLD_TESTS)
 
-.PHONY: $(CROSVM_HELLOWORLD_TESTS)
-$(CROSVM_HELLOWORLD_TESTS): $(KERNEL_IMAGE) $(UBOOT_BIN)
+TESTS += $(CROSVM_HELLOWORLD_TESTS)
+$(CROSVM_HELLOWORLD_TESTS): $(UBOOT_BIN)
 	@ $(call gen_crosvm_helloworld_test,$@,$(call hyphensuffix,$@))
 
+.PHONY test: $(TESTS)
+$(TESTS): $(KERNEL_IMAGE)
 .PHONY test-list: $(TEST_LISTS)
 $(TEST_LISTS):
 	@ for x in $(LISTED_TESTS); do echo $$x; done