Start adding in CI tests with some basic smoke tests

Signed-off-by: Al Stone <ahs3@redhat.com>
This commit is contained in:
Al Stone 2018-08-08 09:20:02 -06:00
parent 771dd9065c
commit 69fdad5b24
26 changed files with 23733 additions and 0 deletions

2
tests/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
tests.retry
artifacts

3
tests/badcode/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
badcode.aml
badcode.asl.actual
badcode.asl.expected

3
tests/badcode/PURPOSE Normal file
View File

@ -0,0 +1,3 @@
PURPOSE of tests/badcode
Description: sanity check that iasl is handling bad ASL properly
Author: Al Stone <ahs3@redhat.com>

406
tests/badcode/badcode.asl Normal file
View File

@ -0,0 +1,406 @@
/*
* badcode.asl
*
* This file contains examples of the extended error checking and
* typechecking capabilities of the iASL compiler. Other ASL compilers
* may ignore these errors completely. Note - this is not an exhaustive
* list of errors detected by iASL, it shows many of the errors that
* are not detected by other ASL compilers.
*
* To compile, use:
* iasl badcode.asl
*
* Output:
* Compilation complete. 45 Errors, 22 Warnings, 3 Remarks, 16 Optimizations
*
*/
DefinitionBlock ("badcode.aml", "DSDT", 1, "Intel", "Example", 0x00000001)
{
Name (INT1, 0)
Name (BUF1, Buffer() {0,1,2,3})
Event (EVT1)
// Invalid SyncLevel in Mutex declaration
Mutex (MTX1, 32)
// Integer beyond the table integer size (32 bits)
Name (BIG, 0x1234567887654321)
// CPackage length does not match initializer list length
Name (PKG1, Package(5) {0,1})
// Inadvertent use of single backslash in a string
Name (PATH, Buffer() {"\_SB_.PCI2._CRS"})
// Invalid hex escape sequence
Name (ESC1, "abcdefg\x00hijklmn")
// Field access beyond region bounds
OperationRegion (OPR1, SystemMemory, 0x2000, 6)
Field (OPR1, DWordAcc, NoLock, Preserve)
{
Offset (4),
FLD1, 8
}
// Some address spaces support only ByteAcc or BufferAcc
OperationRegion (OPR2, EmbeddedControl, 0x4000, 8)
Field (OPR2, DWordAcc, NoLock, Preserve)
{
FLD2, 8
}
OperationRegion (OPR3, SMBus, 0x8000, 16)
Field (OPR3, WordAcc, NoLock, Preserve)
{
FLD3, 8
}
// Invalid SyncLevel in method declaration
Method (MTH1, 0, NotSerialized, 32)
{
// Invalid arguments and uninitialized locals
Store (Arg3, Local0)
Store (Local1, Local2)
// Parameter typechecking (MTX1 is invalid type)
Subtract (MTX1, 4, Local3)
// Various invalid parameters
CreateField (BUF1, 0, Subtract (4, 4), FLD1)
// Unchecked mutex and event timeouts
Acquire (MTX1, 100)
Wait (EVT1, 1)
// Result from operation is not used - statement has no effect
Add (INT1, 8)
// Unreachable code
Return (0)
Store (5, INT1)
}
Method (MTH2)
{
// Switch with no Case statements
Switch (ToInteger (INT1))
{
Default
{
}
}
if (LEqual (INT1, 0))
{
Return (INT1)
}
// Fallthrough exit path does not return a value
}
Method (MTH3)
{
// Method MTH2 above does not always return a value
Store (MTH2 (), Local0)
}
// Method MTH4 does not explicitly return a value
Method (MTH4) {}
Method (MTH5) {Store (MTH4(), Local0)}
// Invalid _HID values
Device (H1)
{
Name (_HID, "*PNP0C0A") // Illegal leading asterisk
}
Device (H2)
{
Name (_HID, "PNP") // Too short, must be 7 or 8 chars
}
Device (H3)
{
Name (_HID, "MYDEVICE01") // Too long, must be 7 or 8 chars
}
Device (H4)
{
Name (_HID, "acpi0001") // non-hex chars must be uppercase
}
Device (H5)
{
Name (_HID, "PNP-123") // HID must be alphanumeric
}
Device (H6)
{
Name (_HID, "") // Illegal Null HID
Name (_CID, "") // Illegal Null CID
}
// Predefined Name typechecking
Name (_PRW, 4)
Name (_FDI, Buffer () {0})
// Predefined Name argument count validation
// and return value validation
Method (_OSC, 5)
{
}
// Predefined Names that must be implemented as control methods
Name (_L01, 1)
Name (_E02, 2)
Name (_Q03, 3)
Name (_ON, 0)
Name (_INI, 1)
Name (_PTP, 2)
// GPE methods that cause type collision (L vs. E)
Scope (\_GPE)
{
Method (_L1D)
{
}
Method (_E1D)
{
}
}
// Predefined names that should not have a return value
Method (_FDM, 1)
{
Return (Buffer(1){0x33})
}
Method (_Q22)
{
Return ("Unexpected Return Value")
}
// _REG must have a corresponding Operation Region declaration
// within the same scope
Device (EC)
{
Method (_REG, 2)
{
}
}
/*
* Resource Descriptor error checking
*/
Name (RSC1, ResourceTemplate ()
{
// Illegal nested StartDependent macros
StartDependentFn (0, 0)
{
StartDependentFn (0, 0)
{
}
}
// Missing EndDependentFn macro
})
Name (RSC2, ResourceTemplate ()
{
// AddressMin is larger than AddressMax
IO (Decode16,
0x07D0, // Range Minimum
0x03E8, // Range Maximum
0x01, // Alignment
0x20, // Length
)
// Length larger than Min/Max window size
Memory32 (ReadOnly,
0x00001000, // Range Minimum
0x00002000, // Range Maximum
0x00000004, // Alignment
0x00002000, // Length
)
// Min and Max not multiples of alignment value
Memory32 (ReadOnly,
0x00001001, // Range Minimum
0x00002002, // Range Maximum
0x00000004, // Alignment
0x00000200, // Length
)
// 10-bit ISA I/O address has a max of 0x3FF
FixedIO (
0xFFFF, // Address
0x20, // Length
)
// Invalid AccessSize parameter
Register (SystemIO,
0x08, // Bit Width
0x00, // Bit Offset
0x0000000000000100, // Address
0x05 // Access Size
)
// Invalid ResourceType (0xB0)
QWordSpace (0xB0, ResourceConsumer, PosDecode, MinFixed, MaxFixed, 0xA5,
0x0000, // Granularity
0xA000, // Range Minimum
0xBFFF, // Range Maximum
0x0000, // Translation Offset
0x2000, // Length
,, )
// AddressMin is larger than AddressMax
WordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,
0x0000, // Granularity
0x0200, // Range Minimum
0x0100, // Range Maximum
0x0000, // Translation Offset
0x0100, // Length
,, , TypeStatic)
// Length larger than Min/Max window size
DWordSpace (0xC3, ResourceConsumer, PosDecode, MinFixed, MaxFixed, 0xA5,
0x00000000, // Granularity
0x000C8000, // Range Minimum
0x000C9000, // Range Maximum
0x00000000, // Translation Offset
0x00001002, // Length
,, )
// Granularity must be (power-of-two -1)
DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxNotFixed, NonCacheable, ReadWrite,
0x00000010,
0x40000000,
0xFED9FFFF,
0x00000000,
0xBECA0000)
// Address Min (with zero length) not on granularity boundary
QWordIO (ResourceProducer, MinFixed, MaxNotFixed, PosDecode, EntireRange,
0x0000000000000003, // Granularity
0x0000000000000B02, // Range Minimum
0x0000000000000C00, // Range Maximum
0x0000000000000000, // Translation Offset
0x0000000000000000, // Length
,, , TypeStatic)
// Address Max (with zero length) not on (granularity boundary -1)
QWordMemory (ResourceProducer, PosDecode, MinNotFixed, MaxFixed, Cacheable, ReadWrite,
0x0000000000000001, // Granularity
0x0000000000100000, // Range Minimum
0x00000000002FFFFE, // Range Maximum
0x0000000000000000, // Translation Offset
0x0000000000000000, // Length
,, , AddressRangeMemory, TypeStatic)
// Invalid combination: zero length, both Min and Max are fixed
DWordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,
0x00000000, // Granularity
0x000C8000, // Range Minimum
0x000C8FFF, // Range Maximum
0x00000000, // Translation Offset
0x00000000, // Length
,, )
// Invalid combination: non-zero length, Min Fixed, Max not fixed
DWordIO (ResourceProducer, MinFixed, MaxNotFixed, PosDecode, EntireRange,
0x00000001, // Granularity
0x000C8000, // Range Minimum
0x000C8FFF, // Range Maximum
0x00000000, // Translation Offset
0x00000100, // Length
,, )
// Invalid combination: non-zero length, Min not Fixed, Max fixed
DWordIO (ResourceProducer, MinNotFixed, MaxFixed, PosDecode, EntireRange,
0x00000001, // Granularity
0x000C8000, // Range Minimum
0x000C8FFF, // Range Maximum
0x00000000, // Translation Offset
0x00000200, // Length
,, )
// Granularity must be zero if non-zero length, min/max fixed
DWordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,
0x0000000F, // Granularity
0x000C8000, // Range Minimum
0x000C8FFF, // Range Maximum
0x00000000, // Translation Offset
0x00001000, // Length
,, )
// Null descriptor (intended to be modified at runtime) must
// have a resource tag (to allow it to be modified at runtime)
DWordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,
0x00000000, // Granularity
0x00000000, // Range Minimum
0x00000000, // Range Maximum
0x00000000, // Translation Offset
0x00000000, // Length
,, )
// Missing StartDependentFn macro
EndDependentFn ()
})
// Test descriptor for CreateXxxxField operators in REM1 below
Name (RSC3, ResourceTemplate ()
{
DWordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,
0x00000000, // Granularity
0x000C8000, // Range Minimum
0x000C8FFF, // Range Maximum
0x00000000, // Translation Offset
0x00001000, // Length
,, DWI1)
})
Method (REM1)
{
// Tagged resource field larger than field being created
CreateWordField (RSC3, \DWI1._LEN, LEN)
CreateByteField (RSC3, \DWI1._MIN, MIN)
CreateBitField (RSC3, \DWI1._RNG, RNG1)
// Tagged resource field smaller than field being created
CreateQWordField (RSC3, \DWI1._MAX, MAX)
CreateBitField (RSC3, \DWI1._GRA, GRA)
CreateField (RSC3, \DWI1._MIF, 5, MIF)
CreateField (RSC3, \DWI1._RNG, 3, RNG2)
}
Method (L100)
{
/* Method Local is set but never used */
Store (40, Local0)
}
}

View File

@ -0,0 +1,266 @@
badcode.asl 25: Mutex (MTX1, 32)
Error 6125 - ^ SyncLevel must be in the range 0-15
badcode.asl 29: Name (BIG, 0x1234567887654321)
Warning 3038 - ^ Truncating 64-bit constant found in 32-bit table
badcode.asl 33: Name (PKG1, Package(5) {0,1})
Remark 2063 - ^ Initializer list shorter than declared package length
badcode.asl 37: Name (PATH, Buffer() {"\_SB_.PCI2._CRS"})
Warning 3046 - ^ Invalid or unknown escape sequence
badcode.asl 41: Name (ESC1, "abcdefg\x00hijklmn")
Warning 3055 - ^ Invalid Hex/Octal Escape - Non-ASCII or NULL
badcode.asl 49: FLD1, 8
Error 6030 - ^ Access width of Field Unit extends beyond region limit
badcode.asl 55: Field (OPR2, DWordAcc, NoLock, Preserve)
Error 6100 - ^ Host Operation Region requires ByteAcc access
badcode.asl 60: Field (OPR3, WordAcc, NoLock, Preserve)
Error 6099 - ^ Host Operation Region requires BufferAcc access
badcode.asl 67: Method (MTH1, 0, NotSerialized, 32)
Error 6125 - SyncLevel must be in the range 0-15 ^
badcode.asl 71: Store (Arg3, Local0)
Warning 3144 - ^ Method Local is set but never used (Local0)
badcode.asl 71: Store (Arg3, Local0)
Error 6006 - ^ Method argument is not initialized (Arg3)
badcode.asl 71: Store (Arg3, Local0)
Remark 2087 - ^ Not a parameter, used as local only (Arg3)
badcode.asl 72: Store (Local1, Local2)
Warning 3144 - ^ Method Local is set but never used (Local2)
badcode.asl 72: Store (Local1, Local2)
Error 6066 - ^ Method local variable is not initialized (Local1)
badcode.asl 76: Subtract (MTX1, 4, Local3)
Warning 3144 - Method Local is set but never used ^ (Local3)
badcode.asl 76: Subtract (MTX1, 4, Local3)
Error 6058 - Invalid type ^ ([Mutex] found, Subtract operator requires [Integer|String|Buffer])
badcode.asl 80: CreateField (BUF1, 0, Subtract (4, 4), FLD1)
Remark 2089 - Object is not referenced ^ (Name [FLD1] is within a method [MTH1])
badcode.asl 80: CreateField (BUF1, 0, Subtract (4, 4), FLD1)
Error 6083 - Operand evaluates to zero ^
badcode.asl 84: Acquire (MTX1, 100)
Warning 3130 - ^ Result is not used, possible operator timeout will be missed
badcode.asl 85: Wait (EVT1, 1)
Warning 3130 - ^ Result is not used, possible operator timeout will be missed
badcode.asl 89: Add (INT1, 8)
Error 6114 - ^ Result is not used, operator has no effect
badcode.asl 94: Store (5, INT1)
Warning 3134 - ^ Statement is unreachable
badcode.asl 97: Method (MTH2)
Remark 2119 - ^ Control Method marked Serialized (Due to use of Switch operator)
badcode.asl 97: Method (MTH2)
Warning 3115 - ^ Not all control paths return a value (MTH2)
badcode.asl 101: Switch (ToInteger (INT1))
Error 6078 - ^ No Case statements under Switch
badcode.asl 120: Store (MTH2 (), Local0)
Warning 3144 - ^ Method Local is set but never used (Local0)
badcode.asl 120: Store (MTH2 (), Local0)
Warning 3122 - ^ Called method may not always return a value
badcode.asl 126: Method (MTH5) {Store (MTH4(), Local0)}
Warning 3144 - Method Local is set but never used ^ (Local0)
badcode.asl 126: Method (MTH5) {Store (MTH4(), Local0)}
Error 6080 - Called method returns no value ^
badcode.asl 132: Name (_HID, "*PNP0C0A") // Illegal leading asterisk
Error 6061 - Invalid leading asterisk ^ (*PNP0C0A)
badcode.asl 136: Name (_HID, "PNP") // Too short, must be 7 or 8 chars
Error 6033 - ^ _HID string must be exactly 7 or 8 characters (PNP)
badcode.asl 140: Name (_HID, "MYDEVICE01") // Too long, must be 7 or 8 chars
Error 6033 - ^ _HID string must be exactly 7 or 8 characters (MYDEVICE01)
badcode.asl 144: Name (_HID, "acpi0001") // non-hex chars must be uppercase
Error 6034 - ^ _HID prefix must be all uppercase or decimal digits (acpi0001)
badcode.asl 148: Name (_HID, "PNP-123") // HID must be alphanumeric
Error 6002 - ^ String must be entirely alphanumeric (PNP-123)
badcode.asl 152: Name (_HID, "") // Illegal Null HID
Error 6091 - ^ Invalid zero-length (null) string
badcode.asl 153: Name (_CID, "") // Illegal Null CID
Error 6091 - ^ Invalid zero-length (null) string
badcode.asl 158: Name (_PRW, 4)
Error 6105 - ^ Invalid object type for reserved name (_PRW: found Integer, Package required)
badcode.asl 159: Name (_FDI, Buffer () {0})
Error 6105 - ^ Invalid object type for reserved name (_FDI: found Buffer, Package required)
badcode.asl 164: Method (_OSC, 5)
Warning 3101 - ^ Reserved method has too many arguments (_OSC requires 4)
badcode.asl 164: Method (_OSC, 5)
Warning 3107 - ^ Reserved method must return a value (Buffer required for _OSC)
badcode.asl 170: Name (_L01, 1)
Error 6103 - ^ Reserved name must be a control method (with zero arguments)
badcode.asl 171: Name (_E02, 2)
Error 6103 - ^ Reserved name must be a control method (with zero arguments)
badcode.asl 172: Name (_Q03, 3)
Error 6103 - ^ Reserved name must be a control method (with zero arguments)
badcode.asl 173: Name (_ON, 0)
Error 6103 - ^ Reserved name must be a control method (with zero arguments)
badcode.asl 174: Name (_INI, 1)
Error 6103 - ^ Reserved name must be a control method (with zero arguments)
badcode.asl 175: Name (_PTP, 2)
Error 6103 - ^ Reserved name must be a control method (with arguments)
badcode.asl 184: Method (_E1D)
Error 6032 - ^ Name conflicts with a previous GPE method (_L1D)
badcode.asl 193: Return (Buffer(1){0x33})
Warning 3104 - ^ Reserved method should not return a value (_FDM)
badcode.asl 197: Return ("Unexpected Return Value")
Warning 3104 - Reserved method should not return a value ^ (_Q22)
badcode.asl 203: Device (EC)
Warning 3141 - ^ Missing dependency (Device object requires a _HID or _ADR in same scope)
badcode.asl 205: Method (_REG, 2)
Warning 3079 - ^ _REG has no corresponding Operation Region
badcode.asl 219: StartDependentFn (0, 0)
Error 6019 - ^ Dependent function macros cannot be nested
badcode.asl 225: })
Error 6070 - ^ Missing EndDependentFn() macro in dependent resource list
badcode.asl 242: 0x00002000, // Length
Error 6049 - ^ Length is larger than Min/Max window
badcode.asl 247: 0x00001001, // Range Minimum
Error 6001 - ^ Must be a multiple of alignment/granularity value
badcode.asl 248: 0x00002002, // Range Maximum
Error 6001 - ^ Must be a multiple of alignment/granularity value
badcode.asl 255: 0xFFFF, // Address
Warning 3060 - ^ Maximum 10-bit ISA address (0x3FF)
badcode.asl 264: 0x05 // Access Size
Error 6042 - ^ Invalid AccessSize (Maximum is 4 - QWord access)
badcode.asl 268: QWordSpace (0xB0, ResourceConsumer, PosDecode, MinFixed, MaxFixed, 0xA5,
Error 6139 - Constant out of range ^ (0xB0, allowable: 0xC0-0xFF)
badcode.asl 279: 0x0200, // Range Minimum
Error 6051 - ^ Address Min is greater than Address Max
badcode.asl 291: 0x00001002, // Length
Error 6049 - ^ Length is larger than Min/Max window
badcode.asl 296: 0x00000010,
Error 6048 - ^ Granularity must be zero or a power of two minus one
badcode.asl 305: 0x0000000000000B02, // Range Minimum
Error 6001 - ^ Must be a multiple of alignment/granularity value
badcode.asl 315: 0x00000000002FFFFE, // Range Maximum
Error 6001 - ^ Must be a multiple of alignment/granularity value (-1)
badcode.asl 326: 0x00000000, // Length
Error 6043 - ^ Invalid combination of Length and Min/Max fixed flags
badcode.asl 335: 0x00000100, // Length
Error 6043 - ^ Invalid combination of Length and Min/Max fixed flags
badcode.asl 344: 0x00000200, // Length
Error 6043 - ^ Invalid combination of Length and Min/Max fixed flags
badcode.asl 349: 0x0000000F, // Granularity
Error 6047 - ^ Granularity must be zero for fixed Min/Max
badcode.asl 358: DWordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,
Error 6090 - ^ Min/Max/Length/Gran are all zero, but no resource tag
badcode.asl 368: EndDependentFn ()
Error 6071 - ^ Missing StartDependentFn() macro in dependent resource list
badcode.asl 388: CreateWordField (RSC3, \DWI1._LEN, LEN)
Warning 3128 - ResourceTag larger than Field ^ (Size mismatch, Tag: 32 bits, Field: 16 bits)
badcode.asl 388: CreateWordField (RSC3, \DWI1._LEN, LEN)
Remark 2089 - Object is not referenced ^ (Name [LEN_] is within a method [REM1])
badcode.asl 389: CreateByteField (RSC3, \DWI1._MIN, MIN)
Warning 3128 - ResourceTag larger than Field ^ (Size mismatch, Tag: 32 bits, Field: 8 bits)
badcode.asl 389: CreateByteField (RSC3, \DWI1._MIN, MIN)
Remark 2089 - Object is not referenced ^ (Name [MIN_] is within a method [REM1])
badcode.asl 390: CreateBitField (RSC3, \DWI1._RNG, RNG1)
Warning 3128 - ResourceTag larger than Field ^ (Size mismatch, Tag: 2 bits, Field: 1 bit)
badcode.asl 390: CreateBitField (RSC3, \DWI1._RNG, RNG1)
Remark 2089 - Object is not referenced ^ (Name [RNG1] is within a method [REM1])
badcode.asl 394: CreateQWordField (RSC3, \DWI1._MAX, MAX)
Warning 3129 - ResourceTag smaller than Field ^ (Size mismatch, Tag: 32 bits, Field: 64 bits)
badcode.asl 394: CreateQWordField (RSC3, \DWI1._MAX, MAX)
Remark 2089 - Object is not referenced ^ (Name [MAX_] is within a method [REM1])
badcode.asl 395: CreateBitField (RSC3, \DWI1._GRA, GRA)
Warning 3128 - ResourceTag larger than Field ^ (Size mismatch, Tag: 32 bits, Field: 1 bit)
badcode.asl 395: CreateBitField (RSC3, \DWI1._GRA, GRA)
Remark 2089 - Object is not referenced ^ (Name [GRA_] is within a method [REM1])
badcode.asl 396: CreateField (RSC3, \DWI1._MIF, 5, MIF)
Warning 3129 - ResourceTag smaller than Field ^ (Size mismatch, Tag: 1 bit, Field: 5 bits)
badcode.asl 396: CreateField (RSC3, \DWI1._MIF, 5, MIF)
Remark 2089 - Object is not referenced ^ (Name [MIF_] is within a method [REM1])
badcode.asl 397: CreateField (RSC3, \DWI1._RNG, 3, RNG2)
Warning 3129 - ResourceTag smaller than Field ^ (Size mismatch, Tag: 2 bits, Field: 3 bits)
badcode.asl 397: CreateField (RSC3, \DWI1._RNG, 3, RNG2)
Remark 2089 - Object is not referenced ^ (Name [RNG2] is within a method [REM1])
badcode.asl 404: Store (40, Local0)
Warning 3144 - ^ Method Local is set but never used (Local0)
Intel ACPI Component Architecture
ASL+ Optimizing Compiler/Disassembler version VVVVVVVV
Copyright (c) 2000 - 2018 Intel Corporation
Ignoring all errors, forcing AML file generation
ASL Input: badcode.asl - 408 lines, 11587 bytes, 81 keywords
AML Output: badcode.aml - 1195 bytes, 61 named objects, 20 executable opcodes
Compilation complete. 46 Errors, 28 Warnings, 11 Remarks, 16 Optimizations, 1 Constants Folded

35
tests/badcode/runtest.sh Executable file
View File

@ -0,0 +1,35 @@
#!/bin/bash
#
# run the misc tests: we need to do this in a script since
# these are expected to fail which would normally cause %check
# to stop. however, this is expected behavior. we are running
# iasl precisely because we expect it to stop when presented with
# faulty ASL.
#
# this script assumes it is in the source 'tests' directory at
# start.
#
PWD=$(pwd)
BINDIR="/usr/bin"
VERSION=$($BINDIR/iasl -v | grep Optimizing | cut -d" " -f5)
# create file to compare against
pushd ./badcode > /dev/null
sed -e "s/VVVVVVVV/$VERSION/" \
badcode.asl.result > badcode.asl.expected
# see if badcode.asl failed as expected
# NB: the -f option is required so we can see all of the errors
$BINDIR/iasl -f badcode.asl > badcode.asl.actual 2>&1
diff badcode.asl.actual badcode.asl.expected >/dev/null 2>&1
RET=$?
popd > /dev/null
if [ $RET -eq 0 ]
then
echo PASS badcode
else
echo FAIL badcode
fi
exit $RET

3
tests/converterSample/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
converterSample.aml
converterSample.asl.actual
converterSample.asl.expected

View File

@ -0,0 +1,3 @@
PURPOSE of tests/converterSample
Description: sanity check that iasl is handling ASL converters properly
Author: Al Stone <ahs3@redhat.com>

View File

@ -0,0 +1,83 @@
/*
* top of the
* definition block
*/
DefinitionBlock(
"converterSample.aml", /* These comments */
"DSDT", /* within the */
0x02, /* definition block header */
"Intel", /* are not retained. */
"Many", /* They will be */
0x00000001 /* Discarded */)
{
/* first comment of named object b */
Name (b, 5)
Name(p008, Package()
{
0, 0,
0, 0xffffffff,
0x00012345, 0x00007abc,
0x00000012, 0x00000034,
0x00000001, 0x000000ff,
0x00000001, 0x0000ffff,
0x00000001, 0xffffffff,
// bit-size of multiplicand
0x67812345, 2,
// bit-size of multiplier
3, 0x45678123,
0xffffffff, 0xffffffff,
// ACPI: Overflow conditions are ignored and results are undefined.
})
Method(MAIN) {
/**********************************************************************
* *
* This is a long *
* multi-line *
* comment *
* *
**********************************************************************/
//c12
if(1==1)//c13
{ //c14
Name(b,0);
} //c15
}
//c16
Name (a,
Package(3)
{/*c20*/
0x04, /*c21*/
/*c22*/
0x05, /*c23*/
0x06 /*c24*/
}/*c25*/
)/*c26*/
//c34
Method(SCOP)
{
//c35
Name (a1, 0x04)
}
OperationRegion(GNVS,SystemMemory,0xFFFF0000,0xAA55)
Field(GNVS,AnyAcc,Lock,Preserve)
{
//c36
Offset(0),//c37
OSYS, 8//c38
}
} //c39
/*ending
comment*/

View File

@ -0,0 +1,21 @@
converterSample.asl 37: Method(MAIN) {
Remark 2120 - ^ Control Method should be made Serialized (due to creation of named objects within)
converterSample.asl 48: Name(b,0);
Remark 2089 - Object is not referenced ^ (Name [B___] is within a method [MAIN])
converterSample.asl 65: Method(SCOP)
Remark 2120 - ^ Control Method should be made Serialized (due to creation of named objects within)
converterSample.asl 68: Name (a1, 0x04)
Remark 2089 - Object is not referenced ^ (Name [A1__] is within a method [SCOP])
Intel ACPI Component Architecture
ASL+ Optimizing Compiler/Disassembler version VVVVVVVV
Copyright (c) 2000 - 2018 Intel Corporation
ASL Input: converterSample.asl - 85 lines, 1968 bytes, 11 keywords
AML Output: converterSample.aml - 180 bytes, 9 named objects, 2 executable opcodes
Compilation complete. 0 Errors, 0 Warnings, 4 Remarks, 11 Optimizations, 1 Constants Folded

View File

@ -0,0 +1,34 @@
#!/bin/bash
#
# run the misc tests: we need to do this in a script since
# these are expected to fail which would normally cause %check
# to stop. however, this is expected behavior. we are running
# iasl precisely because we expect it to stop when presented with
# faulty ASL.
#
# this script assumes it is in the source 'tests' directory at
# start.
#
PWD=$(pwd)
BINDIR="/usr/bin"
VERSION=$($BINDIR/iasl -v | grep Optimizing | cut -d" " -f5)
# create file to compare against
pushd ./converterSample > /dev/null
sed -e "s/VVVVVVVV/$VERSION/" \
converterSample.asl.result > converterSample.asl.expected
# see if converterSample.asl compiles as expected
$BINDIR/iasl converterSample.asl > converterSample.asl.actual 2>&1
diff converterSample.asl.actual converterSample.asl.expected >/dev/null 2>&1
RET=$?
popd > /dev/null
if [ $RET -eq 0 ]
then
echo PASS converterSample
else
echo FAIL converterSample
fi
exit $RET

3
tests/grammar/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
grammar.aml
grammar.asl.actual
grammar.asl.expected

3
tests/grammar/PURPOSE Normal file
View File

@ -0,0 +1,3 @@
PURPOSE of tests/grammar
Description: sanity check that iasl is handling ASL grammar properly
Author: Al Stone <ahs3@redhat.com>

10282
tests/grammar/grammar.asl Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,374 @@
grammar.asl 120: Device (A1)
Warning 3141 - ^ Missing dependency (Device object requires a _HID or _ADR in same scope)
grammar.asl 135: Device (A2)
Warning 3141 - ^ Missing dependency (Device object requires a _HID or _ADR in same scope)
grammar.asl 145: Device (A3)
Warning 3141 - ^ Missing dependency (Device object requires a _HID or _ADR in same scope)
grammar.asl 155: Device (A4)
Warning 3141 - ^ Missing dependency (Device object requires a _HID or _ADR in same scope)
grammar.asl 171: Device (IRES)
Warning 3141 - ^ Missing dependency (Device object requires a _HID or _ADR in same scope)
grammar.asl 199: Name (_NPK, Package ()
Warning 3133 - ^ Unknown reserved name (_NPK)
grammar.asl 208: Device (RES)
Warning 3141 - ^ Missing dependency (Device object requires a _HID or _ADR in same scope)
grammar.asl 399: CreateByteField (PRT0, R000._ASZ, RSIZ)
Remark 2089 - Object is not referenced ^ (Name [RSIZ] is within a method [_CRS])
grammar.asl 513: Name (_STR, Unicode ("test"))
Remark 2089 - ^ Object is not referenced (Name [_STR] is within a method [TCOP])
grammar.asl 515: Store (MFLD, Local0)
Warning 3144 - ^ Method Local is set but never used (Local0)
grammar.asl 522: NAME (ESC1, "abcdefg\x00hijklmn")
Warning 3055 - ^ Invalid Hex/Octal Escape - Non-ASCII or NULL
grammar.asl 523: NAME (ESC2, "abcdefg\000hijklmn")
Warning 3055 - ^ Invalid Hex/Octal Escape - Non-ASCII or NULL
grammar.asl 620: RCIV (Subtract (Arg0, 1))
Remark 2098 - ^ Recursive method call (RCIV)
grammar.asl 668: Method(SMWE, 4)
Remark 2146 - ^ Method Argument is never used (Arg0)
grammar.asl 668: Method(SMWE, 4)
Remark 2146 - ^ Method Argument is never used (Arg1)
grammar.asl 668: Method(SMWE, 4)
Remark 2146 - ^ Method Argument is never used (Arg2)
grammar.asl 668: Method(SMWE, 4)
Remark 2146 - ^ Method Argument is never used (Arg3)
grammar.asl 673: Method(SMRE, 4)
Remark 2146 - ^ Method Argument is never used (Arg0)
grammar.asl 673: Method(SMRE, 4)
Remark 2146 - ^ Method Argument is never used (Arg1)
grammar.asl 673: Method(SMRE, 4)
Remark 2146 - ^ Method Argument is never used (Arg2)
grammar.asl 673: Method(SMRE, 4)
Remark 2146 - ^ Method Argument is never used (Arg3)
grammar.asl 701: CreateField (\_SB_.SBUF, 148, 96, FLDV)
Remark 2089 - Object is not referenced ^ (Name [FLDV] is within a method [_INI])
grammar.asl 733: Method(_SRS)
Warning 3102 - ^ Reserved method has too few arguments (_SRS requires 1)
grammar.asl 738: Device(EIO)
Warning 3141 - Missing dependency ^ (Device object requires a _HID or _ADR in same scope)
grammar.asl 822: If(LNot(SMRE(0x09,0x17,Local2,RefOf(Local3)))){
Warning 3144 - Method Local is set but never used ^ (Local3)
grammar.asl 913: Device (DEV1)
Warning 3141 - ^ Missing dependency (Device object requires a _HID or _ADR in same scope)
grammar.asl 963: Divide (Local0, Local1, Local3)
Warning 3144 - Method Local is set but never used ^ (Local3)
grammar.asl 988: Method (R226, 2)
Remark 2146 - ^ Method Argument is never used (Arg0)
grammar.asl 988: Method (R226, 2)
Remark 2146 - ^ Method Argument is never used (Arg1)
grammar.asl 1011: Store (Local0, Local1)
Warning 3144 - ^ Method Local is set but never used (Local1)
grammar.asl 1296: Method (OBJ1, 1, SERIALIZED)
Remark 2146 - ^ Method Argument is never used (Arg0)
grammar.asl 1300: Name(BUFR, Buffer (Local0) {})
Remark 2089 - ^ Object is not referenced (Name [BUFR] is within a method [OBJ1])
grammar.asl 1307: Alias (MTX1, MTX2)
Remark 2089 - Object is not referenced ^ (Name [MTX2] is within a method [OBJ1])
grammar.asl 1329: CreateField (BUF2, 148, 96, FLD3)
Remark 2089 - Object is not referenced ^ (Name [FLD3] is within a method [FLDS])
grammar.asl 1394: Store (0x1234567887654321, QWD2)
Warning 3038 - ^ Truncating 64-bit constant found in 32-bit table
grammar.asl 1396: if (LNotEqual (Local0, 0x1234567887654321))
Warning 3038 - Truncating 64-bit constant found in 32-bit table ^
grammar.asl 1476: SizeOf (BUFO)
Error 6114 - ^ Result is not used, operator has no effect
grammar.asl 1496: Alias (MTX2, MTXA)
Remark 2089 - Object is not referenced ^ (Name [MTXA] is within a method [OBJ2])
grammar.asl 1502: Acquire (MTX2, 1)
Warning 3130 - ^ Result is not used, possible operator timeout will be missed
grammar.asl 1650: Add (Local0, Local1)
Error 6114 - ^ Result is not used, operator has no effect
grammar.asl 1661: Add (Local0, Local1, Local2)
Warning 3144 - Method Local is set but never used ^ (Local2)
grammar.asl 1777: Store (LAnd (0xFFFFFFFF, 0x11111111), Local0)
Warning 3144 - Method Local is set but never used ^ (Local0)
grammar.asl 1780: Store (LEqual (0xFFFFFFFF, 0x11111111), Local1)
Warning 3144 - Method Local is set but never used ^ (Local1)
grammar.asl 1783: Store (LGreater (0xFFFFFFFF, 0x11111111), Local2)
Warning 3144 - Method Local is set but never used ^ (Local2)
grammar.asl 1786: Store (LGreaterEqual (0xFFFFFFFF, 0x11111111), Local3)
Warning 3144 - Method Local is set but never used ^ (Local3)
grammar.asl 1789: Store (LLess (0xFFFFFFFF, 0x11111111), Local4)
Warning 3144 - Method Local is set but never used ^ (Local4)
grammar.asl 1792: Store (LLessEqual (0xFFFFFFFF, 0x11111111), Local5)
Warning 3144 - Method Local is set but never used ^ (Local5)
grammar.asl 1821: Method (COND)
Warning 3115 - ^ Not all control paths return a value (COND)
grammar.asl 1930: Store (RefOf (MAIN), Local5)
Warning 3144 - Method Local is set but never used ^ (Local5)
grammar.asl 2005: Device (IFEL)
Warning 3141 - ^ Missing dependency (Device object requires a _HID or _ADR in same scope)
grammar.asl 2162: Device (NOSV)
Warning 3141 - ^ Missing dependency (Device object requires a _HID or _ADR in same scope)
grammar.asl 2583: Device (IDXF)
Warning 3141 - ^ Missing dependency (Device object requires a _HID or _ADR in same scope)
grammar.asl 2611: Store (IFE0, Local0)
Warning 3144 - ^ Method Local is set but never used (Local0)
grammar.asl 2612: Store (IFE1, Local1)
Warning 3144 - ^ Method Local is set but never used (Local1)
grammar.asl 2613: Store (IFE2, Local2)
Warning 3144 - ^ Method Local is set but never used (Local2)
grammar.asl 2630: Device (NSTL)
Warning 3141 - Missing dependency ^ (Device object requires a _HID or _ADR in same scope)
grammar.asl 2658: Device (RTBF)
Warning 3141 - ^ Missing dependency (Device object requires a _HID or _ADR in same scope)
grammar.asl 2756: Device (GPE2)
Warning 3141 - ^ Missing dependency (Device object requires a _HID or _ADR in same scope)
grammar.asl 2771: Device (PRW2)
Warning 3141 - ^ Missing dependency (Device object requires a _HID or _ADR in same scope)
grammar.asl 2819: Device (PRW1)
Warning 3141 - ^ Missing dependency (Device object requires a _HID or _ADR in same scope)
grammar.asl 2886: Store (Arg0, Local0)
Warning 3144 - ^ Method Local is set but never used (Local0)
grammar.asl 2889: Device (RTLV)
Warning 3141 - Missing dependency ^ (Device object requires a _HID or _ADR in same scope)
grammar.asl 2993: Name (_CRS,0)
Error 6105 - ^ Invalid object type for reserved name (_CRS: found Integer, Buffer required)
grammar.asl 3017: Device (RETP)
Warning 3141 - Missing dependency ^ (Device object requires a _HID or _ADR in same scope)
grammar.asl 3053: Device (WHLR)
Warning 3141 - ^ Missing dependency (Device object requires a _HID or _ADR in same scope)
grammar.asl 3109: Device (ANDO)
Warning 3141 - ^ Missing dependency (Device object requires a _HID or _ADR in same scope)
grammar.asl 3383: Device (BRKP)
Warning 3141 - ^ Missing dependency (Device object requires a _HID or _ADR in same scope)
grammar.asl 3420: Device (ADSU)
Warning 3141 - ^ Missing dependency (Device object requires a _HID or _ADR in same scope)
grammar.asl 3513: Device (INDC)
Warning 3141 - ^ Missing dependency (Device object requires a _HID or _ADR in same scope)
grammar.asl 3611: Device (LOPS)
Warning 3141 - ^ Missing dependency (Device object requires a _HID or _ADR in same scope)
grammar.asl 3956: Device (FDSO)
Warning 3141 - ^ Missing dependency (Device object requires a _HID or _ADR in same scope)
grammar.asl 4120: Device (MLDV)
Warning 3141 - ^ Missing dependency (Device object requires a _HID or _ADR in same scope)
grammar.asl 4253: Device (NBIT)
Warning 3141 - ^ Missing dependency (Device object requires a _HID or _ADR in same scope)
grammar.asl 4489: Device (SHFT)
Warning 3141 - ^ Missing dependency (Device object requires a _HID or _ADR in same scope)
grammar.asl 4685: Device (XORD)
Warning 3141 - ^ Missing dependency (Device object requires a _HID or _ADR in same scope)
grammar.asl 5022: Device (CRBF)
Warning 3141 - ^ Missing dependency (Device object requires a _HID or _ADR in same scope)
grammar.asl 5100: Device (IDX4)
Warning 3141 - ^ Missing dependency (Device object requires a _HID or _ADR in same scope)
grammar.asl 5639: Device (EVNT)
Warning 3141 - ^ Missing dependency (Device object requires a _HID or _ADR in same scope)
grammar.asl 5867: Device (SZLV)
Warning 3141 - ^ Missing dependency (Device object requires a _HID or _ADR in same scope)
grammar.asl 5960: Device (BYTF)
Warning 3141 - Missing dependency ^ (Device object requires a _HID or _ADR in same scope)
grammar.asl 5970: Device (C005)
Warning 3141 - Missing dependency ^ (Device object requires a _HID or _ADR in same scope)
grammar.asl 5972: Device (C013)
Warning 3141 - Missing dependency ^ (Device object requires a _HID or _ADR in same scope)
grammar.asl 6027: Name (_HID, "*PNP0A06")
Error 6061 - Invalid leading asterisk ^ (*PNP0A06)
grammar.asl 6166: Name (C18C, Package (2)
Remark 2063 - ^ Initializer list shorter than declared package length
grammar.asl 6190: Device (C19B)
Warning 3141 - Missing dependency ^ (Device object requires a _HID or _ADR in same scope)
grammar.asl 6199: Divide (Local1, 10, Local0, Local2) // Local0 = Local1 / 10
Warning 3144 - Method Local is set but never used ^ (Local0)
grammar.asl 6244: Device (DWDF)
Warning 3141 - ^ Missing dependency (Device object requires a _HID or _ADR in same scope)
grammar.asl 6276: Method (MKW_, 2)
Remark 2146 - ^ Method Argument is never used (Arg0)
grammar.asl 6276: Method (MKW_, 2)
Remark 2146 - ^ Method Argument is never used (Arg1)
grammar.asl 6285: Device (DVAX)
Warning 3141 - ^ Missing dependency (Device object requires a _HID or _ADR in same scope)
grammar.asl 6328: Device (IDX6)
Warning 3141 - ^ Missing dependency (Device object requires a _HID or _ADR in same scope)
grammar.asl 6352: Device (TST_)
Warning 3141 - Missing dependency ^ (Device object requires a _HID or _ADR in same scope)
grammar.asl 6371: Store (IFE0, Local0)
Warning 3144 - ^ Method Local is set but never used (Local0)
grammar.asl 6372: Store (IFE1, Local1)
Warning 3144 - ^ Method Local is set but never used (Local1)
grammar.asl 6373: Store (IFE2, Local2)
Warning 3144 - ^ Method Local is set but never used (Local2)
grammar.asl 6376: Store (\IDX6.IFE0, Local3)
Warning 3144 - Method Local is set but never used ^ (Local3)
grammar.asl 6377: Store (\IDX6.IFE1, Local4)
Warning 3144 - Method Local is set but never used ^ (Local4)
grammar.asl 6379: Store (\IDX6.TST_.IFE0, Local5)
Warning 3144 - Method Local is set but never used ^ (Local5)
grammar.asl 6380: Store (\IDX6.TST_.IFE1, Local6)
Warning 3144 - Method Local is set but never used ^ (Local6)
grammar.asl 6393: Device (IDX5)
Warning 3141 - ^ Missing dependency (Device object requires a _HID or _ADR in same scope)
grammar.asl 6478: Name (_CRS, Buffer(26) {"\_SB_.PCI2._CRS..........."})
Warning 3046 - Invalid or unknown escape sequence ^
grammar.asl 6709: Device (BITI)
Warning 3141 - Missing dependency ^ (Device object requires a _HID or _ADR in same scope)
grammar.asl 6817: And (Local0, 1, Local0) // Local0 &= 1
Error 6066 - ^ Method local variable is not initialized (Local0)
grammar.asl 6903: Name (_HID, "*PNP0C0A") // Control Method Battey ID
Error 6061 - Invalid leading asterisk ^ (*PNP0C0A)
grammar.asl 6912: Device (IDX3)
Warning 3141 - Missing dependency ^ (Device object requires a _HID or _ADR in same scope)
grammar.asl 7057: Device(IDX7)
Warning 3141 - ^ Missing dependency (Device object requires a _HID or _ADR in same scope)
grammar.asl 7736: Device (MTCH)
Warning 3141 - ^ Missing dependency (Device object requires a _HID or _ADR in same scope)
grammar.asl 7757: CreateDWordField (TMD0, 4, DMA0)
Remark 2089 - Object is not referenced ^ (Name [DMA0] is within a method [TEST])
grammar.asl 7758: CreateDWordField (TMD0, 8, PIO1)
Remark 2089 - Object is not referenced ^ (Name [PIO1] is within a method [TEST])
grammar.asl 7759: CreateDWordField (TMD0, 12, DMA1)
Remark 2089 - Object is not referenced ^ (Name [DMA1] is within a method [TEST])
grammar.asl 7760: CreateDWordField (TMD0, 16, CHNF)
Remark 2089 - Object is not referenced ^ (Name [CHNF] is within a method [TEST])
grammar.asl 7934: Device (WHLB)
Warning 3141 - ^ Missing dependency (Device object requires a _HID or _ADR in same scope)
grammar.asl 8295: Device (IDX2)
Warning 3141 - Missing dependency ^ (Device object requires a _HID or _ADR in same scope)
grammar.asl 8678: Device (SIZO)
Warning 3141 - ^ Missing dependency (Device object requires a _HID or _ADR in same scope)
grammar.asl 8720: Name (PKG2, Package (4)
Remark 2063 - ^ Initializer list shorter than declared package length
grammar.asl 9132: Store (_OS, Local0)
Warning 3144 - ^ Method Local is set but never used (Local0)
grammar.asl 9262: Device (MBIT)
Warning 3141 - Missing dependency ^ (Device object requires a _HID or _ADR in same scope)
grammar.asl 9273: Device (MWRD)
Warning 3141 - Missing dependency ^ (Device object requires a _HID or _ADR in same scope)
grammar.asl 9281: Device (MBYT)
Warning 3141 - Missing dependency ^ (Device object requires a _HID or _ADR in same scope)
grammar.asl 9354: Device (SMIS)
Warning 3141 - Missing dependency ^ (Device object requires a _HID or _ADR in same scope)
grammar.asl 9408: Device(CNDT)
Warning 3141 - Missing dependency ^ (Device object requires a _HID or _ADR in same scope)
Intel ACPI Component Architecture
ASL+ Optimizing Compiler/Disassembler version VVVVVVVV
Copyright (c) 2000 - 2018 Intel Corporation
Ignoring all errors, forcing AML file generation
ASL Input: grammar.asl - 10284 lines, 323650 bytes, 4818 keywords
AML Output: grammar.aml - 43469 bytes, 670 named objects, 4148 executable opcodes
Compilation complete. 6 Errors, 88 Warnings, 27 Remarks, 1232 Optimizations, 75 Constants Folded

35
tests/grammar/runtest.sh Executable file
View File

@ -0,0 +1,35 @@
#!/bin/bash
#
# run the misc tests: we need to do this in a script since
# these are expected to fail which would normally cause %check
# to stop. however, this is expected behavior. we are running
# iasl precisely because we expect it to stop when presented with
# faulty ASL.
#
# this script assumes it is in the source 'tests' directory at
# start.
#
PWD=$(pwd)
BINDIR="/usr/bin"
VERSION=$($BINDIR/iasl -v | grep Optimizing | cut -d" " -f5)
# create file to compare against
pushd ./grammar > /dev/null
sed -e "s/VVVVVVVV/$VERSION/" \
grammar.asl.result > grammar.asl.expected
# see if grammar.asl failed as expected
# NB: the -f option is required so we can see all of the errors
$BINDIR/iasl -f grammar.asl > grammar.asl.actual 2>&1
diff grammar.asl.actual grammar.asl.expected >/dev/null 2>&1
RET=$?
popd > /dev/null
if [ $RET -eq 0 ]
then
echo PASS grammar
else
echo FAIL grammar
fi
exit $RET

3
tests/grammar2/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
grammar2.aml
grammar2.asl.actual
grammar2.asl.expected

3
tests/grammar2/PURPOSE Normal file
View File

@ -0,0 +1,3 @@
PURPOSE of tests/grammar
Description: sanity check that iasl is handling ASL grammar properly
Author: Al Stone <ahs3@redhat.com>

11652
tests/grammar2/grammar2.asl Executable file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,368 @@
grammar2.asl 106: Device (A1)
Warning 3141 - ^ Missing dependency (Device object requires a _HID or _ADR in same scope)
grammar2.asl 121: Device (A2)
Warning 3141 - ^ Missing dependency (Device object requires a _HID or _ADR in same scope)
grammar2.asl 131: Device (A3)
Warning 3141 - ^ Missing dependency (Device object requires a _HID or _ADR in same scope)
grammar2.asl 141: Device (A4)
Warning 3141 - ^ Missing dependency (Device object requires a _HID or _ADR in same scope)
grammar2.asl 156: Device (IRES)
Warning 3141 - Missing dependency ^ (Device object requires a _HID or _ADR in same scope)
grammar2.asl 184: Name (_NPK, Package (0x04)
Warning 3133 - ^ Unknown reserved name (_NPK)
grammar2.asl 191: Device (RES)
Warning 3141 - ^ Missing dependency (Device object requires a _HID or _ADR in same scope)
grammar2.asl 437: CreateByteField (PRT0, \RES._CRS._Y01._ASZ, RSIZ) // _ASZ: Access Size
Remark 2089 - Object is not referenced ^ (Name [RSIZ] is within a method [_CRS])
grammar2.asl 579: Name (_STR, Unicode ("test")) // _STR: Description String
Remark 2089 - ^ Object is not referenced (Name [_STR] is within a method [TCOP])
grammar2.asl 581: Local0 = MFLD /* \MFLD */
Warning 3144 - ^ Method Local is set but never used (Local0)
grammar2.asl 706: Method (RCIV, 1, NotSerialized)
Warning 3115 - ^ Not all control paths return a value (RCIV)
grammar2.asl 714: RCIV ((Arg0 - 0x01))
Remark 2098 - ^ Recursive method call (RCIV)
grammar2.asl 758: Method (SMWE, 4, NotSerialized)
Remark 2146 - ^ Method Argument is never used (Arg0)
grammar2.asl 758: Method (SMWE, 4, NotSerialized)
Remark 2146 - ^ Method Argument is never used (Arg1)
grammar2.asl 758: Method (SMWE, 4, NotSerialized)
Remark 2146 - ^ Method Argument is never used (Arg2)
grammar2.asl 758: Method (SMWE, 4, NotSerialized)
Remark 2146 - ^ Method Argument is never used (Arg3)
grammar2.asl 763: Method (SMRE, 4, NotSerialized)
Remark 2146 - ^ Method Argument is never used (Arg0)
grammar2.asl 763: Method (SMRE, 4, NotSerialized)
Remark 2146 - ^ Method Argument is never used (Arg1)
grammar2.asl 763: Method (SMRE, 4, NotSerialized)
Remark 2146 - ^ Method Argument is never used (Arg2)
grammar2.asl 763: Method (SMRE, 4, NotSerialized)
Remark 2146 - ^ Method Argument is never used (Arg3)
grammar2.asl 788: CreateField (\_SB.SBUF, 0x94, 0x60, FLDV)
Remark 2089 - Object is not referenced ^ (Name [FLDV] is within a method [_INI])
grammar2.asl 812: Method (_SRS, 0, NotSerialized) // _SRS: Set Resource Settings
Warning 3102 - ^ Reserved method has too few arguments (_SRS requires 1)
grammar2.asl 817: Device (EIO)
Warning 3141 - Missing dependency ^ (Device object requires a _HID or _ADR in same scope)
grammar2.asl 885: If (!SMRE (0x09, 0x17, Local2, RefOf (Local3)))
Warning 3144 - Method Local is set but never used ^ (Local3)
grammar2.asl 981: Device (DEV1)
Warning 3141 - Missing dependency ^ (Device object requires a _HID or _ADR in same scope)
grammar2.asl 1029: Divide (Local0, Local1, Local3)
Warning 3144 - Method Local is set but never used ^ (Local3)
grammar2.asl 1055: Method (R226, 2, NotSerialized)
Remark 2146 - ^ Method Argument is never used (Arg0)
grammar2.asl 1055: Method (R226, 2, NotSerialized)
Remark 2146 - ^ Method Argument is never used (Arg1)
grammar2.asl 1083: Local1 = Local0
Warning 3144 - ^ Method Local is set but never used (Local1)
grammar2.asl 1364: Method (OBJ1, 1, Serialized)
Remark 2146 - ^ Method Argument is never used (Arg0)
grammar2.asl 1367: Name (BUFR, Buffer (Local0){})
Remark 2089 - ^ Object is not referenced (Name [BUFR] is within a method [OBJ1])
grammar2.asl 1375: Alias (MTX1, MTX2)
Remark 2089 - Object is not referenced ^ (Name [MTX2] is within a method [OBJ1])
grammar2.asl 1393: CreateField (BUF2, 0x94, 0x60, FLD3)
Remark 2089 - Object is not referenced ^ (Name [FLD3] is within a method [FLDS])
grammar2.asl 1457: QWD2 = 0x1234567887654321
Warning 3038 - ^ Truncating 64-bit constant found in 32-bit table
grammar2.asl 1459: If ((Local0 != 0x1234567887654321))
Warning 3038 - ^ Truncating 64-bit constant found in 32-bit table
grammar2.asl 1536: SizeOf (BUFO)
Error 6114 - ^ Result is not used, operator has no effect
grammar2.asl 1550: Alias (MTX2, MTXA)
Remark 2089 - Object is not referenced ^ (Name [MTXA] is within a method [OBJ2])
grammar2.asl 1554: Acquire (MTX2, 0x0001)
Warning 3130 - ^ Result is not used, possible operator timeout will be missed
grammar2.asl 1669: (Local0 + Local1)
Error 6114 - ^ Result is not used, operator has no effect
grammar2.asl 1680: Local2 = (Local0 + Local1)
Warning 3144 - ^ Method Local is set but never used (Local2)
grammar2.asl 1792: Local0 = (0xFFFFFFFF && 0x11111111)
Warning 3144 - ^ Method Local is set but never used (Local0)
grammar2.asl 1794: Local1 = (0xFFFFFFFF == 0x11111111)
Warning 3144 - ^ Method Local is set but never used (Local1)
grammar2.asl 1796: Local2 = (0xFFFFFFFF > 0x11111111)
Warning 3144 - ^ Method Local is set but never used (Local2)
grammar2.asl 1798: Local3 = (0xFFFFFFFF >= 0x11111111)
Warning 3144 - ^ Method Local is set but never used (Local3)
grammar2.asl 1800: Local4 = (0xFFFFFFFF < 0x11111111)
Warning 3144 - ^ Method Local is set but never used (Local4)
grammar2.asl 1802: Local5 = (0xFFFFFFFF <= 0x11111111)
Warning 3144 - ^ Method Local is set but never used (Local5)
grammar2.asl 1827: Method (COND, 0, NotSerialized)
Warning 3115 - ^ Not all control paths return a value (COND)
grammar2.asl 1937: Local5 = RefOf (MAIN)
Warning 3144 - ^ Method Local is set but never used (Local5)
grammar2.asl 1999: Device (IFEL)
Warning 3141 - Missing dependency ^ (Device object requires a _HID or _ADR in same scope)
grammar2.asl 2165: Device (NOSV)
Warning 3141 - Missing dependency ^ (Device object requires a _HID or _ADR in same scope)
grammar2.asl 2604: Device (IDXF)
Warning 3141 - Missing dependency ^ (Device object requires a _HID or _ADR in same scope)
grammar2.asl 2633: Local0 = IFE0 /* \IDXF.IFE0 */
Warning 3144 - ^ Method Local is set but never used (Local0)
grammar2.asl 2634: Local1 = IFE1 /* \IDXF.IFE1 */
Warning 3144 - ^ Method Local is set but never used (Local1)
grammar2.asl 2635: Local2 = IFE2 /* \IDXF.IFE2 */
Warning 3144 - ^ Method Local is set but never used (Local2)
grammar2.asl 2651: Device (NSTL)
Warning 3141 - Missing dependency ^ (Device object requires a _HID or _ADR in same scope)
grammar2.asl 2681: Device (RTBF)
Warning 3141 - Missing dependency ^ (Device object requires a _HID or _ADR in same scope)
grammar2.asl 2786: Device (GPE2)
Warning 3141 - Missing dependency ^ (Device object requires a _HID or _ADR in same scope)
grammar2.asl 2801: Device (PRW2)
Warning 3141 - Missing dependency ^ (Device object requires a _HID or _ADR in same scope)
grammar2.asl 2855: Device (PRW1)
Warning 3141 - Missing dependency ^ (Device object requires a _HID or _ADR in same scope)
grammar2.asl 2936: Local0 = Arg0
Warning 3144 - ^ Method Local is set but never used (Local0)
grammar2.asl 2939: Device (RTLV)
Warning 3141 - Missing dependency ^ (Device object requires a _HID or _ADR in same scope)
grammar2.asl 3052: Name (_CRS, 0x00) // _CRS: Current Resource Settings
Error 6105 - ^ Invalid object type for reserved name (_CRS: found Integer, Buffer required)
grammar2.asl 3159: Device (RETP)
Warning 3141 - Missing dependency ^ (Device object requires a _HID or _ADR in same scope)
grammar2.asl 3199: Device (WHLR)
Warning 3141 - Missing dependency ^ (Device object requires a _HID or _ADR in same scope)
grammar2.asl 3255: Device (ANDO)
Warning 3141 - Missing dependency ^ (Device object requires a _HID or _ADR in same scope)
grammar2.asl 3543: Device (BRKP)
Warning 3141 - Missing dependency ^ (Device object requires a _HID or _ADR in same scope)
grammar2.asl 3581: Device (ADSU)
Warning 3141 - Missing dependency ^ (Device object requires a _HID or _ADR in same scope)
grammar2.asl 3706: Device (INDC)
Warning 3141 - Missing dependency ^ (Device object requires a _HID or _ADR in same scope)
grammar2.asl 3835: Device (LOPS)
Warning 3141 - Missing dependency ^ (Device object requires a _HID or _ADR in same scope)
grammar2.asl 4269: Device (FDSO)
Warning 3141 - Missing dependency ^ (Device object requires a _HID or _ADR in same scope)
grammar2.asl 4484: Device (MLDV)
Warning 3141 - Missing dependency ^ (Device object requires a _HID or _ADR in same scope)
grammar2.asl 4664: Device (NBIT)
Warning 3141 - Missing dependency ^ (Device object requires a _HID or _ADR in same scope)
grammar2.asl 4955: Device (SHFT)
Warning 3141 - Missing dependency ^ (Device object requires a _HID or _ADR in same scope)
grammar2.asl 5194: Device (XORD)
Warning 3141 - Missing dependency ^ (Device object requires a _HID or _ADR in same scope)
grammar2.asl 5571: Device (CRBF)
Warning 3141 - Missing dependency ^ (Device object requires a _HID or _ADR in same scope)
grammar2.asl 5674: Device (IDX4)
Warning 3141 - Missing dependency ^ (Device object requires a _HID or _ADR in same scope)
grammar2.asl 6604: Device (EVNT)
Warning 3141 - Missing dependency ^ (Device object requires a _HID or _ADR in same scope)
grammar2.asl 6867: Device (SZLV)
Warning 3141 - Missing dependency ^ (Device object requires a _HID or _ADR in same scope)
grammar2.asl 6952: Device (BYTF)
Warning 3141 - Missing dependency ^ (Device object requires a _HID or _ADR in same scope)
grammar2.asl 6963: Device (C005)
Warning 3141 - Missing dependency ^ (Device object requires a _HID or _ADR in same scope)
grammar2.asl 6967: Device (C013)
Warning 3141 - Missing dependency ^ (Device object requires a _HID or _ADR in same scope)
grammar2.asl 7039: Name (_HID, "*PNP0A06") // _HID: Hardware ID
Error 6061 - Invalid leading asterisk ^ (*PNP0A06)
grammar2.asl 7231: Name (C18C, Package (0x02)
Remark 2063 - ^ Initializer list shorter than declared package length
grammar2.asl 7264: Device (C19B)
Warning 3141 - Missing dependency ^ (Device object requires a _HID or _ADR in same scope)
grammar2.asl 7276: Divide (Local1, 0x0A, Local0, Local2) /* Local0 = Local1 / 10 */
Warning 3144 - Method Local is set but never used ^ (Local0)
grammar2.asl 7321: Device (DWDF)
Warning 3141 - Missing dependency ^ (Device object requires a _HID or _ADR in same scope)
grammar2.asl 7345: Method (MKW, 2, NotSerialized)
Remark 2146 - ^ Method Argument is never used (Arg0)
grammar2.asl 7345: Method (MKW, 2, NotSerialized)
Remark 2146 - ^ Method Argument is never used (Arg1)
grammar2.asl 7354: Device (DVAX)
Warning 3141 - Missing dependency ^ (Device object requires a _HID or _ADR in same scope)
grammar2.asl 7394: Device (IDX6)
Warning 3141 - Missing dependency ^ (Device object requires a _HID or _ADR in same scope)
grammar2.asl 7420: Device (TST)
Warning 3141 - Missing dependency ^ (Device object requires a _HID or _ADR in same scope)
grammar2.asl 7441: Local0 = IFE0 /* \IDX6.IFE0 */
Warning 3144 - ^ Method Local is set but never used (Local0)
grammar2.asl 7442: Local1 = IFE1 /* \IDX6.IFE1 */
Warning 3144 - ^ Method Local is set but never used (Local1)
grammar2.asl 7443: Local2 = IFE2 /* \IDX6.IFE2 */
Warning 3144 - ^ Method Local is set but never used (Local2)
grammar2.asl 7446: Local3 = \IDX6.IFE0
Warning 3144 - ^ Method Local is set but never used (Local3)
grammar2.asl 7447: Local4 = \IDX6.IFE1
Warning 3144 - ^ Method Local is set but never used (Local4)
grammar2.asl 7450: Local5 = \IDX6.TST.IFE0
Warning 3144 - ^ Method Local is set but never used (Local5)
grammar2.asl 7451: Local6 = \IDX6.TST.IFE1
Warning 3144 - ^ Method Local is set but never used (Local6)
grammar2.asl 7463: Device (IDX5)
Warning 3141 - Missing dependency ^ (Device object requires a _HID or _ADR in same scope)
grammar2.asl 7852: Device (BITI)
Warning 3141 - Missing dependency ^ (Device object requires a _HID or _ADR in same scope)
grammar2.asl 7960: Local0 &= 0x01 /* Local0 &= 1 */
Error 6066 - ^ Method local variable is not initialized (Local0)
grammar2.asl 8123: Name (_HID, "*PNP0C0A") /* Control Method Battey ID */ // _HID: Hardware ID
Error 6061 - Invalid leading asterisk ^ (*PNP0C0A)
grammar2.asl 8133: Device (IDX3)
Warning 3141 - Missing dependency ^ (Device object requires a _HID or _ADR in same scope)
grammar2.asl 8314: Device (IDX7)
Warning 3141 - Missing dependency ^ (Device object requires a _HID or _ADR in same scope)
grammar2.asl 9020: Device (MTCH)
Warning 3141 - Missing dependency ^ (Device object requires a _HID or _ADR in same scope)
grammar2.asl 9099: CreateDWordField (TMD0, 0x04, DMA0)
Remark 2089 - Object is not referenced ^ (Name [DMA0] is within a method [TEST])
grammar2.asl 9100: CreateDWordField (TMD0, 0x08, PIO1)
Remark 2089 - Object is not referenced ^ (Name [PIO1] is within a method [TEST])
grammar2.asl 9101: CreateDWordField (TMD0, 0x0C, DMA1)
Remark 2089 - Object is not referenced ^ (Name [DMA1] is within a method [TEST])
grammar2.asl 9102: CreateDWordField (TMD0, 0x10, CHNF)
Remark 2089 - Object is not referenced ^ (Name [CHNF] is within a method [TEST])
grammar2.asl 9295: Device (WHLB)
Warning 3141 - Missing dependency ^ (Device object requires a _HID or _ADR in same scope)
grammar2.asl 9673: Device (IDX2)
Warning 3141 - Missing dependency ^ (Device object requires a _HID or _ADR in same scope)
grammar2.asl 10054: Device (SIZO)
Warning 3141 - Missing dependency ^ (Device object requires a _HID or _ADR in same scope)
grammar2.asl 10103: Name (PKG2, Package (0x04)
Remark 2063 - ^ Initializer list shorter than declared package length
grammar2.asl 10489: Local0 = _OS /* \_OS_ */
Warning 3144 - ^ Method Local is set but never used (Local0)
grammar2.asl 10621: Device (MBIT)
Warning 3141 - Missing dependency ^ (Device object requires a _HID or _ADR in same scope)
grammar2.asl 10632: Device (MWRD)
Warning 3141 - Missing dependency ^ (Device object requires a _HID or _ADR in same scope)
grammar2.asl 10640: Device (MBYT)
Warning 3141 - Missing dependency ^ (Device object requires a _HID or _ADR in same scope)
grammar2.asl 10714: Device (SMIS)
Warning 3141 - Missing dependency ^ (Device object requires a _HID or _ADR in same scope)
grammar2.asl 10780: Device (CNDT)
Warning 3141 - Missing dependency ^ (Device object requires a _HID or _ADR in same scope)
Intel ACPI Component Architecture
ASL+ Optimizing Compiler/Disassembler version 20180508
Copyright (c) 2000 - 2018 Intel Corporation
Ignoring all errors, forcing AML file generation
ASL Input: grammar2.asl - 11654 lines, 378020 bytes, 4899 keywords
AML Output: grammar2.aml - 43758 bytes, 670 named objects, 4229 executable opcodes
Compilation complete. 6 Errors, 86 Warnings, 27 Remarks, 1109 Optimizations

35
tests/grammar2/runtest.sh Executable file
View File

@ -0,0 +1,35 @@
#!/bin/bash
#
# run the misc tests: we need to do this in a script since
# these are expected to fail which would normally cause %check
# to stop. however, this is expected behavior. we are running
# iasl precisely because we expect it to stop when presented with
# faulty ASL.
#
# this script assumes it is in the source 'tests' directory at
# start.
#
PWD=$(pwd)
BINDIR="/usr/bin"
VERSION=$($BINDIR/iasl -v | grep Optimizing | cut -d" " -f5)
# create file to compare against
pushd ./grammar2 > /dev/null
sed -e "s/VVVVVVVV/$VERSION/" \
grammar2.asl.result > grammar2.asl.expected
# see if grammar2.asl failed as expected
# NB: the -f option is required so we can see all of the errors
$BINDIR/iasl -f -of grammar2.asl > grammar2.asl.actual 2>&1
diff grammar2.asl.actual grammar2.asl.expected >/dev/null 2>&1
RET=$?
popd > /dev/null
if [ $RET -eq 0 ]
then
echo PASS grammar2
else
echo FAIL grammar2
fi
exit $RET

28
tests/test_badcode.yml Normal file
View File

@ -0,0 +1,28 @@
- hosts: localhost
vars:
- artifacts: ./artifacts
tags:
- classic
remote_user: root
tasks:
- name: badcode
block:
- name: run the badcode test
shell: exec > /tmp/badcode.test.log 2>&1 && ./badcode/runtest.sh
always:
- name: pull out logs
fetch:
dest: "{{ artifacts }}/"
src: "/tmp/badcode.test.log"
flat: yes
- name: pull out expected
fetch:
dest: "{{ artifacts }}/"
src: "./badcode/badcode.asl.expected"
flat: yes
- name: pull out actual
fetch:
dest: "{{ artifacts }}/"
src: "./badcode/badcode.asl.actual"
flat: yes

View File

@ -0,0 +1,28 @@
- hosts: localhost
vars:
- artifacts: ./artifacts
tags:
- classic
remote_user: root
tasks:
- name: converterSample
block:
- name: run the converterSample test
shell: exec > /tmp/converterSample.test.log 2>&1 && ./converterSample/runtest.sh
always:
- name: pull out logs
fetch:
dest: "{{ artifacts }}/"
src: "/tmp/converterSample.test.log"
flat: yes
- name: pull out expected
fetch:
dest: "{{ artifacts }}/"
src: "./converterSample/converterSample.asl.expected"
flat: yes
- name: pull out actual
fetch:
dest: "{{ artifacts }}/"
src: "./converterSample/converterSample.asl.actual"
flat: yes

28
tests/test_grammar.yml Normal file
View File

@ -0,0 +1,28 @@
- hosts: localhost
vars:
- artifacts: ./artifacts
tags:
- classic
remote_user: root
tasks:
- name: grammar
block:
- name: run the grammar test
shell: exec > /tmp/grammar.test.log 2>&1 && ./grammar/runtest.sh
always:
- name: pull out logs
fetch:
dest: "{{ artifacts }}/"
src: "/tmp/grammar.test.log"
flat: yes
- name: pull out expected
fetch:
dest: "{{ artifacts }}/"
src: "./grammar/grammar.asl.expected"
flat: yes
- name: pull out actual
fetch:
dest: "{{ artifacts }}/"
src: "./grammar/grammar.asl.actual"
flat: yes

28
tests/test_grammar2.yml Normal file
View File

@ -0,0 +1,28 @@
- hosts: localhost
vars:
- artifacts: ./artifacts
tags:
- classic
remote_user: root
tasks:
- name: grammar2
block:
- name: run the grammar2 test
shell: exec > /tmp/grammar2.test.log 2>&1 && ./grammar2/runtest.sh
always:
- name: pull out logs
fetch:
dest: "{{ artifacts }}/"
src: "/tmp/grammar2.test.log"
flat: yes
- name: pull out expected
fetch:
dest: "{{ artifacts }}/"
src: "./grammar2/grammar2.asl.expected"
flat: yes
- name: pull out actual
fetch:
dest: "{{ artifacts }}/"
src: "./grammar2/grammar2.asl.actual"
flat: yes

4
tests/tests.yml Normal file
View File

@ -0,0 +1,4 @@
- import_playbook: test_badcode.yml
- import_playbook: test_grammar.yml
- import_playbook: test_grammar2.yml
- import_playbook: test_converterSample.yml