summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntonio Nino Diaz <antonio.ninodiaz@arm.com>2017-03-03 15:55:10 +0000
committerAntonio Nino Diaz <antonio.ninodiaz@arm.com>2017-03-03 15:55:10 +0000
commita260b7f36f50c2a2eaabddcb6014df092e074046 (patch)
tree89d941b00096fdfe68c2ba06ef9a2870925876e0
parente61267114875aea57e2614a1c2b9f6f30ab40b71 (diff)
Move helper macros to common header
Modify tests that use them so that they include the new header and they don't have copies of the helpers. Change-Id: I6874138ba984c66948dbf484871e03bf1d7c8154 Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
-rw-r--r--include/common/test_helpers.h24
-rw-r--r--include/lib/tftf_lib.h24
-rw-r--r--tests/framework_validation_tests/test_timer_framework.c1
-rw-r--r--tests/runtime_services/standard_service/psci/api_tests/affinity_info/test_psci_affinity_info.c1
-rw-r--r--tests/runtime_services/standard_service/psci/api_tests/cpu_hotplug/test_psci_hotplug.c1
-rw-r--r--tests/runtime_services/standard_service/psci/api_tests/psci_node_hw_state/test_node_hw_state.c1
-rw-r--r--tests/runtime_services/standard_service/psci/api_tests/psci_stat/test_psci_stat.c1
-rw-r--r--tests/runtime_services/standard_service/psci/api_tests/system_suspend/test_psci_system_suspend.c47
-rw-r--r--tests/runtime_services/standard_service/psci/system_tests/test_psci_hotplug_stress.c1
-rw-r--r--tests/runtime_services/standard_service/psci/system_tests/test_psci_on_off_suspend_stress.c1
-rw-r--r--tests/template_tests/test_template_multi_core.c1
11 files changed, 44 insertions, 59 deletions
diff --git a/include/common/test_helpers.h b/include/common/test_helpers.h
index 6f35482..23f3af0 100644
--- a/include/common/test_helpers.h
+++ b/include/common/test_helpers.h
@@ -34,6 +34,30 @@
#include <psci.h>
#include <tftf_lib.h>
+#define SKIP_TEST_IF_LESS_THAN_N_CLUSTERS(n) \
+ do { \
+ unsigned int clusters_cnt; \
+ clusters_cnt = tftf_get_total_clusters_count(); \
+ if (clusters_cnt < (n)) { \
+ tftf_testcase_printf( \
+ "Need at least %u clusters, only found %u\n", \
+ (n), clusters_cnt); \
+ return TEST_RESULT_SKIPPED; \
+ } \
+ } while (0)
+
+#define SKIP_TEST_IF_LESS_THAN_N_CPUS(n) \
+ do { \
+ unsigned int cpus_cnt; \
+ cpus_cnt = tftf_get_total_cpus_count(); \
+ if (cpus_cnt < (n)) { \
+ tftf_testcase_printf( \
+ "Need at least %u CPUs, only found %u\n", \
+ (n), cpus_cnt); \
+ return TEST_RESULT_SKIPPED; \
+ } \
+ } while (0)
+
/* Helper macro to verify if system suspend API is supported */
#define is_psci_sys_susp_supported() \
(tftf_get_psci_feature_info(SMC_PSCI_SYSTEM_SUSPEND) \
diff --git a/include/lib/tftf_lib.h b/include/lib/tftf_lib.h
index 377e98b..caa92f1 100644
--- a/include/lib/tftf_lib.h
+++ b/include/lib/tftf_lib.h
@@ -194,30 +194,6 @@ int tftf_testcase_printf(const char *format, ...);
typedef unsigned long long UINTN;
-#define SKIP_TEST_IF_LESS_THAN_N_CLUSTERS(n) \
- do { \
- unsigned int clusters_cnt; \
- clusters_cnt = tftf_get_total_clusters_count(); \
- if (clusters_cnt < (n)) { \
- tftf_testcase_printf( \
- "Need at least %u clusters, only found %u\n", \
- (n), clusters_cnt); \
- return TEST_RESULT_SKIPPED; \
- } \
- } while (0)
-
-#define SKIP_TEST_IF_LESS_THAN_N_CPUS(n) \
- do { \
- unsigned int cpus_cnt; \
- cpus_cnt = tftf_get_total_cpus_count(); \
- if (cpus_cnt < (n)) { \
- tftf_testcase_printf( \
- "Need at least %u CPUs, only found %u\n", \
- (n), cpus_cnt); \
- return TEST_RESULT_SKIPPED; \
- } \
- } while (0)
-
/*
* This function is meant to be used by tests.
* It tells the framework that the test is going to reset the platform.
diff --git a/tests/framework_validation_tests/test_timer_framework.c b/tests/framework_validation_tests/test_timer_framework.c
index 94b860d..6115a10 100644
--- a/tests/framework_validation_tests/test_timer_framework.c
+++ b/tests/framework_validation_tests/test_timer_framework.c
@@ -41,6 +41,7 @@
#include <sgi.h>
#include <stdlib.h>
#include <timer.h>
+#include <test_helpers.h>
#include <tftf_lib.h>
static event_t cpu_ready[PLATFORM_CORE_COUNT];
diff --git a/tests/runtime_services/standard_service/psci/api_tests/affinity_info/test_psci_affinity_info.c b/tests/runtime_services/standard_service/psci/api_tests/affinity_info/test_psci_affinity_info.c
index b83cdeb..d9bd17a 100644
--- a/tests/runtime_services/standard_service/psci/api_tests/affinity_info/test_psci_affinity_info.c
+++ b/tests/runtime_services/standard_service/psci/api_tests/affinity_info/test_psci_affinity_info.c
@@ -39,6 +39,7 @@
#include <power_management.h>
#include <psci.h>
#include <sgi.h>
+#include <test_helpers.h>
#include <tftf_lib.h>
/* Special value used to terminate the array of expected return values */
diff --git a/tests/runtime_services/standard_service/psci/api_tests/cpu_hotplug/test_psci_hotplug.c b/tests/runtime_services/standard_service/psci/api_tests/cpu_hotplug/test_psci_hotplug.c
index ce9bd07..3207a38 100644
--- a/tests/runtime_services/standard_service/psci/api_tests/cpu_hotplug/test_psci_hotplug.c
+++ b/tests/runtime_services/standard_service/psci/api_tests/cpu_hotplug/test_psci_hotplug.c
@@ -36,6 +36,7 @@
#include <platform.h>
#include <power_management.h>
#include <psci.h>
+#include <test_helpers.h>
#include <tftf_lib.h>
static event_t cpu_booted[PLATFORM_CORE_COUNT];
diff --git a/tests/runtime_services/standard_service/psci/api_tests/psci_node_hw_state/test_node_hw_state.c b/tests/runtime_services/standard_service/psci/api_tests/psci_node_hw_state/test_node_hw_state.c
index 85ca703..ebf3463 100644
--- a/tests/runtime_services/standard_service/psci/api_tests/psci_node_hw_state/test_node_hw_state.c
+++ b/tests/runtime_services/standard_service/psci/api_tests/psci_node_hw_state/test_node_hw_state.c
@@ -37,6 +37,7 @@
#include <platform_def.h>
#include <power_management.h>
#include <psci.h>
+#include <test_helpers.h>
#include <tftf_lib.h>
/* Invoke _func and verifies return value is TEST_RESULT_SUCCESS */
diff --git a/tests/runtime_services/standard_service/psci/api_tests/psci_stat/test_psci_stat.c b/tests/runtime_services/standard_service/psci/api_tests/psci_stat/test_psci_stat.c
index 5a717b3..5c0294b 100644
--- a/tests/runtime_services/standard_service/psci/api_tests/psci_stat/test_psci_stat.c
+++ b/tests/runtime_services/standard_service/psci/api_tests/psci_stat/test_psci_stat.c
@@ -45,6 +45,7 @@
#include <sgi.h>
#include <spinlock.h>
#include <string.h>
+#include <test_helpers.h>
#include <tftf_lib.h>
#include <timer.h>
diff --git a/tests/runtime_services/standard_service/psci/api_tests/system_suspend/test_psci_system_suspend.c b/tests/runtime_services/standard_service/psci/api_tests/system_suspend/test_psci_system_suspend.c
index ec09e5f..e7190b1 100644
--- a/tests/runtime_services/standard_service/psci/api_tests/system_suspend/test_psci_system_suspend.c
+++ b/tests/runtime_services/standard_service/psci/api_tests/system_suspend/test_psci_system_suspend.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015-2016, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2015-2017, ARM Limited and Contributors. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -42,6 +42,7 @@
#include <power_management.h>
#include <psci.h>
#include <sgi.h>
+#include <test_helpers.h>
#include <tftf.h>
#include <tftf_lib.h>
#include <timer.h>
@@ -51,8 +52,9 @@
#define TEST_ITERATION_COUNT 0x5
/* Helper macro to verify if system suspend API is supported */
-#define is_psci_sys_susp_supported(void) \
- tftf_get_psci_feature_info(SMC_PSCI_SYSTEM_SUSPEND64)
+#define is_psci_sys_susp64_supported() \
+ (tftf_get_psci_feature_info(SMC_PSCI_SYSTEM_SUSPEND64) != \
+ PSCI_E_NOT_SUPPORTED)
static unsigned int deepest_power_state;
static unsigned int test_target_node = PWR_DOMAIN_INIT;
@@ -70,31 +72,6 @@ extern unsigned long __RO_START__;
extern unsigned long __RO_END__;
#define TFTF_RO_END (unsigned long)(&__RO_END__)
-/*
- * Helper function to verify the system state is ready for system
- * suspend. i.e., a single CPU is running and all other CPUs are powered off.
- */
-static int is_sys_suspend_state_ready(void)
-{
- unsigned long current_mpid = read_mpidr_el1() & MPID_MASK;
- unsigned int target_mpid, target_node;
- int aff_info;
-
- for_each_cpu(target_node) {
- target_mpid = tftf_get_mpidr_from_node(target_node);
-
- /* Skip current CPU, as it is powered on */
- if (target_mpid == current_mpid)
- continue;
-
- aff_info = tftf_psci_affinity_info(target_mpid, MPIDR_AFFLVL0);
- if (aff_info != PSCI_STATE_OFF)
- return 0;
- }
-
- return 1;
-}
-
static int suspend_wakeup_handler(void *data)
{
unsigned int core_pos = platform_get_core_pos(read_mpidr_el1());
@@ -198,7 +175,7 @@ test_result_t test_system_suspend_from_all_cores(void)
test_target_node = PWR_DOMAIN_INIT;
my_mpid = read_mpidr_el1() & MPID_MASK;
- if ((is_psci_sys_susp_supported()) == PSCI_E_NOT_SUPPORTED) {
+ if (!is_psci_sys_susp64_supported()) {
tftf_testcase_printf("System suspend is not supported "
"by the EL3 firmware\n");
return TEST_RESULT_SKIPPED;
@@ -317,7 +294,7 @@ test_result_t test_system_suspend_invalid_entrypoint(void)
test_target_node = PWR_DOMAIN_INIT;
my_mpid = read_mpidr_el1() & MPID_MASK;
- if ((is_psci_sys_susp_supported()) == PSCI_E_NOT_SUPPORTED) {
+ if (!is_psci_sys_susp64_supported()) {
tftf_testcase_printf("System suspend is not supported "
"by the EL3 firmware\n");
return TEST_RESULT_SKIPPED;
@@ -410,7 +387,7 @@ test_result_t test_psci_sys_susp_multiple_iteration(void)
int psci_ret;
int timer_ret;
- if ((is_psci_sys_susp_supported()) == PSCI_E_NOT_SUPPORTED) {
+ if (!is_psci_sys_susp64_supported()) {
tftf_testcase_printf("System suspend is not supported "
"by the EL3 firmware\n");
return TEST_RESULT_SKIPPED;
@@ -506,7 +483,7 @@ test_result_t test_psci_sys_susp_pending_irq(void)
int psci_ret;
test_result_t ret = TEST_RESULT_SUCCESS;
- if ((is_psci_sys_susp_supported()) == PSCI_E_NOT_SUPPORTED) {
+ if (!is_psci_sys_susp64_supported()) {
tftf_testcase_printf("System suspend is not supported "
"by the EL3 firmware\n");
return TEST_RESULT_SKIPPED;
@@ -614,7 +591,7 @@ test_result_t test_psci_sys_susp_validate_ram(void)
test_result_t ret = TEST_RESULT_SUCCESS;
- if ((is_psci_sys_susp_supported()) == PSCI_E_NOT_SUPPORTED) {
+ if (!is_psci_sys_susp64_supported()) {
tftf_testcase_printf("System suspend is not supported "
"by the EL3 firmware\n");
return TEST_RESULT_SKIPPED;
@@ -745,7 +722,7 @@ test_result_t test_psci_sys_susp_with_cores_in_suspend(void)
int timer_ret;
test_result_t ret = TEST_RESULT_SUCCESS;
- if ((is_psci_sys_susp_supported()) == PSCI_E_NOT_SUPPORTED) {
+ if (!is_psci_sys_susp64_supported()) {
tftf_testcase_printf("System suspend is not supported "
"by the EL3 firmware\n");
return TEST_RESULT_SKIPPED;
@@ -857,7 +834,7 @@ test_result_t test_psci_sys_susp_with_cores_on(void)
int timer_ret;
test_result_t ret = TEST_RESULT_SUCCESS;
- if ((is_psci_sys_susp_supported()) == PSCI_E_NOT_SUPPORTED) {
+ if (!is_psci_sys_susp64_supported()) {
tftf_testcase_printf("System suspend is not supported "
"by the EL3 firmware\n");
return TEST_RESULT_SKIPPED;
diff --git a/tests/runtime_services/standard_service/psci/system_tests/test_psci_hotplug_stress.c b/tests/runtime_services/standard_service/psci/system_tests/test_psci_hotplug_stress.c
index 007a6f1..8e85f29 100644
--- a/tests/runtime_services/standard_service/psci/system_tests/test_psci_hotplug_stress.c
+++ b/tests/runtime_services/standard_service/psci/system_tests/test_psci_hotplug_stress.c
@@ -37,6 +37,7 @@
#include <platform_def.h>
#include <power_management.h>
#include <psci.h>
+#include <test_helpers.h>
#include <tftf.h>
#include <tftf_lib.h>
diff --git a/tests/runtime_services/standard_service/psci/system_tests/test_psci_on_off_suspend_stress.c b/tests/runtime_services/standard_service/psci/system_tests/test_psci_on_off_suspend_stress.c
index c649d6a..5fa6af8 100644
--- a/tests/runtime_services/standard_service/psci/system_tests/test_psci_on_off_suspend_stress.c
+++ b/tests/runtime_services/standard_service/psci/system_tests/test_psci_on_off_suspend_stress.c
@@ -40,6 +40,7 @@
#include <psci.h>
#include <sgi.h>
#include <stdlib.h>
+#include <test_helpers.h>
#include <tftf.h>
#include <tftf_lib.h>
diff --git a/tests/template_tests/test_template_multi_core.c b/tests/template_tests/test_template_multi_core.c
index 7693c17..43b79f0 100644
--- a/tests/template_tests/test_template_multi_core.c
+++ b/tests/template_tests/test_template_multi_core.c
@@ -34,6 +34,7 @@
#include <platform.h>
#include <power_management.h>
#include <psci.h>
+#include <test_helpers.h>
#include <tftf_lib.h>
static event_t cpu_has_entered_test[PLATFORM_CORE_COUNT];