Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Javagedes committed Sep 29, 2023
1 parent 0e61e3c commit e0eb86a
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests.unit/parsers/test_dsc_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,3 +154,28 @@ def test_dsc_include_relative_path(self):
self.assertEqual(parser.LocalVars["INCLUDED"], "TRUE") # make sure we got the defines
finally:
os.chdir(cwd)

def test_handle_integer_comparisons(self):
DSC_FILE = '''
[Defines]
DEFINE SERIAL_REGISTER_BASE = 0xFEDC9000
[PcdsFixedAtBuild]
!if $(SERIAL_REGISTER_BASE) == 0x3F8 OR $(SERIAL_REGISTER_BASE) == 0x3E8
gEfiModulePkgTokenSpaceGuid.MyValue|0x04
# UART0 is COM2/4 IRQ3
!elseif $(SERIAL_REGISTER_BASE) == 0x2F8 OR $(SERIAL_REGISTER_BASE) == 0x2E8
gEfiModulePkgTokenSpaceGuid.MyValue|0x03
!endif
!if $(SERIAL_REGISTER_BASE) >= 0x10000
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialUseMmio|TRUE
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterStride|4
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialClockRate|48000000
!else
'''
import pathlib
workspace = tempfile.mkdtemp()
dsc = pathlib.Path(workspace) / "dsc.dsc"
dsc.write_text(DSC_FILE)
parser = DscParser()
parser.SetEdk2Path(Edk2Path(workspace, []))
parser.ParseFile(dsc)

0 comments on commit e0eb86a

Please sign in to comment.