Skip to content

Commit

Permalink
Merge pull request #171 from espressif/fix/negative_int_for_soc_header
Browse files Browse the repository at this point in the history
fix: negative value for soc caps integer
  • Loading branch information
hfudev authored Dec 20, 2024
2 parents e2ee173 + 494be97 commit ac74ba1
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion idf_build_apps/manifest/soc_header.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
# Define value, either a hex, int or a string
_hex_value = Combine(Literal('0x') + Word(hexnums) + Optional(_literal_suffix).suppress())('hex_value')
_str_value = QuotedString('"')('str_value')
_int_value = Word(nums)('int_value') + ~Char('.') + Optional(_literal_suffix)('literal_suffix')
_int_value = Combine(Optional('-') + Word(nums))('int_value') + ~Char('.') + Optional(_literal_suffix)('literal_suffix')

# Remove optional parenthesis around values
_value = Optional('(').suppress() + MatchFirst([_hex_value, _str_value, _int_value])('value') + Optional(')').suppress()
Expand Down
21 changes: 21 additions & 0 deletions tests/test_soc_caps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: Apache-2.0

import pytest

from idf_build_apps.manifest.soc_header import parse_define


@pytest.mark.parametrize(
's, res',
[
('#define SOC_FOO (4)', '4'),
('#define SOC_FOO (-4)', '-4'),
('#define SOC_FOO 4', '4'),
('#define SOC_FOO -4', '-4'),
],
)
def test_parse_define_int(s, res):
parse_result = parse_define(s)
assert parse_result['name'] == 'SOC_FOO'
assert parse_result['int_value'] == res

1 comment on commit ac74ba1

@github-actions
Copy link

Choose a reason for hiding this comment

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

Coverage

Coverage Report
FileStmtsMissCoverMissing
idf_build_apps
   __main__.py330%4–9
   app.py5238185%206, 251, 260–262, 294, 306, 323, 364–365, 368, 378–379, 390–393, 453–458, 478, 516, 572–580, 590–591, 601, 619–620, 622, 638–647, 663–701, 706–707, 711–712, 723–725, 731, 832–840, 850–880, 884–894, 985–991, 994, 1016
   args.py2913389%154, 310, 323, 330, 351–356, 366–371, 537, 540–541, 547, 557–559, 562, 587–588, 591–592, 721–722, 783, 785, 845, 864–874
   autocompletions.py292417%16–23, 31–54
   constants.py63986%20–21, 33–38, 47–48, 61–62
   finder.py84693%79–80, 150, 167–169
   log.py48492%37, 50, 55, 80
   main.py1996169%76–80, 94–99, 140–144, 174, 198–200, 204, 209–222, 237–240, 251–276, 366–373, 382–383, 405–413, 416, 422–423, 429–431
   session_args.py54787%46–50, 56, 70
   utils.py1882388%26, 35, 113, 130–131, 151–155, 203, 246, 273–279, 292–295, 314–315, 380
idf_build_apps/junit
   report.py93990%82, 92, 109–111, 137, 144–145, 170
   utils.py291066%18, 26–35
idf_build_apps/manifest
   if_parser.py109595%62, 99, 105, 169, 174
   manifest.py219996%90, 92, 139, 161, 306, 337–338, 357, 401
idf_build_apps/vendors
   pydantic_sources.py64691%50, 73, 76–79, 96
TOTAL212329086% 

Tests Skipped Failures Errors Time
115 0 💤 0 ❌ 0 🔥 9m 19s ⏱️

Please sign in to comment.