summaryrefslogtreecommitdiff
path: root/utils/semver
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2024-08-04 14:50:35 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2024-08-05 19:37:29 +0300
commit8af95d6854889dc66746429ccf8888e3a81f6baf (patch)
tree446da71d679b2f102a53745dda474b3326e038e9 /utils/semver
parent57396a0e3f08a5cd1ea6f48c66f3decdfeaa7dfd (diff)
utils: checkstyle.py: Warn when no valid Signed-off-by line is found
All commits to libcamera must include a Signed-off-by line, and that rule is enforced through git hooks and CI. This however doesn't prevent patches from being submitted without an SoB tag, as noticed multiple times in the past. Extend the checkstyle.py trailer checker to issue a warning when the SoB line is missing to try and improve the situation. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Milan Zamazal <mzamazal@redhat.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'utils/semver')
0 files changed, 0 insertions, 0 deletions
#n78'>78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
# Copyright 2020 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

from mojom_parser_test_case import MojomParserTestCase

from mojom.generate import module


class StableAttributeTest(MojomParserTestCase):
  """Tests covering usage of the [Stable] attribute."""

  def testStableAttributeTagging(self):
    """Verify that we recognize the [Stable] attribute on relevant definitions
    and the resulting parser outputs are tagged accordingly."""
    mojom = 'test.mojom'
    self.WriteFile(
        mojom, """\
        [Stable] enum TestEnum { kFoo };
        enum UnstableEnum { kBar };
        [Stable] struct TestStruct { TestEnum a; };
        struct UnstableStruct { UnstableEnum a; };
        [Stable] union TestUnion { TestEnum a; TestStruct b; };
        union UnstableUnion { UnstableEnum a; UnstableStruct b; };
        [Stable] interface TestInterface { Foo@0(TestUnion x) => (); };
        interface UnstableInterface { Foo(UnstableUnion x) => (); };
        """)
    self.ParseMojoms([mojom])

    m = self.LoadModule(mojom)
    self.assertEqual(2, len(m.enums))
    self.assertTrue(m.enums[0].stable)
    self.assertFalse(m.enums[1].stable)
    self.assertEqual(2, len(m.structs))
    self.assertTrue(m.structs[0].stable)
    self.assertFalse(m.structs[1].stable)
    self.assertEqual(2, len(m.unions))
    self.assertTrue(m.unions[0].stable)
    self.assertFalse(m.unions[1].stable)
    self.assertEqual(2, len(m.interfaces))
    self.assertTrue(m.interfaces[0].stable)
    self.assertFalse(m.interfaces[1].stable)

  def testStableStruct(self):
    """A [Stable] struct is valid if all its fields are also stable."""
    self.ExtractTypes('[Stable] struct S {};')
    self.ExtractTypes('[Stable] struct S { int32 x; bool b; };')
    self.ExtractTypes('[Stable] enum E { A }; [Stable] struct S { E e; };')