[libcxx-commits] [libcxx] 7efbd85 - [libc++] Add a new FILE_DEPENDENCIES parser

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Fri Mar 20 11:56:11 PDT 2020


Author: Louis Dionne
Date: 2020-03-20T14:55:52-04:00
New Revision: 7efbd851adf3124f7e756c37348ddd3ff7427ad7

URL: https://github.com/llvm/llvm-project/commit/7efbd851adf3124f7e756c37348ddd3ff7427ad7
DIFF: https://github.com/llvm/llvm-project/commit/7efbd851adf3124f7e756c37348ddd3ff7427ad7.diff

LOG: [libc++] Add a new FILE_DEPENDENCIES parser

Instead of considering all the .dat files to be dependencies of a test,
only consider those that are listed in FILE_DEPENDENCIES.

Added: 
    

Modified: 
    libcxx/test/libcxx/input.output/file.streams/fstreams/ifstream.cons/wchar_pointer.pass.cpp
    libcxx/test/libcxx/input.output/file.streams/fstreams/ifstream.members/open_wchar_pointer.pass.cpp
    libcxx/test/std/input.output/file.streams/fstreams/filebuf.virtuals/seekoff.pass.cpp
    libcxx/test/std/input.output/file.streams/fstreams/filebuf.virtuals/underflow.pass.cpp
    libcxx/test/std/input.output/file.streams/fstreams/ifstream.assign/member_swap.pass.cpp
    libcxx/test/std/input.output/file.streams/fstreams/ifstream.assign/move_assign.pass.cpp
    libcxx/test/std/input.output/file.streams/fstreams/ifstream.assign/nonmember_swap.pass.cpp
    libcxx/test/std/input.output/file.streams/fstreams/ifstream.cons/move.pass.cpp
    libcxx/test/std/input.output/file.streams/fstreams/ifstream.cons/path.pass.cpp
    libcxx/test/std/input.output/file.streams/fstreams/ifstream.cons/pointer.pass.cpp
    libcxx/test/std/input.output/file.streams/fstreams/ifstream.cons/string.pass.cpp
    libcxx/test/std/input.output/file.streams/fstreams/ifstream.members/close.pass.cpp
    libcxx/test/std/input.output/file.streams/fstreams/ifstream.members/open_path.pass.cpp
    libcxx/test/std/input.output/file.streams/fstreams/ifstream.members/open_pointer.pass.cpp
    libcxx/test/std/input.output/file.streams/fstreams/ifstream.members/open_string.pass.cpp
    libcxx/test/std/input.output/file.streams/fstreams/ifstream.members/rdbuf.pass.cpp
    libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/pbackfail.pass.cpp
    libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/underflow.pass.cpp
    libcxx/utils/libcxx/test/format.py

Removed: 
    


################################################################################
diff  --git a/libcxx/test/libcxx/input.output/file.streams/fstreams/ifstream.cons/wchar_pointer.pass.cpp b/libcxx/test/libcxx/input.output/file.streams/fstreams/ifstream.cons/wchar_pointer.pass.cpp
index 9dd79a1f87c6..1f6956e7a7e6 100644
--- a/libcxx/test/libcxx/input.output/file.streams/fstreams/ifstream.cons/wchar_pointer.pass.cpp
+++ b/libcxx/test/libcxx/input.output/file.streams/fstreams/ifstream.cons/wchar_pointer.pass.cpp
@@ -13,6 +13,8 @@
 
 // explicit basic_ifstream(const wchar_t* s, ios_base::openmode mode = ios_base::in);
 
+// FILE_DEPENDENCIES: test.dat
+
 #include <fstream>
 #include <cassert>
 

diff  --git a/libcxx/test/libcxx/input.output/file.streams/fstreams/ifstream.members/open_wchar_pointer.pass.cpp b/libcxx/test/libcxx/input.output/file.streams/fstreams/ifstream.members/open_wchar_pointer.pass.cpp
index 226cf8d83271..7d91b6d6d095 100644
--- a/libcxx/test/libcxx/input.output/file.streams/fstreams/ifstream.members/open_wchar_pointer.pass.cpp
+++ b/libcxx/test/libcxx/input.output/file.streams/fstreams/ifstream.members/open_wchar_pointer.pass.cpp
@@ -13,6 +13,8 @@
 
 // void open(const wchar_t* s, ios_base::openmode mode = ios_base::in);
 
+// FILE_DEPENDENCIES: test.dat
+
 #include <fstream>
 #include <cassert>
 

diff  --git a/libcxx/test/std/input.output/file.streams/fstreams/filebuf.virtuals/seekoff.pass.cpp b/libcxx/test/std/input.output/file.streams/fstreams/filebuf.virtuals/seekoff.pass.cpp
index 6f50357a093d..f9e8938da9ee 100644
--- a/libcxx/test/std/input.output/file.streams/fstreams/filebuf.virtuals/seekoff.pass.cpp
+++ b/libcxx/test/std/input.output/file.streams/fstreams/filebuf.virtuals/seekoff.pass.cpp
@@ -13,6 +13,8 @@
 // pos_type seekpos(pos_type sp,
 //                  ios_base::openmode which = ios_base::in | ios_base::out);
 
+// FILE_DEPENDENCIES: underflow.dat
+
 #include <fstream>
 #include <cassert>
 

diff  --git a/libcxx/test/std/input.output/file.streams/fstreams/filebuf.virtuals/underflow.pass.cpp b/libcxx/test/std/input.output/file.streams/fstreams/filebuf.virtuals/underflow.pass.cpp
index 1e3029a4edcf..0d1f7a384a9e 100644
--- a/libcxx/test/std/input.output/file.streams/fstreams/filebuf.virtuals/underflow.pass.cpp
+++ b/libcxx/test/std/input.output/file.streams/fstreams/filebuf.virtuals/underflow.pass.cpp
@@ -7,6 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 // REQUIRES: locale.en_US.UTF-8
+// FILE_DEPENDENCIES: underflow.dat, underflow_utf8.dat
 
 // <fstream>
 

diff  --git a/libcxx/test/std/input.output/file.streams/fstreams/ifstream.assign/member_swap.pass.cpp b/libcxx/test/std/input.output/file.streams/fstreams/ifstream.assign/member_swap.pass.cpp
index 7832464b8e06..7a5d9c18d174 100644
--- a/libcxx/test/std/input.output/file.streams/fstreams/ifstream.assign/member_swap.pass.cpp
+++ b/libcxx/test/std/input.output/file.streams/fstreams/ifstream.assign/member_swap.pass.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// FILE_DEPENDENCIES: test.dat, test2.dat
+
 // <fstream>
 
 // template <class charT, class traits = char_traits<charT> >

diff  --git a/libcxx/test/std/input.output/file.streams/fstreams/ifstream.assign/move_assign.pass.cpp b/libcxx/test/std/input.output/file.streams/fstreams/ifstream.assign/move_assign.pass.cpp
index ec50ec686bb5..115703c95701 100644
--- a/libcxx/test/std/input.output/file.streams/fstreams/ifstream.assign/move_assign.pass.cpp
+++ b/libcxx/test/std/input.output/file.streams/fstreams/ifstream.assign/move_assign.pass.cpp
@@ -7,6 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++98, c++03
+// FILE_DEPENDENCIES: test.dat
 
 // <fstream>
 

diff  --git a/libcxx/test/std/input.output/file.streams/fstreams/ifstream.assign/nonmember_swap.pass.cpp b/libcxx/test/std/input.output/file.streams/fstreams/ifstream.assign/nonmember_swap.pass.cpp
index 587dcc23d2fe..f04c5e4b52da 100644
--- a/libcxx/test/std/input.output/file.streams/fstreams/ifstream.assign/nonmember_swap.pass.cpp
+++ b/libcxx/test/std/input.output/file.streams/fstreams/ifstream.assign/nonmember_swap.pass.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// FILE_DEPENDENCIES: test.dat, test2.dat
+
 // <fstream>
 
 // template <class charT, class traits = char_traits<charT> >

diff  --git a/libcxx/test/std/input.output/file.streams/fstreams/ifstream.cons/move.pass.cpp b/libcxx/test/std/input.output/file.streams/fstreams/ifstream.cons/move.pass.cpp
index ac19eea943d8..af99878aefd8 100644
--- a/libcxx/test/std/input.output/file.streams/fstreams/ifstream.cons/move.pass.cpp
+++ b/libcxx/test/std/input.output/file.streams/fstreams/ifstream.cons/move.pass.cpp
@@ -7,6 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++98, c++03
+// FILE_DEPENDENCIES: test.dat
 
 // <fstream>
 

diff  --git a/libcxx/test/std/input.output/file.streams/fstreams/ifstream.cons/path.pass.cpp b/libcxx/test/std/input.output/file.streams/fstreams/ifstream.cons/path.pass.cpp
index 52a367047e22..d43306798280 100644
--- a/libcxx/test/std/input.output/file.streams/fstreams/ifstream.cons/path.pass.cpp
+++ b/libcxx/test/std/input.output/file.streams/fstreams/ifstream.cons/path.pass.cpp
@@ -8,6 +8,7 @@
 
 // UNSUPPORTED: c++98, c++03, c++11, c++14
 // XFAIL: dylib-has-no-filesystem
+// FILE_DEPENDENCIES: test.dat
 
 // <fstream>
 

diff  --git a/libcxx/test/std/input.output/file.streams/fstreams/ifstream.cons/pointer.pass.cpp b/libcxx/test/std/input.output/file.streams/fstreams/ifstream.cons/pointer.pass.cpp
index 577670106cff..e6674255e50b 100644
--- a/libcxx/test/std/input.output/file.streams/fstreams/ifstream.cons/pointer.pass.cpp
+++ b/libcxx/test/std/input.output/file.streams/fstreams/ifstream.cons/pointer.pass.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// FILE_DEPENDENCIES: test.dat
+
 // <fstream>
 
 // template <class charT, class traits = char_traits<charT> >

diff  --git a/libcxx/test/std/input.output/file.streams/fstreams/ifstream.cons/string.pass.cpp b/libcxx/test/std/input.output/file.streams/fstreams/ifstream.cons/string.pass.cpp
index c1ab706dd4f4..f0e96256e267 100644
--- a/libcxx/test/std/input.output/file.streams/fstreams/ifstream.cons/string.pass.cpp
+++ b/libcxx/test/std/input.output/file.streams/fstreams/ifstream.cons/string.pass.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// FILE_DEPENDENCIES: test.dat
+
 // <fstream>
 
 // template <class charT, class traits = char_traits<charT> >

diff  --git a/libcxx/test/std/input.output/file.streams/fstreams/ifstream.members/close.pass.cpp b/libcxx/test/std/input.output/file.streams/fstreams/ifstream.members/close.pass.cpp
index 9bd4f723c12d..3641dfdc15ac 100644
--- a/libcxx/test/std/input.output/file.streams/fstreams/ifstream.members/close.pass.cpp
+++ b/libcxx/test/std/input.output/file.streams/fstreams/ifstream.members/close.pass.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// FILE_DEPENDENCIES: test.dat
+
 // <fstream>
 
 // template <class charT, class traits = char_traits<charT> >

diff  --git a/libcxx/test/std/input.output/file.streams/fstreams/ifstream.members/open_path.pass.cpp b/libcxx/test/std/input.output/file.streams/fstreams/ifstream.members/open_path.pass.cpp
index 9d30e8ece52c..c3486634e48f 100644
--- a/libcxx/test/std/input.output/file.streams/fstreams/ifstream.members/open_path.pass.cpp
+++ b/libcxx/test/std/input.output/file.streams/fstreams/ifstream.members/open_path.pass.cpp
@@ -8,6 +8,7 @@
 
 // UNSUPPORTED: c++98, c++03, c++11, c++14
 // XFAIL: dylib-has-no-filesystem
+// FILE_DEPENDENCIES: test.dat
 
 // <fstream>
 

diff  --git a/libcxx/test/std/input.output/file.streams/fstreams/ifstream.members/open_pointer.pass.cpp b/libcxx/test/std/input.output/file.streams/fstreams/ifstream.members/open_pointer.pass.cpp
index fd2adba4398f..4626f968e53d 100644
--- a/libcxx/test/std/input.output/file.streams/fstreams/ifstream.members/open_pointer.pass.cpp
+++ b/libcxx/test/std/input.output/file.streams/fstreams/ifstream.members/open_pointer.pass.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// FILE_DEPENDENCIES: test.dat
+
 // <fstream>
 
 // template <class charT, class traits = char_traits<charT> >

diff  --git a/libcxx/test/std/input.output/file.streams/fstreams/ifstream.members/open_string.pass.cpp b/libcxx/test/std/input.output/file.streams/fstreams/ifstream.members/open_string.pass.cpp
index b5fd9fc5522a..35722d52849f 100644
--- a/libcxx/test/std/input.output/file.streams/fstreams/ifstream.members/open_string.pass.cpp
+++ b/libcxx/test/std/input.output/file.streams/fstreams/ifstream.members/open_string.pass.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// FILE_DEPENDENCIES: test.dat
+
 // <fstream>
 
 // template <class charT, class traits = char_traits<charT> >

diff  --git a/libcxx/test/std/input.output/file.streams/fstreams/ifstream.members/rdbuf.pass.cpp b/libcxx/test/std/input.output/file.streams/fstreams/ifstream.members/rdbuf.pass.cpp
index c09f76161ef8..aa6cbb20f1af 100644
--- a/libcxx/test/std/input.output/file.streams/fstreams/ifstream.members/rdbuf.pass.cpp
+++ b/libcxx/test/std/input.output/file.streams/fstreams/ifstream.members/rdbuf.pass.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// FILE_DEPENDENCIES: test.dat
+
 // <fstream>
 
 // template <class charT, class traits = char_traits<charT> >

diff  --git a/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/pbackfail.pass.cpp b/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/pbackfail.pass.cpp
index d8e60c0d85ad..264a67ee530f 100644
--- a/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/pbackfail.pass.cpp
+++ b/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/pbackfail.pass.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// FILE_DEPENDENCIES: underflow.dat
+
 // <locale>
 
 // wbuffer_convert<Codecvt, Elem, Tr>

diff  --git a/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/underflow.pass.cpp b/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/underflow.pass.cpp
index 0b25e139efc3..6642488cf0c9 100644
--- a/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/underflow.pass.cpp
+++ b/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/underflow.pass.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// FILE_DEPENDENCIES: underflow.dat, underflow_utf8.dat
+
 // <locale>
 
 // wbuffer_convert<Codecvt, Elem, Tr>

diff  --git a/libcxx/utils/libcxx/test/format.py b/libcxx/utils/libcxx/test/format.py
index 55f179a20e15..4f7283d04f3a 100644
--- a/libcxx/utils/libcxx/test/format.py
+++ b/libcxx/utils/libcxx/test/format.py
@@ -41,12 +41,14 @@ def __init__(self, cxx, use_verify_for_fail, execute_external,
         self.exec_env = dict(exec_env)
 
     @staticmethod
-    def _make_custom_parsers():
+    def _make_custom_parsers(test):
         return [
             IntegratedTestKeywordParser('FLAKY_TEST.', ParserKind.TAG,
                                         initial_value=False),
             IntegratedTestKeywordParser('MODULES_DEFINES:', ParserKind.LIST,
-                                        initial_value=[])
+                                        initial_value=[]),
+            IntegratedTestKeywordParser('FILE_DEPENDENCIES:', ParserKind.LIST,
+                                        initial_value=test.file_dependencies)
         ]
 
     @staticmethod
@@ -102,7 +104,8 @@ def _execute(self, test, lit_config):
            'objective-c++' in test.config.available_features:
             return (lit.Test.UNSUPPORTED, "Objective-C++ is not supported")
 
-        parsers = self._make_custom_parsers()
+        setattr(test, 'file_dependencies', [])
+        parsers = self._make_custom_parsers(test)
         script = lit.TestRunner.parseIntegratedTestScript(
             test, additional_parsers=parsers, require_script=is_sh_test)
         # Check if a result for the test was returned. If so return that
@@ -193,12 +196,7 @@ def _evaluate_pass_test(self, test, tmpBase, lit_config,
             env = None
             if self.exec_env:
                 env = self.exec_env
-            # TODO: Only list actually needed files in file_deps.
-            # Right now we just mark all of the .dat files in the same
-            # directory as dependencies, but it's likely less than that. We
-            # should add a `// FILE-DEP: foo.dat` to each test to track this.
-            data_files = [os.path.join(local_cwd, f)
-                          for f in os.listdir(local_cwd) if f.endswith('.dat')]
+            data_files = [os.path.join(local_cwd, f) for f in test.file_dependencies]
             is_flaky = self._get_parser('FLAKY_TEST.', parsers).getValue()
             max_retry = 3 if is_flaky else 1
             for retry_count in range(max_retry):


        


More information about the libcxx-commits mailing list