Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 37 additions & 26 deletions tests/uacpi_examples.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ mod test_infra;
use aml_test_tools::{handlers::null_handler::NullHandler};

#[test]
#[ignore] // Fails with ObjectNotOfExpectedType { expected: Reference, got: Integer }
fn expressions_with_package() {
const ASL: &str = r#"
DefinitionBlock("", "DSDT", 1, "RSACPI", "UACPI", 1) {
Expand All @@ -24,7 +23,10 @@ DefinitionBlock("", "DSDT", 1, "RSACPI", "UACPI", 1) {

// ACPICA: AE_SUPPORT, Expressions within package elements are not supported
// Windows, uACPI: Local0 = 50
Local0 = TEST()
Method (MAIN, 0, NotSerialized) {
Local0 = TEST()
Return (Local0 != 50)
}
}
"#;

Expand Down Expand Up @@ -87,54 +89,63 @@ DefinitionBlock("", "DSDT", 1, "RSACPI", "UACPI", 1) {
}

#[test]
#[ignore] // ParseFail(ObjectNotOfExpectedType { expected: Reference, got: Integer })
fn multilevel_references() {
const ASL: &str = r#"
DefinitionBlock("", "DSDT", 1, "RSACPI", "UACPI", 1) {
Local0 = 123
Local1 = RefOf(Local0)
Local2 = RefOf(Local1)
Method(MAIN, 0, NotSerialized) {
Local0 = 123
Local1 = RefOf(Local0)
Local2 = RefOf(Local1)

// ACPICA: Local3 = reference->Local0
// Windows, uACPI: Local3 = 123
Local3 = DerefOf(Local2)
// ACPICA: Local3 = reference->Local0
// Windows, uACPI: Local3 = 123
Local3 = DerefOf(Local2)
Return (Local3 != 123)
}
}"#;

let handler = NullHandler;
test_infra::run_aml_test(ASL, handler);
}

#[test]
#[ignore] // "Stores to objects like WrappedObject(UnsafeCell { .. }) are not yet supported"
fn implicit_case_semantics() {
const ASL: &str = r#"
DefinitionBlock("", "DSDT", 1, "RSACPI", "UACPI", 1) {
Name (TEST, "BAR")
Method(MAIN, 0, NotSerialized) {
Name (TEST, "BAR")

// ACPICA: TEST = "00000000004F4F46"
// Windows, uACPI: TEST = "FOO"
TEST = 0x4F4F46

Return (Test != "FOO")
}

// ACPICA: TEST = "00000000004F4F46"
// Windows, uACPI: TEST = "FOO"
TEST = 0x4F4F46
}"#;

let handler = NullHandler;
test_infra::run_aml_test(ASL, handler);
}

#[test]
#[ignore] // "Stores to objects like WrappedObject(UnsafeCell { .. }) are not yet supported"
// TODO: This test isn't quite right as we match on substrings rather than whole strings
fn buffer_size_mutability() {
const ASL: &str = r#"
DefinitionBlock("", "DSDT", 1, "RSACPI", "UACPI", 1) {
Name (TEST, "XXXX")
Name (VAL, "")

// ACPICA: TEST = "LONGSTRING"
// Windows, UACPI: TEST = "LONG"
TEST = "LONGSTRING"

// ACPICA: VAL = "FOO"
// Windows, UACPI: VAL = ""
VAL = "FOO"
Method(MAIN, 0, NotSerialized) {
Name (TEST, "XXXX")
Name (VAL, "")

// ACPICA: TEST = "LONGSTRING"
// Windows, UACPI: TEST = "LONG"
TEST = "LONGSTRING"

// ACPICA: VAL = "FOO"
// Windows, UACPI: VAL = ""
VAL = "FOO"
Return ((TEST != "LONGSTRING") || (VAL != "FOO"))
}
}"#;

let handler = NullHandler;
Expand Down Expand Up @@ -170,7 +181,7 @@ DefinitionBlock("", "DSDT", 1, "RSACPI", "UACPI", 1) {
}

#[test]
#[ignore] // CopyObject not yet implemented
#[ignore] // See issue #300
fn copy_object_to_self() {
const ASL: &str = r#"
DefinitionBlock("", "DSDT", 1, "RSACPI", "UACPI", 1) {
Expand Down
Loading