|
| 1 | +mod test_infra; |
| 2 | + |
| 3 | +use crate::test_infra::{evaluate, run_aml_test}; |
| 4 | +use aml_test_tools::handlers::null_handler::NullHandler; |
| 5 | + |
| 6 | +// regression test for 31b3057, ensure ConcatenateRestTemplate does |
| 7 | +// not concatenate end tags |
| 8 | +#[test] |
| 9 | +fn concatenate_res_template_strip_end_tags() { |
| 10 | + const AML: &str = r#" |
| 11 | +DefinitionBlock ("", "SSDT", 1, "LENOVO", "Platform", 0x00001000) { |
| 12 | + Scope (\_SB) { |
| 13 | + Device (TPD0) { |
| 14 | + Name (_ADR, One) |
| 15 | + Name (_CID, "PNP0C50") |
| 16 | + Name (_UID, 0x03) |
| 17 | + Name (_S0W, 0x04) |
| 18 | + Method (_HID, 0, NotSerialized) |
| 19 | + { |
| 20 | + Return ("ELAN0630") |
| 21 | + } |
| 22 | + Name (EIC0, ResourceTemplate () |
| 23 | + { |
| 24 | + I2cSerialBusV2 (0x0015, ControllerInitiated, 0x00061A80, |
| 25 | + AddressingMode7Bit, "", |
| 26 | + 0x00, ResourceConsumer, , Exclusive, |
| 27 | + ) |
| 28 | + }) |
| 29 | + Name (TINT, ResourceTemplate () |
| 30 | + { |
| 31 | + GpioInt (Level, ActiveLow, ExclusiveAndWake, PullDefault, 0x0000, |
| 32 | + "", 0x00, ResourceConsumer, , |
| 33 | + ) |
| 34 | + { // Pin list |
| 35 | + 0x001D |
| 36 | + } |
| 37 | + }) |
| 38 | + Method (_CRS, 0, NotSerialized) |
| 39 | + { |
| 40 | + Return (ConcatenateResTemplate (EIC0, TINT)) |
| 41 | + } |
| 42 | +
|
| 43 | + } |
| 44 | + } |
| 45 | +} |
| 46 | +"#; |
| 47 | + |
| 48 | + let interpreter = run_aml_test(AML, NullHandler {}); |
| 49 | + let crs = evaluate(&interpreter, "\\_SB.TPD0._CRS"); |
| 50 | + let buffer = crs.as_buffer().unwrap(); |
| 51 | + |
| 52 | + assert_eq!(1, buffer.iter().filter(|b| **b == 0x79).count()); |
| 53 | + |
| 54 | + // additional regression test for 9748050 where the end tag value was |
| 55 | + // incorrectly 0x78 vs 0x78|1 |
| 56 | + assert_eq!(0, buffer.iter().filter(|b| **b == 0x78).count()); |
| 57 | +} |
0 commit comments