[disabled tests] fix bug that reads non-source binary files instead of only those with restricted file extensions

Change-Id: Ieb8c7a09838f68d137ebe18148c4cba2086d76e9
Reviewed-on: https://fuchsia-review.googlesource.com/c/infra/recipes/+/683732
Reviewed-by: Danielle Kay <danikay@google.com>
Commit-Queue: Danielle Kay <danikay@google.com>
Reviewed-by: Rob Mohr <mohrr@google.com>
Reviewed-by: Oliver Newman <olivernewman@google.com>
diff --git a/recipes/disabled_tests.resources/find_disabled_tests.py b/recipes/disabled_tests.resources/find_disabled_tests.py
index f48b678..fbc4c22 100755
--- a/recipes/disabled_tests.resources/find_disabled_tests.py
+++ b/recipes/disabled_tests.resources/find_disabled_tests.py
@@ -17,10 +17,10 @@
 import unittest
 import re
 
-RUST_EXT = "rs"
-DART_EXT = "dart"
-BUILD_EXT = "gn"
-C_EXT = "cc"
+RUST_EXT = ".rs"
+DART_EXT = ".dart"
+BUILD_EXT = ".gn"
+C_EXT = ".cc"
 TODO_ENABLE = re.compile(r"^(\/\/|\#).*(TODO).*(enable|disable).*(test|flake).*")
 FXB_REGEX = re.compile(r"fxb.*\/(\d+)")
 DISABLED_CC_TEST = "DISABLED_"
@@ -42,8 +42,8 @@
         dirs[:] = [d for d in dirs if d not in exclude]
         for filename in files:
             fname = os.path.join(dirpath, filename)
-            if fname.endswith((RUST_EXT, DART_EXT, BUILD_EXT, C_EXT)):
-                file_ext = os.path.splitext(filename)[1]
+            file_ext = os.path.splitext(filename)[1]
+            if file_ext in (RUST_EXT, DART_EXT, BUILD_EXT, C_EXT):
                 find_disabled_tests(fname, disabled_tests, curpath, file_ext)
 
     with open(tmp_json, "w") as f: