Skip to content

Add support for running the tests from uACPI.#285

Open
martin-hughes wants to merge 1 commit intorust-osdev:mainfrom
martin-hughes:uacpi-tests
Open

Add support for running the tests from uACPI.#285
martin-hughes wants to merge 1 commit intorust-osdev:mainfrom
martin-hughes:uacpi-tests

Conversation

@martin-hughes
Copy link
Copy Markdown
Contributor

Does what it says on the tin!

There are two parts:

  1. The simplest part: The uACPI README examples are copied into uacpi_examples.rs. Most of these tests currently fail so are marked #[ignore]
  2. The more complex part - support this crate being used as the test-runner for the main uACPI tests.

I've added the uacpi_test_adapter binary - this is quite straightforward, it "adapts" the uACPI runner command line arguments into aml_tester arguments. TBH, "Adapts" is a strong word - it drops and fakes success for some tests that we don't have. I added it as a standalone for the reason given in its documentation - it keeps extraneous argument pollution affecting from aml_tester, and keeps aml_tester fully separate from the uacpi tests.

Running it is fairly straightforward, see the docs for details. Note that

  1. Only 10 or so of the tests pass at present due to missing features / reference handling.
  2. Some will hang due to our lack of timeouts in long running AML scripts.

There are some examples copied directly from the uACPI codebase into the
integration tests.

I believe the attribution at the top of the file should be sufficient to
meet the terms of the MIT licence, since we're not including a
"substantial" part of their codebase.
@martin-hughes
Copy link
Copy Markdown
Contributor Author

I haven't made any attempt to integrate the uACPI tests into the CI pipeline - it feels unnecessary until the tests all pass.

Note that, at present, several of the uACPI tests run indefinitely. You may want to skip these! The easiest way to do so
is probably just to delete them... The relevant tests are:

* `global-lock.asl`
Copy link
Copy Markdown
Member

@IsaacWoods IsaacWoods Apr 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't looked at the arguments we're passed by uACPI's test runner. Is there any way to have a list of these and skip them from uacpi_test_adapter?

Edit: alternatively this may just be an opportunity to fix those issues. Stuff like timeouts on loops is well past overdue.

// TODO: This *is* a memory leak - but a tolerable one for now. The FACS would be 'static in a
// real machine, and we effectively need that here since the crate will never try to release it.
//
// It'd be possible to tidy this up creating a newtype containing both the Interpeter and FACS
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this will ever be a real problem. We could possibly even just make a FACS in a static UnsafeCell and take a pointer to it for each test, since writes to it won't do anything?

return ExitCode::SUCCESS;
}

let Some(tester_path) = env::var_os("AML_TESTER_PATH") else {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy for it to be left like this, but it may be easy enough to extract the path to aml_tester from here since they'll end up in the same target directory?

@IsaacWoods
Copy link
Copy Markdown
Member

Thanks for working on this!

Our performance on these tests is... worse than I'd envisaged. I've started looking at some of the failures today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants