[GH1] replace globs with patterns that mergebot can process (#81414)

https://github.com/pytorch/pytorch/pull/81330#issuecomment-1182345751 shouldn't have happened and should have matched the linalg rule.

The reason it happened is cuz we don't treat the patterns like globs.

We may follow this up with a BE change to make the patterns be treated more like globs, which I expected originally.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/81414
Approved by: https://github.com/malfet
This commit is contained in:
Jane Xu
2022-07-19 16:11:32 +00:00
committed by PyTorch MergeBot
parent 270069cfb9
commit c67a4d8a65
3 changed files with 26 additions and 14 deletions

View File

@ -1,5 +1,5 @@
#!/usr/bin/env python3
from gitutils import PeekableIterator
from gitutils import PeekableIterator, patterns_to_regex
from unittest import TestCase, main
class TestPeekableIterator(TestCase):
@ -22,6 +22,18 @@ class TestPeekableIterator(TestCase):
self.assertTrue(iter_.peek() is None)
class TestPattern(TestCase):
def test_double_asterisks(self) -> None:
allowed_patterns = [
"aten/src/ATen/native/**LinearAlgebra*",
]
patterns_re = patterns_to_regex(allowed_patterns)
fnames = [
"aten/src/ATen/native/LinearAlgebra.cpp",
"aten/src/ATen/native/cpu/LinearAlgebraKernel.cpp"]
for filename in fnames:
self.assertTrue(patterns_re.match(filename))
if __name__ == '__main__':
main()