Skip to content

Commit

Permalink
tests: Add ACPI test application
Browse files Browse the repository at this point in the history
Add basic ACPI test application. Initially there are only tests for one
ACPI table (MCFG) and fetching the ACPI PRT, but this is already a good
start for caching regressions on the supported boards.

Signed-off-by: Johan Hedberg <[email protected]>
  • Loading branch information
Johan Hedberg authored and fabiobaltieri committed Nov 2, 2023
1 parent 90fec53 commit a77871b
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/lib/acpi/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# SPDX-License-Identifier: Apache-2.0

cmake_minimum_required(VERSION 3.20.0)
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(acpi)

target_sources(app PRIVATE src/main.c)
4 changes: 4 additions & 0 deletions tests/lib/acpi/prj.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
CONFIG_ZTEST=y
CONFIG_ACPI=y
CONFIG_PCIE=y
CONFIG_PCIE_PRT=y
30 changes: 30 additions & 0 deletions tests/lib/acpi/src/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Copyright (c) 2023 Intel Corporation.
*
* SPDX-License-Identifier: Apache-2.0
*/

#include <zephyr/ztest.h>
#include <zephyr/kernel.h>
#include <zephyr/acpi/acpi.h>

ZTEST(acpi, mcfg_table)
{
struct acpi_mcfg *mcfg;

mcfg = acpi_table_get("MCFG", 0);

zassert_not_null(mcfg, "Failed to get MCFG table");
}

ZTEST(acpi, irq_routing_table)
{
static ACPI_PCI_ROUTING_TABLE irq_prt_table[CONFIG_ACPI_MAX_PRT_ENTRY];
int status;

status = acpi_get_irq_routing_table(CONFIG_ACPI_PRT_BUS_NAME,
irq_prt_table, sizeof(irq_prt_table));
zassert_ok(status, "Failed to get PRT");
}

ZTEST_SUITE(acpi, NULL, NULL, NULL, NULL, NULL);
8 changes: 8 additions & 0 deletions tests/lib/acpi/testcase.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
tests:
acpi.basic:
tags:
- acpi
- acpica
integration_platforms:
- qemu_x86_64
depends_on: acpi

0 comments on commit a77871b

Please sign in to comment.