Skip to content

Commit d7237d5

Browse files
committed
[External] Some more fixes
1 parent 97602db commit d7237d5

File tree

5 files changed

+479
-0
lines changed

5 files changed

+479
-0
lines changed

external/llvm-project/llvm/cmake/modules/HandleLLVMOptions.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -599,6 +599,10 @@ if( MSVC )
599599
append("/WX" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
600600
endif (LLVM_ENABLE_WERROR)
601601

602+
# FIXME(kzhuravl): Need to check if it affects windows ci builds. If yes,
603+
# we might need to upstream this, possibly under a cmake option.
604+
append("/Zm20" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
605+
602606
append("/Zc:inline" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
603607

604608
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from lit.formats.base import ( # noqa: F401
2+
TestFormat,
3+
FileBasedTest,
4+
ExecutableTest,
5+
)
6+
7+
from lit.formats.googletest import GoogleTest # noqa: F401
8+
from lit.formats.shtest import ShTest # noqa: F401
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
from __future__ import absolute_import
2+
import os
3+
4+
import lit.Test
5+
import lit.util
6+
7+
8+
class TestFormat(object):
9+
def getTestsForPath(self, testSuite, path_in_suite, litConfig, localConfig):
10+
"""
11+
Given the path to a test in the test suite, generates the Lit tests associated
12+
to that path. There can be zero, one or more tests. For example, some testing
13+
formats allow expanding a single path in the test suite into multiple Lit tests
14+
(e.g. they are generated on the fly).
15+
16+
Note that this method is only used when Lit needs to actually perform test
17+
discovery, which is not the case for configs with standalone tests.
18+
"""
19+
yield lit.Test.Test(testSuite, path_in_suite, localConfig)
20+
21+
###
22+
23+
24+
class FileBasedTest(TestFormat):
25+
def getTestsForPath(self, testSuite, path_in_suite, litConfig, localConfig):
26+
"""
27+
Expand each path in a test suite to a Lit test using that path and assuming
28+
it is a file containing the test. File extensions excluded by the configuration
29+
or not contained in the allowed extensions are ignored.
30+
"""
31+
filename = path_in_suite[-1]
32+
33+
# Ignore dot files and excluded tests.
34+
if filename.startswith(".") or filename in localConfig.excludes:
35+
return
36+
37+
base, ext = os.path.splitext(filename)
38+
if ext in localConfig.suffixes:
39+
yield lit.Test.Test(testSuite, path_in_suite, localConfig)
40+
41+
def getTestsInDirectory(self, testSuite, path_in_suite, litConfig, localConfig):
42+
source_path = testSuite.getSourcePath(path_in_suite)
43+
for filename in os.listdir(source_path):
44+
filepath = os.path.join(source_path, filename)
45+
if not os.path.isdir(filepath):
46+
for t in self.getTestsForPath(testSuite, path_in_suite + (filename,), litConfig, localConfig):
47+
yield t
48+
49+
50+
###
51+
52+
# Check exit code of a simple executable with no input
53+
class ExecutableTest(FileBasedTest):
54+
def execute(self, test, litConfig):
55+
if test.config.unsupported:
56+
return lit.Test.UNSUPPORTED
57+
58+
out, err, exitCode = lit.util.executeCommand(test.getSourcePath())
59+
60+
if not exitCode:
61+
return lit.Test.PASS, ""
62+
63+
return lit.Test.FAIL, out + err

0 commit comments

Comments
 (0)