Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix errors in sequence deserialization #387

Merged
merged 6 commits into from Jun 5, 2022
Merged

Fix errors in sequence deserialization #387

merged 6 commits into from Jun 5, 2022

Commits on May 30, 2022

  1. seq: Add tests for sequences deserialization

    failures (36):
        seq::fixed_name::fixed_size::field_after_list::overlapped
        seq::fixed_name::fixed_size::field_before_list::overlapped
        seq::fixed_name::fixed_size::two_lists::overlapped
        seq::fixed_name::fixed_size::unknown_items::overlapped
        seq::fixed_name::variable_size::field_after_list::overlapped
        seq::fixed_name::variable_size::field_before_list::overlapped
        seq::fixed_name::variable_size::two_lists::overlapped
        seq::fixed_name::variable_size::unknown_items::overlapped
        seq::variable_name::fixed_size::field_after_list::after
        seq::variable_name::fixed_size::field_after_list::before
        seq::variable_name::fixed_size::field_after_list::overlapped
        seq::variable_name::fixed_size::field_before_list::after
        seq::variable_name::fixed_size::field_before_list::before
        seq::variable_name::fixed_size::field_before_list::overlapped
        seq::variable_name::fixed_size::two_lists::choice_and_fixed::fixed_after
        seq::variable_name::fixed_size::two_lists::choice_and_fixed::fixed_before
        seq::variable_name::fixed_size::two_lists::choice_and_fixed::overlapped_fixed_after
        seq::variable_name::fixed_size::two_lists::choice_and_fixed::overlapped_fixed_before
        seq::variable_name::fixed_size::two_lists::fixed_and_choice::fixed_after
        seq::variable_name::fixed_size::two_lists::fixed_and_choice::fixed_before
        seq::variable_name::fixed_size::two_lists::fixed_and_choice::overlapped_fixed_after
        seq::variable_name::fixed_size::two_lists::fixed_and_choice::overlapped_fixed_before
        seq::variable_name::variable_size::field_after_list::after
        seq::variable_name::variable_size::field_after_list::before
        seq::variable_name::variable_size::field_after_list::overlapped
        seq::variable_name::variable_size::field_before_list::after
        seq::variable_name::variable_size::field_before_list::before
        seq::variable_name::variable_size::field_before_list::overlapped
        seq::variable_name::variable_size::two_lists::choice_and_fixed::fixed_after
        seq::variable_name::variable_size::two_lists::choice_and_fixed::fixed_before
        seq::variable_name::variable_size::two_lists::choice_and_fixed::overlapped_fixed_after
        seq::variable_name::variable_size::two_lists::choice_and_fixed::overlapped_fixed_before
        seq::variable_name::variable_size::two_lists::fixed_and_choice::fixed_after
        seq::variable_name::variable_size::two_lists::fixed_and_choice::fixed_before
        seq::variable_name::variable_size::two_lists::fixed_and_choice::overlapped_fixed_after
        seq::variable_name::variable_size::two_lists::fixed_and_choice::overlapped_fixed_before
    Mingun committed May 30, 2022
    Copy the full SHA
    d2ad730 View commit details
    Browse the repository at this point in the history

Commits on Jun 2, 2022

  1. seq: Allow to have an ordinary elements together with a $value field

    Example of a struct, that should be a valid definition:
    
        enum Choice { one, two, three }
        struct Root {
            #[serde(rename = "$value")]
            item: [Choice; 3],
            node: (),
        }
    
    and this struct should be able to deserialized from
    
        <root>
            <one/>
            <two/>
            <three/>
            <node/>
        </root>
    
    The following tests were fixed (10):
        seq::variable_name::fixed_size::field_after_list::after
        seq::variable_name::fixed_size::field_after_list::before
        seq::variable_name::fixed_size::field_before_list::after
        seq::variable_name::fixed_size::field_before_list::before
        seq::variable_name::fixed_size::two_lists::choice_and_fixed::fixed_after
        seq::variable_name::fixed_size::two_lists::choice_and_fixed::fixed_before
        seq::variable_name::fixed_size::two_lists::fixed_and_choice::fixed_after
        seq::variable_name::fixed_size::two_lists::fixed_and_choice::fixed_before
        seq::variable_name::variable_size::field_after_list::before
        seq::variable_name::variable_size::field_before_list::before
    
    failures (26):
        seq::fixed_name::fixed_size::field_after_list::overlapped
        seq::fixed_name::fixed_size::field_before_list::overlapped
        seq::fixed_name::fixed_size::two_lists::overlapped
        seq::fixed_name::fixed_size::unknown_items::overlapped
        seq::fixed_name::variable_size::field_after_list::overlapped
        seq::fixed_name::variable_size::field_before_list::overlapped
        seq::fixed_name::variable_size::two_lists::overlapped
        seq::fixed_name::variable_size::unknown_items::overlapped
        seq::variable_name::fixed_size::field_after_list::overlapped
        seq::variable_name::fixed_size::field_before_list::overlapped
        seq::variable_name::fixed_size::two_lists::choice_and_fixed::overlapped_fixed_after
        seq::variable_name::fixed_size::two_lists::choice_and_fixed::overlapped_fixed_before
        seq::variable_name::fixed_size::two_lists::fixed_and_choice::overlapped_fixed_after
        seq::variable_name::fixed_size::two_lists::fixed_and_choice::overlapped_fixed_before
        seq::variable_name::variable_size::field_after_list::after
        seq::variable_name::variable_size::field_after_list::overlapped
        seq::variable_name::variable_size::field_before_list::after
        seq::variable_name::variable_size::field_before_list::overlapped
        seq::variable_name::variable_size::two_lists::choice_and_fixed::fixed_after
        seq::variable_name::variable_size::two_lists::choice_and_fixed::fixed_before
        seq::variable_name::variable_size::two_lists::choice_and_fixed::overlapped_fixed_after
        seq::variable_name::variable_size::two_lists::choice_and_fixed::overlapped_fixed_before
        seq::variable_name::variable_size::two_lists::fixed_and_choice::fixed_after
        seq::variable_name::variable_size::two_lists::fixed_and_choice::fixed_before
        seq::variable_name::variable_size::two_lists::fixed_and_choice::overlapped_fixed_after
        seq::variable_name::variable_size::two_lists::fixed_and_choice::overlapped_fixed_before
    
    Co-authored-by: Daniel Alley <dalley@redhat.com>
    Mingun and dralley committed Jun 2, 2022
    Copy the full SHA
    55f541b View commit details
    Browse the repository at this point in the history

Commits on Jun 5, 2022

  1. seq: Split sequence accessors for top-level access and in-map access

    The following tests were fixed (6):
        seq::variable_name::variable_size::field_after_list::after
        seq::variable_name::variable_size::field_before_list::after
        seq::variable_name::variable_size::two_lists::choice_and_fixed::fixed_after
        seq::variable_name::variable_size::two_lists::choice_and_fixed::fixed_before
        seq::variable_name::variable_size::two_lists::fixed_and_choice::fixed_after
        seq::variable_name::variable_size::two_lists::fixed_and_choice::fixed_before
    
    failures (20):
        seq::fixed_name::fixed_size::field_after_list::overlapped
        seq::fixed_name::fixed_size::field_before_list::overlapped
        seq::fixed_name::fixed_size::two_lists::overlapped
        seq::fixed_name::fixed_size::unknown_items::overlapped
        seq::fixed_name::variable_size::field_after_list::overlapped
        seq::fixed_name::variable_size::field_before_list::overlapped
        seq::fixed_name::variable_size::two_lists::overlapped
        seq::fixed_name::variable_size::unknown_items::overlapped
        seq::variable_name::fixed_size::field_after_list::overlapped
        seq::variable_name::fixed_size::field_before_list::overlapped
        seq::variable_name::fixed_size::two_lists::choice_and_fixed::overlapped_fixed_after
        seq::variable_name::fixed_size::two_lists::choice_and_fixed::overlapped_fixed_before
        seq::variable_name::fixed_size::two_lists::fixed_and_choice::overlapped_fixed_after
        seq::variable_name::fixed_size::two_lists::fixed_and_choice::overlapped_fixed_before
        seq::variable_name::variable_size::field_after_list::overlapped
        seq::variable_name::variable_size::field_before_list::overlapped
        seq::variable_name::variable_size::two_lists::choice_and_fixed::overlapped_fixed_after
        seq::variable_name::variable_size::two_lists::choice_and_fixed::overlapped_fixed_before
        seq::variable_name::variable_size::two_lists::fixed_and_choice::overlapped_fixed_after
        seq::variable_name::variable_size::two_lists::fixed_and_choice::overlapped_fixed_before
    
    Co-authored-by: Daniel Alley <dalley@redhat.com>
    Mingun and dralley committed Jun 5, 2022
    Copy the full SHA
    6a52ecc View commit details
    Browse the repository at this point in the history
  2. seq: Move has_value_field into MapAccess, because it is not used …

    …outside it
    
    This fixes a data race with nested maps in sequence fields.
    Also, top-level sequences always have `has_value_field == false`,
    so no need to check it
    
    Co-authored-by: Daniel Alley <dalley@redhat.com>
    Mingun and dralley committed Jun 5, 2022
    Copy the full SHA
    1142da4 View commit details
    Browse the repository at this point in the history
  3. seq: Allow overlapping between list items and other items

    Example of such XML:
    
      <item/>
      <another-item/>
      <item/>
      <item/>
    
    Here we need to skip `<another-item/>` in order to collect all `<item/>`s.
    So ability to skip events and replay them later was added
    
    This fixes all remaining tests
    
    Co-authored-by: Daniel Alley <dalley@redhat.com>
    Mingun and dralley committed Jun 5, 2022
    Copy the full SHA
    7a356ec View commit details
    Browse the repository at this point in the history
  4. seq: Allow to limit number of skipped events to prevent huge memory c…

    …onsumption
    
    Co-authored-by: Daniel Alley <dalley@redhat.com>
    Mingun and dralley committed Jun 5, 2022
    Copy the full SHA
    59a5c76 View commit details
    Browse the repository at this point in the history