mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-27 19:16:04 +00:00
[libc++] Add support for .compile.pass.mm and .link.pass.mm tests
Differential Revision: https://reviews.llvm.org/D145193
This commit is contained in:
parent
75ddabd520
commit
a76d781881
@ -0,0 +1,18 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// REQUIRES: objective-c++
|
||||
|
||||
// XFAIL: *
|
||||
|
||||
// Make sure the test DOES NOT pass if it fails at compile-time
|
||||
|
||||
struct Foo { };
|
||||
typedef Foo::x x;
|
||||
|
||||
int main(int, char**) { return 0; }
|
@ -0,0 +1,16 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// REQUIRES: objective-c++
|
||||
|
||||
// Make sure the test passes if it succeeds to compile
|
||||
|
||||
@interface I;
|
||||
@end
|
||||
|
||||
int main(int, char**) { return 0; }
|
@ -0,0 +1,21 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// REQUIRES: objective-c++
|
||||
|
||||
// Make sure the test passes even if there's a link error, i.e. it isn't linked.
|
||||
|
||||
@interface I;
|
||||
@end
|
||||
|
||||
extern void this_is_an_undefined_symbol();
|
||||
|
||||
int main(int, char**) {
|
||||
this_is_an_undefined_symbol();
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// REQUIRES: objective-c++
|
||||
|
||||
// Make sure the test passes even if there's a runtime error, i.e. it isn't run.
|
||||
|
||||
@interface I;
|
||||
@end
|
||||
|
||||
int main(int, char**) {
|
||||
return 1;
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// REQUIRES: objective-c++
|
||||
|
||||
// XFAIL: *
|
||||
|
||||
// Make sure the test DOES NOT pass if it fails at compile-time.
|
||||
|
||||
struct Foo { };
|
||||
typedef Foo::x x;
|
||||
|
||||
int main(int, char**) { return 0; }
|
@ -0,0 +1,20 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// REQUIRES: objective-c++
|
||||
|
||||
// XFAIL: *
|
||||
|
||||
// Make sure the test DOES NOT pass if it fails to link.
|
||||
|
||||
extern void this_is_an_undefined_symbol();
|
||||
|
||||
int main(int, char**) {
|
||||
this_is_an_undefined_symbol();
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// REQUIRES: objective-c++
|
||||
|
||||
// Make sure the test passes if it succeeds to link.
|
||||
|
||||
@interface I;
|
||||
@end
|
||||
|
||||
int main(int, char**) { return 0; }
|
@ -0,0 +1,19 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// REQUIRES: objective-c++
|
||||
|
||||
// Make sure the test passes if it succeeds to link, even though it would have
|
||||
// failed at runtime.
|
||||
|
||||
@interface I;
|
||||
@end
|
||||
|
||||
int main(int, char**) {
|
||||
return 1;
|
||||
}
|
@ -115,9 +115,11 @@ class CxxStandardLibraryTest(lit.formats.TestFormat):
|
||||
FOO.pass.mm - Same as .pass.cpp, but for Objective-C++
|
||||
|
||||
FOO.compile.pass.cpp - Compiles successfully, link and run not attempted
|
||||
FOO.compile.pass.mm - Same as .compile.pass.cpp, but for Objective-C++
|
||||
FOO.compile.fail.cpp - Does not compile successfully
|
||||
|
||||
FOO.link.pass.cpp - Compiles and links successfully, run not attempted
|
||||
FOO.link.pass.mm - Same as .link.pass.cpp, but for Objective-C++
|
||||
FOO.link.fail.cpp - Compiles successfully, but fails to link
|
||||
|
||||
FOO.sh.<anything> - A builtin Lit Shell test
|
||||
@ -187,8 +189,10 @@ class CxxStandardLibraryTest(lit.formats.TestFormat):
|
||||
"""
|
||||
def getTestsInDirectory(self, testSuite, pathInSuite, litConfig, localConfig):
|
||||
SUPPORTED_SUFFIXES = ['[.]pass[.]cpp$', '[.]pass[.]mm$',
|
||||
'[.]compile[.]pass[.]cpp$', '[.]compile[.]fail[.]cpp$',
|
||||
'[.]link[.]pass[.]cpp$', '[.]link[.]fail[.]cpp$',
|
||||
'[.]compile[.]pass[.]cpp$', '[.]compile[.]pass[.]mm$',
|
||||
'[.]compile[.]fail[.]cpp$',
|
||||
'[.]link[.]pass[.]cpp$', '[.]link[.]pass[.]mm$',
|
||||
'[.]link[.]fail[.]cpp$',
|
||||
'[.]sh[.][^.]+$',
|
||||
'[.]verify[.]cpp$',
|
||||
'[.]fail[.]cpp$']
|
||||
@ -211,7 +215,7 @@ class CxxStandardLibraryTest(lit.formats.TestFormat):
|
||||
if re.search('[.]sh[.][^.]+$', filename):
|
||||
steps = [ ] # The steps are already in the script
|
||||
return self._executeShTest(test, litConfig, steps)
|
||||
elif filename.endswith('.compile.pass.cpp'):
|
||||
elif filename.endswith('.compile.pass.cpp') or filename.endswith('.compile.pass.mm'):
|
||||
steps = [
|
||||
"%dbg(COMPILED WITH) %{cxx} %s %{flags} %{compile_flags} -fsyntax-only"
|
||||
]
|
||||
@ -221,7 +225,7 @@ class CxxStandardLibraryTest(lit.formats.TestFormat):
|
||||
"%dbg(COMPILED WITH) ! %{cxx} %s %{flags} %{compile_flags} -fsyntax-only"
|
||||
]
|
||||
return self._executeShTest(test, litConfig, steps)
|
||||
elif filename.endswith('.link.pass.cpp'):
|
||||
elif filename.endswith('.link.pass.cpp') or filename.endswith('.link.pass.mm'):
|
||||
steps = [
|
||||
"%dbg(COMPILED WITH) %{cxx} %s %{flags} %{compile_flags} %{link_flags} -o %t.exe"
|
||||
]
|
||||
|
Loading…
x
Reference in New Issue
Block a user