[llvm-commits] [PATCH] GTestFormat should find "*Test" in the source root
Daniel Dunbar
daniel at zuster.org
Tue Jan 29 12:13:27 PST 2013
Comments:
1. I have a marginal preference for yielding from the getTestsInExecutable
iterator instead of collecting in a list.
2. I am having trouble understanding what the code is trying to do, but I
now that I am reading the current version I don't understand it either, so
that is probably not a problem with the patch. If it fixes a problem with
compiler-rt and you tested with LLVM's unit tests then I am fine with it.
- Daniel
On Mon, Jan 28, 2013 at 6:41 AM, Alexey Samsonov <samsonov at google.com>wrote:
> Hi chapuni,
>
> This patch makes llvm-lit test discoverer work correctly
> if "test_sub_dir" attribute contains a "." subdirectory. This is
> necessary to fix compiler-rt unittests after r173617.
>
> http://llvm-reviews.chandlerc.com/D337
>
> Files:
> utils/lit/lit/TestFormats.py
>
> Index: utils/lit/lit/TestFormats.py
> ===================================================================
> --- utils/lit/lit/TestFormats.py
> +++ utils/lit/lit/TestFormats.py
> @@ -54,28 +54,37 @@
> else:
> yield ''.join(nested_tests) + ln
>
> + def getTestsInExecutable(self, testSuite, path_in_suite, execpath,
> + litConfig, localConfig):
> + if not execpath.endswith(self.test_suffix):
> + return
> + (dirname, basename) = os.path.split(execpath)
> + # Discover the tests in this executable.
> + for testname in self.getGTestTests(execpath, litConfig,
> localConfig):
> + testPath = path_in_suite + (dirname, basename, testname)
> + yield Test.Test(testSuite, testPath, localConfig)
> +
> def getTestsInDirectory(self, testSuite, path_in_suite,
> litConfig, localConfig):
> source_path = testSuite.getSourcePath(path_in_suite)
> + all_tests = []
> for filename in os.listdir(source_path):
> - # Check for the one subdirectory (build directory) tests will
> be in.
> - if not '.' in self.test_sub_dir:
> + filepath = os.path.join(source_path, filename)
> + if os.path.isdir(filepath):
> + # Iterate over executables in a directory.
> if not os.path.normcase(filename) in self.test_sub_dir:
> continue
> -
> - filepath = os.path.join(source_path, filename)
> - if not os.path.isdir(filepath):
> - continue
> -
> - for subfilename in os.listdir(filepath):
> - if subfilename.endswith(self.test_suffix):
> + for subfilename in os.listdir(filepath):
> execpath = os.path.join(filepath, subfilename)
> -
> - # Discover the tests in this executable.
> - for name in self.getGTestTests(execpath, litConfig,
> - localConfig):
> - testPath = path_in_suite + (filename,
> subfilename, name)
> - yield Test.Test(testSuite, testPath, localConfig)
> + all_tests += self.getTestsInExecutable(
> + testSuite, path_in_suite, execpath,
> + litConfig, localConfig)
> + elif ('.' in self.test_sub_dir):
> + all_tests += self.getTestsInExecutable(
> + testSuite, path_in_suite, filepath,
> + litConfig, localConfig)
> + for test in all_tests:
> + yield test
>
> def execute(self, test, litConfig):
> testPath,testName = os.path.split(test.getSourcePath())
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130129/66b65d8e/attachment.html>
More information about the llvm-commits
mailing list