Split tests makefile
Instead of unconditionally pulling all test source files in tests.mk,
introduce small makefiles that pull in only those source files that
are required to test a particular feature. For every tests manifest
(test-*.xml files), create the associated makefile.
The main benefit is to compile only the required test source files
when selecting a subset of the tests. For example, if one selects the
SDEI XML file, the TFTF binary only needs the SDEI test cases.
Change-Id: I281eb50846edea2d238c86a795fde8747f8b420b
Signed-off-by: Sandrine Bailleux <sandrine.bailleux@arm.com>
diff --git a/tftf/tests/tests-arm-state-switch.mk b/tftf/tests/tests-arm-state-switch.mk
new file mode 100644
index 0000000..55ff84a
--- /dev/null
+++ b/tftf/tests/tests-arm-state-switch.mk
@@ -0,0 +1,11 @@
+#
+# Copyright (c) 2018, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+
+TESTS_SOURCES += \
+ $(addprefix tftf/tests/runtime_services/sip_service/, \
+ test_exec_state_switch.c \
+ test_exec_state_switch_asm.S \
+ )
diff --git a/tftf/tests/tests-boot-req.mk b/tftf/tests/tests-boot-req.mk
new file mode 100644
index 0000000..1350aab
--- /dev/null
+++ b/tftf/tests/tests-boot-req.mk
@@ -0,0 +1,9 @@
+#
+# Copyright (c) 2018, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+
+TESTS_SOURCES += $(addprefix tftf/tests/misc_tests/boot_req_tests/, \
+ test_cntfrq.c \
+)
diff --git a/tftf/tests/tests-cpu-extensions.mk b/tftf/tests/tests-cpu-extensions.mk
new file mode 100644
index 0000000..6734b0a
--- /dev/null
+++ b/tftf/tests/tests-cpu-extensions.mk
@@ -0,0 +1,11 @@
+#
+# Copyright (c) 2018, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+
+TESTS_SOURCES += $(addprefix tftf/tests/, \
+ extensions/amu/test_amu.c \
+ runtime_services/arm_arch_svc/smccc_arch_workaround_1.c \
+ runtime_services/arm_arch_svc/smccc_arch_workaround_2.c \
+)
diff --git a/tftf/tests/tests-el3-power-state.mk b/tftf/tests/tests-el3-power-state.mk
new file mode 100644
index 0000000..079fce9
--- /dev/null
+++ b/tftf/tests/tests-el3-power-state.mk
@@ -0,0 +1,10 @@
+#
+# Copyright (c) 2018, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+
+TESTS_SOURCES += \
+ $(addprefix tftf/tests/runtime_services/standard_service/psci/api_tests/validate_power_state/, \
+ test_validate_power_state.c \
+ )
diff --git a/tftf/tests/tests-fwu.mk b/tftf/tests/tests-fwu.mk
new file mode 100644
index 0000000..ee46797
--- /dev/null
+++ b/tftf/tests/tests-fwu.mk
@@ -0,0 +1,12 @@
+#
+# Copyright (c) 2018, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+
+TESTS_SOURCES += $(addprefix tftf/tests/fwu_tests/, \
+ test_fwu_auth.c \
+ test_fwu_toc.c \
+)
+
+TESTS_SOURCES += plat/common/fwu_nvm_accessors.c
diff --git a/tftf/tests/tests-manual.mk b/tftf/tests/tests-manual.mk
new file mode 100644
index 0000000..fea81a1
--- /dev/null
+++ b/tftf/tests/tests-manual.mk
@@ -0,0 +1,13 @@
+#
+# Copyright (c) 2018, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+
+TESTS_SOURCES += \
+ $(addprefix tftf/tests/runtime_services/standard_service/psci/api_tests/, \
+ mem_protect/test_mem_protect.c \
+ psci_stat/test_psci_stat.c \
+ reset2/reset2.c \
+ system_off/test_system_off.c \
+ )
diff --git a/tftf/tests/tests-performance.mk b/tftf/tests/tests-performance.mk
new file mode 100644
index 0000000..fc082c6
--- /dev/null
+++ b/tftf/tests/tests-performance.mk
@@ -0,0 +1,9 @@
+#
+# Copyright (c) 2018, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+
+TESTS_SOURCES += $(addprefix tftf/tests/performance_tests/, \
+ smc_latencies.c \
+)
diff --git a/tftf/tests/tests-psci-extensive.mk b/tftf/tests/tests-psci-extensive.mk
new file mode 100644
index 0000000..1bff909
--- /dev/null
+++ b/tftf/tests/tests-psci-extensive.mk
@@ -0,0 +1,12 @@
+#
+# Copyright (c) 2018, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+
+TESTS_SOURCES += \
+ $(addprefix tftf/tests/runtime_services/standard_service/psci/system_tests/, \
+ test_psci_hotplug_stress.c \
+ test_psci_on_off_suspend_stress.c \
+ test_psci_system_suspend_stress.c \
+ )
diff --git a/tftf/tests/tests-psci.mk b/tftf/tests/tests-psci.mk
new file mode 100644
index 0000000..0be0cef
--- /dev/null
+++ b/tftf/tests/tests-psci.mk
@@ -0,0 +1,26 @@
+#
+# Copyright (c) 2018, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+
+TESTS_SOURCES += \
+ $(addprefix tftf/tests/runtime_services/standard_service/, \
+ query_std_svc.c \
+ unknown_smc.c \
+ )
+
+TESTS_SOURCES += \
+ $(addprefix tftf/tests/runtime_services/standard_service/psci/api_tests/, \
+ affinity_info/test_psci_affinity_info.c \
+ cpu_hotplug/test_psci_hotplug.c \
+ cpu_hotplug/test_psci_hotplug_invalid.c \
+ cpu_suspend/test_suspend.c \
+ mem_protect_check/mem_protect_check.c \
+ migrate_info_type/test_migrate_info_type.c \
+ psci_features/test_psci_features.c \
+ psci_node_hw_state/test_node_hw_state.c \
+ psci_stat/test_psci_stat.c \
+ psci_version/test_psci_version.c \
+ system_suspend/test_psci_system_suspend.c \
+ )
diff --git a/tftf/tests/tests-runtime-instrumentation.mk b/tftf/tests/tests-runtime-instrumentation.mk
new file mode 100644
index 0000000..ff9a7a6
--- /dev/null
+++ b/tftf/tests/tests-runtime-instrumentation.mk
@@ -0,0 +1,10 @@
+#
+# Copyright (c) 2018, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+
+TESTS_SOURCES += \
+ $(addprefix tftf/tests/runtime_services/standard_service/pmf/api_tests/runtime_instr/, \
+ test_pmf_rt_instr.c \
+ )
diff --git a/tftf/tests/tests-sdei.mk b/tftf/tests/tests-sdei.mk
new file mode 100644
index 0000000..47bd506
--- /dev/null
+++ b/tftf/tests/tests-sdei.mk
@@ -0,0 +1,12 @@
+#
+# Copyright (c) 2018, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+
+TESTS_SOURCES += \
+ $(addprefix tftf/tests/runtime_services/standard_service/sdei/system_tests/, \
+ sdei_entrypoint.S \
+ test_sdei.c \
+ test_sdei_state.c \
+ )
diff --git a/tftf/tests/tests-single-fault.mk b/tftf/tests/tests-single-fault.mk
new file mode 100644
index 0000000..0641865
--- /dev/null
+++ b/tftf/tests/tests-single-fault.mk
@@ -0,0 +1,10 @@
+#
+# Copyright (c) 2018, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+
+TESTS_SOURCES += $(addprefix tftf/tests/misc_tests/, \
+ inject_serror.S \
+ test_single_fault.c \
+)
diff --git a/tftf/tests/tests-spm.mk b/tftf/tests/tests-spm.mk
new file mode 100644
index 0000000..3d664fd
--- /dev/null
+++ b/tftf/tests/tests-spm.mk
@@ -0,0 +1,12 @@
+#
+# Copyright (c) 2018, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+
+TESTS_SOURCES += \
+ $(addprefix tftf/tests/runtime_services/secure_service/, \
+ secure_service_helpers.c \
+ test_secure_service_handle.c \
+ test_secure_service_interrupts.c \
+ )
diff --git a/tftf/tests/tests-template.mk b/tftf/tests/tests-template.mk
new file mode 100644
index 0000000..392f0e1
--- /dev/null
+++ b/tftf/tests/tests-template.mk
@@ -0,0 +1,10 @@
+#
+# Copyright (c) 2018, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+
+TESTS_SOURCES += $(addprefix tftf/tests/template_tests/, \
+ test_template_multi_core.c \
+ test_template_single_core.c \
+)
diff --git a/tftf/tests/tests-tftf-validation.mk b/tftf/tests/tests-tftf-validation.mk
new file mode 100644
index 0000000..8b979f2
--- /dev/null
+++ b/tftf/tests/tests-tftf-validation.mk
@@ -0,0 +1,14 @@
+#
+# Copyright (c) 2018, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+
+TESTS_SOURCES += \
+ $(addprefix tftf/tests/framework_validation_tests/, \
+ test_timer_framework.c \
+ test_validation_events.c \
+ test_validation_irq.c \
+ test_validation_nvm.c \
+ test_validation_sgi.c \
+ )
diff --git a/tftf/tests/tests-tsp.mk b/tftf/tests/tests-tsp.mk
new file mode 100644
index 0000000..b1d8b15
--- /dev/null
+++ b/tftf/tests/tests-tsp.mk
@@ -0,0 +1,14 @@
+#
+# Copyright (c) 2018, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+
+TESTS_SOURCES += \
+ $(addprefix tftf/tests/runtime_services/trusted_os/tsp/, \
+ test_irq_preempted_std_smc.c \
+ test_irq_spurious_gicv2.c \
+ test_smc_tsp_std_fn_call.c \
+ test_tsp_fast_smc.c \
+ test_normal_int_switch.c \
+ )
diff --git a/tftf/tests/tests-uncontainable.mk b/tftf/tests/tests-uncontainable.mk
new file mode 100644
index 0000000..7a47300
--- /dev/null
+++ b/tftf/tests/tests-uncontainable.mk
@@ -0,0 +1,10 @@
+#
+# Copyright (c) 2018, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+
+TESTS_SOURCES += $(addprefix tftf/tests/misc_tests/, \
+ inject_serror.S \
+ test_uncontainable.c \
+)
diff --git a/tftf/tests/tests.mk b/tftf/tests/tests.mk
index f3b7ab0..3a4e42f 100644
--- a/tftf/tests/tests.mk
+++ b/tftf/tests/tests.mk
@@ -18,72 +18,28 @@
$(error "The file TESTS_FILE points to cannot be found")
endif
-SPM_TESTS_SOURCES := \
- $(addprefix tftf/tests/runtime_services/secure_service/, \
- secure_service_helpers.c \
- test_secure_service_handle.c \
- test_secure_service_interrupts.c \
- )
+# Initialize variable before including all sub-makefiles that will append source
+# files to it.
+TESTS_SOURCES :=
-FWU_TESTS_SOURCES := \
- tftf/tests/fwu_tests/test_fwu_toc.c \
- tftf/tests/fwu_tests/test_fwu_auth.c \
- plat/common/fwu_nvm_accessors.c
+include tftf/tests/tests-arm-state-switch.mk
+include tftf/tests/tests-boot-req.mk
+include tftf/tests/tests-cpu-extensions.mk
+include tftf/tests/tests-el3-power-state.mk
+include tftf/tests/tests-fwu.mk
+include tftf/tests/tests-manual.mk
+include tftf/tests/tests-performance.mk
+include tftf/tests/tests-psci-extensive.mk
+include tftf/tests/tests-psci.mk
+include tftf/tests/tests-runtime-instrumentation.mk
+include tftf/tests/tests-sdei.mk
+include tftf/tests/tests-single-fault.mk
+include tftf/tests/tests-spm.mk
+include tftf/tests/tests-template.mk
+include tftf/tests/tests-tftf-validation.mk
+include tftf/tests/tests-tsp.mk
+include tftf/tests/tests-uncontainable.mk
-TESTS_SOURCES := $(addprefix tftf/tests/, \
- extensions/amu/test_amu.c \
- framework_validation_tests/test_timer_framework.c \
- framework_validation_tests/test_validation_events.c \
- framework_validation_tests/test_validation_irq.c \
- framework_validation_tests/test_validation_nvm.c \
- framework_validation_tests/test_validation_sgi.c \
- misc_tests/inject_serror.S \
- misc_tests/test_single_fault.c \
- misc_tests/test_uncontainable.c \
- performance_tests/smc_latencies.c \
- misc_tests/boot_req_tests/test_cntfrq.c \
- runtime_services/arm_arch_svc/smccc_arch_workaround_1.c \
- runtime_services/arm_arch_svc/smccc_arch_workaround_2.c \
- runtime_services/sip_service/test_exec_state_switch.c \
- runtime_services/sip_service/test_exec_state_switch_asm.S \
- runtime_services/standard_service/pmf/api_tests/runtime_instr/test_pmf_rt_instr.c \
- runtime_services/standard_service/psci/api_tests/affinity_info/test_psci_affinity_info.c \
- runtime_services/standard_service/psci/api_tests/cpu_hotplug/test_psci_hotplug.c \
- runtime_services/standard_service/psci/api_tests/cpu_hotplug/test_psci_hotplug_invalid.c \
- runtime_services/standard_service/psci/api_tests/cpu_suspend/test_suspend.c \
- runtime_services/standard_service/psci/api_tests/migrate_info_type/test_migrate_info_type.c \
- runtime_services/standard_service/psci/api_tests/psci_features/test_psci_features.c \
- runtime_services/standard_service/psci/api_tests/psci_node_hw_state/test_node_hw_state.c \
- runtime_services/standard_service/psci/api_tests/psci_stat/test_psci_stat.c \
- runtime_services/standard_service/psci/api_tests/psci_version/test_psci_version.c \
- runtime_services/standard_service/psci/api_tests/system_off/test_system_off.c \
- runtime_services/standard_service/psci/api_tests/system_suspend/test_psci_system_suspend.c \
- runtime_services/standard_service/psci/api_tests/validate_power_state/test_validate_power_state.c \
- runtime_services/standard_service/psci/system_tests/test_psci_hotplug_stress.c \
- runtime_services/standard_service/psci/system_tests/test_psci_on_off_suspend_stress.c \
- runtime_services/standard_service/psci/system_tests/test_psci_system_suspend_stress.c \
- runtime_services/standard_service/psci/api_tests/mem_protect/test_mem_protect.c \
- runtime_services/standard_service/psci/api_tests/mem_protect_check/mem_protect_check.c \
- runtime_services/standard_service/psci/api_tests/reset2/reset2.c \
- runtime_services/standard_service/query_std_svc.c \
- runtime_services/standard_service/unknown_smc.c \
- runtime_services/standard_service/sdei/system_tests/sdei_entrypoint.S \
- runtime_services/standard_service/sdei/system_tests/test_sdei.c \
- runtime_services/standard_service/sdei/system_tests/test_sdei_state.c \
- runtime_services/trusted_os/tsp/test_irq_preempted_std_smc.c \
- runtime_services/trusted_os/tsp/test_irq_spurious_gicv2.c \
- runtime_services/trusted_os/tsp/test_normal_int_switch.c \
- runtime_services/trusted_os/tsp/test_smc_tsp_std_fn_call.c \
- runtime_services/trusted_os/tsp/test_tsp_fast_smc.c \
-)
-
-TESTS_SOURCES += ${SPM_TESTS_SOURCES} \
- ${FWU_TESTS_SOURCES}
-
-# The following source files are part of the "template" testsuite, which aims
-# at providing template test code as a starting point for developing new tests.
-# They don't do anything useful in terms of testing so they are disabled by
-# default. Uncomment those lines along with the corresponding test suite XML
-# node in the tests/tests.xml file to enable them.
-# TESTS_SOURCES += tftf/tests/template_tests/test_template_single_core.c \
-# tftf/tests/template_tests/test_template_multi_core.c
+# Some source files might be included by several test makefiles.
+# Remove duplicate ones.
+TESTS_SOURCES := $(sort ${TESTS_SOURCES})