3#include "acpica_tests/all_tests.h"
21static uint64_t aml_tests_check_object_leak(
void)
31 LOG_ERR(
"memory leak detected, total objects %llu, but root has %llu children\n",
totalObjects, rootChildren);
37static uint64_t aml_tests_acpica_do_test(
const acpica_test_t* test)
39 LOG_INFO(
"running test '%s'\n", test->name);
42 const uint8_t* end = (
const uint8_t*)testAml + testAml->header.length;
55 LOG_ERR(
"test '%s' failed to parse AML\n", test->name);
65 LOG_ERR(
"test '%s' does not contain a valid SETN object\n", test->name);
73 LOG_ERR(
"test '%s' failed to set SETN value\n", test->name);
84 LOG_ERR(
"test '%s' does not contain a valid method\n", test->name);
93 LOG_ERR(
"test '%s' method evaluation failed\n", test->name);
103 LOG_ERR(
"test '%s' method did not return an integer\n", test->name);
113 LOG_INFO(
"test '%s' passed\n", test->name);
117static uint64_t aml_tests_acpica_run_all(
void)
119 for (
int32_t i = 0; i < ACPICA_TEST_COUNT; i++)
121 const acpica_test_t* test = &acpicaTests[i];
122 if (aml_tests_acpica_do_test(test) ==
ERR)
132 if (aml_tests_check_object_leak() ==
ERR)
139 if (aml_tests_acpica_run_all() ==
ERR)
143 LOG_WARN(
"ACPICA tests failed, this is expected until more AML features are implemented\n");
149 LOG_ERR(
"memory leak detected, total objects before test %llu, after test %llu\n", startingObjects,
154 LOG_INFO(
"post parse all tests passed\n");
uint64_t aml_term_list_read(aml_state_t *state, aml_object_t *scope, const uint8_t *start, const uint8_t *end, aml_term_list_ctx_t *parentCtx)
Reads a TermList structure from the AML byte stream.
aml_object_t * aml_method_invoke(aml_state_t *parentState, aml_method_t *method, aml_object_t **args)
Invoke a method with the given arguments.
#define AML_NAME(a, b, c, d)
Macro to create an aml_name_t from 4 characters.
aml_object_t * aml_namespace_get_root(void)
Get the root object of the namespace heirarchy.
aml_object_t * aml_namespace_find(aml_overlay_t *overlay, aml_object_t *start, uint64_t nameCount,...)
Find an object in the namespace heirarchy by name segments.
uint64_t aml_object_count_children(aml_object_t *parent)
Recursively count how many children an object has.
uint64_t aml_object_get_total_count(void)
Get the total amount of allocated ACPI objects.
uint64_t aml_integer_set(aml_object_t *object, aml_uint_t value)
Set a object as an integer with the given value and bit width.
uint64_t aml_state_init(aml_state_t *state, aml_object_t **args)
Initialize an AML state.
void aml_state_deinit(aml_state_t *state)
Deinitialize an AML state.
#define LOG_ERR(format,...)
#define LOG_WARN(format,...)
#define LOG_INFO(format,...)
#define UNREF_DEFER(ptr)
RAII-style cleanup for scoped references.
#define TEST_DEFINE(_name)
Define a test function to be run by TEST_ALL().
#define NULL
Pointer error value.
#define ERR
Integer error value.
static uint64_t totalObjects
aml_overlay_t overlay
Holds any named objects created during parsing.
Secondary System Description Table.