Bug 1496238 - Part 2: Allow BinAST directives files in jit_tests. (r=Waldo)
authorEric Faust <efausbmo@gmail.com>
Tue, 09 Oct 2018 14:17:43 -0700
changeset 488596 4d07362984d4e00ef10251fa54e652426d87bfcf
parent 488595 105ad7200afcc1ed4429dfae3f0a62e29925db02
child 488658 38890d8fa2542082eafe6e16dfc26b87d42ade94
push id246
push userfmarier@mozilla.com
push dateSat, 13 Oct 2018 00:15:40 +0000
reviewersWaldo
bugs1496238
milestone64.0a1
Bug 1496238 - Part 2: Allow BinAST directives files in jit_tests. (r=Waldo)
js/src/tests/lib/jittests.py
--- a/js/src/tests/lib/jittests.py
+++ b/js/src/tests/lib/jittests.py
@@ -222,22 +222,26 @@ class JitTest:
         if dir_name in cls.Directives:
             dir_meta = cls.Directives[dir_name]
         else:
             meta_file_name = os.path.join(dir_name, "directives.txt")
             if os.path.exists(meta_file_name):
                 dir_meta = cls.find_directives(meta_file_name)
             cls.Directives[dir_name] = dir_meta
 
-        file_extension = os.path.splitext(path)[1]
+        filename, file_extension = os.path.splitext(path)
         if file_extension == '.binjs':
             # BinAST does not have an inline comment format, so it's hard
-            # to parse file-by-file directives. In future, we can look for
-            # an adjacent test-specific directives file, if we want.
-            meta = ''
+            # to parse file-by-file directives. Allow foo.binjs to use foo.dir
+            # as an adjacent file to specify.
+            meta_file_name = filename + '.dir'
+            if os.path.exists(meta_file_name):
+                meta = cls.find_directives(meta_file_name)
+            else:
+                meta = ''
             test.is_binast = True
         else:
             meta = cls.find_directives(path)
 
         if meta != '' or dir_meta != '':
             meta = meta + dir_meta
             parts = meta.split(';')
             for part in parts: