[PATCH 1/2] acpi/method: add tests for _ALx method
Alex Hung
alex.hung at canonical.com
Tue May 5 00:19:32 UTC 2020
Signed-off-by: Alex Hung <alex.hung at canonical.com>
---
src/acpi/method/method.c | 17 ++++++++++++++++-
src/lib/include/fwts_acpi_object_eval.h | 1 +
src/lib/src/fwts_acpi_object_eval.c | 23 +++++++++++++++++++++++
3 files changed, 40 insertions(+), 1 deletion(-)
diff --git a/src/acpi/method/method.c b/src/acpi/method/method.c
index ecdb65d4..b166fb73 100644
--- a/src/acpi/method/method.c
+++ b/src/acpi/method/method.c
@@ -5297,6 +5297,21 @@ static int method_test_ACx(fwts_framework *fw)
return FWTS_OK;
}
+static int method_test_ALx(fwts_framework *fw)
+{
+ int i;
+
+ for (i = 0; i < 10; i++) {
+ char buffer[6];
+
+ snprintf(buffer, sizeof(buffer), "_AL%1d", i);
+ method_evaluate_method(fw, METHOD_OPTIONAL,
+ buffer, NULL, 0, fwts_method_test_all_reference_package_return, buffer);
+ fwts_log_nl(fw);
+ }
+ return FWTS_OK;
+}
+
static int method_test_DTI(fwts_framework *fw)
{
ACPI_OBJECT arg[1];
@@ -6283,7 +6298,7 @@ static fwts_framework_minor_test method_tests[] = {
{ method_test_ACx, "Test _ACx (Active Cooling)." },
{ method_test_ART, "Test _ART (Active Cooling Relationship Table)." },
- /* { method_test_ALx, "Test _ALx (Active List)". }, */
+ { method_test_ALx, "Test _ALx (Active List)." },
{ method_test_CRT, "Test _CRT (Critical Trip Point)." },
{ method_test_CR3, "Test _CR3 (Warm/Standby Temperature)." },
{ method_test_DTI, "Test _DTI (Device Temperature Indication)." },
diff --git a/src/lib/include/fwts_acpi_object_eval.h b/src/lib/include/fwts_acpi_object_eval.h
index d8ac7e7f..8922b154 100644
--- a/src/lib/include/fwts_acpi_object_eval.h
+++ b/src/lib/include/fwts_acpi_object_eval.h
@@ -125,6 +125,7 @@ void fwts_method_test_string_return(fwts_framework *fw, char *name, ACPI_BUFFER
void fwts_method_test_reference_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
void fwts_method_test_NULL_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
void fwts_method_test_buffer_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj,void *private);
+void fwts_method_test_all_reference_package_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
void fwts_method_test_passed_failed_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
void fwts_method_test_polling_return( fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private);
diff --git a/src/lib/src/fwts_acpi_object_eval.c b/src/lib/src/fwts_acpi_object_eval.c
index 3845d424..b78ca3af 100644
--- a/src/lib/src/fwts_acpi_object_eval.c
+++ b/src/lib/src/fwts_acpi_object_eval.c
@@ -801,6 +801,29 @@ void fwts_method_test_buffer_return(
name, obj->Buffer.Length);
}
+/*
+ * fwts_method_test_all_reference_package_return
+ * check if all elements are references in a package
+ */
+void fwts_method_test_all_reference_package_return(
+ fwts_framework *fw,
+ char *name,
+ ACPI_BUFFER *buf,
+ ACPI_OBJECT *obj,
+ void *private)
+{
+ char *objname = (char *)private;
+
+ if (fwts_method_check_type(fw, name, buf, ACPI_TYPE_PACKAGE) != FWTS_OK)
+ return;
+
+ if (fwts_method_package_elements_all_type(fw, name, objname, obj, ACPI_TYPE_LOCAL_REFERENCE) != FWTS_OK)
+ return;
+
+ fwts_passed(fw, "%s returned a sane package of %" PRIu32 " references.", name, obj->Package.Count);
+}
+
+
/*
* fwts_method_test_passed_failed_return
* check if 0 or 1 (false/true) integer is returned
--
2.25.1
More information about the fwts-devel
mailing list