Skip to content

Commit 65436e6

Browse files
[flang] Move External IO tests to use GTest
Port external-io test to use GTest. Remove Runtime tests directory. Rename RuntimeGTest directory to Runtime. This is the last in a series of patches which ported tests from the old flang/unittests/Runtime test directory to use GTest in a temporary unittest directory under flang/unittests/RuntimeGTest. Now that all the tests in the old directory have been ported to use GTest, the old directory has been removed and the GTest directory has been renamed to flang/unittests/Runtime. Differential Revision: https://reviews.llvm.org/D105315 Reviewed by: Meinersbur, awarzynski
1 parent 8a7b0da commit 65436e6

24 files changed

+472
-575
lines changed

flang/unittests/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ add_subdirectory(Optimizer)
4040
add_subdirectory(Decimal)
4141
add_subdirectory(Evaluate)
4242
add_subdirectory(Runtime)
43-
add_subdirectory(RuntimeGTest)
4443

4544
if (FLANG_BUILD_NEW_DRIVER)
4645
add_subdirectory(Frontend)
Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
1-
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
2-
3-
# RuntimeTesting needs exceptions enabled
4-
set(LLVM_REQUIRES_EH ON)
5-
set(LLVM_REQUIRES_RTTI ON)
6-
add_library(RuntimeTesting
7-
testing.cpp
8-
)
9-
llvm_update_compile_flags(RuntimeTesting)
10-
11-
if (LLVM_LINK_LLVM_DYLIB)
12-
set(llvm_libs LLVM)
13-
else()
14-
llvm_map_components_to_libnames(llvm_libs Support)
15-
endif()
16-
target_link_libraries(RuntimeTesting
17-
FortranRuntime
18-
${llvm_libs}
1+
add_flang_unittest(FlangRuntimeTests
2+
BufferTest.cpp
3+
CharacterTest.cpp
4+
CrashHandlerFixture.cpp
5+
ExternalIOTest.cpp
6+
Format.cpp
7+
ListInputTest.cpp
8+
Matmul.cpp
9+
MiscIntrinsic.cpp
10+
Namelist.cpp
11+
Numeric.cpp
12+
NumericalFormatTest.cpp
13+
Random.cpp
14+
Reduction.cpp
15+
RuntimeCrashTest.cpp
16+
Time.cpp
17+
Transformational.cpp
1918
)
2019

21-
add_flang_nongtest_unittest(external-io
22-
RuntimeTesting
20+
target_link_libraries(FlangRuntimeTests
21+
PRIVATE
2322
FortranRuntime
2423
)

flang/unittests/RuntimeGTest/CharacterTest.cpp renamed to flang/unittests/Runtime/CharacterTest.cpp

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
// in Fortran.
1111

1212
#include "../../runtime/character.h"
13-
#include "../../runtime/descriptor.h"
1413
#include "gtest/gtest.h"
14+
#include "../../runtime/descriptor.h"
1515
#include <cstring>
1616
#include <functional>
1717
#include <tuple>
@@ -264,17 +264,12 @@ template <typename CHAR> struct ExtremumTests : public ::testing::Test {};
264264
TYPED_TEST_SUITE(ExtremumTests, CharacterTypes, );
265265

266266
TYPED_TEST(ExtremumTests, MinTests) {
267-
static std::vector<ExtremumTestCase> tests{
268-
{{}, {"a"}, {"z"}, {"a"}},
267+
static std::vector<ExtremumTestCase> tests{{{}, {"a"}, {"z"}, {"a"}},
269268
{{1}, {"zaaa"}, {"aa"}, {"aa "}},
270269
{{1, 1}, {"aaz"}, {"aaaaa"}, {"aaaaa"}},
271-
{
272-
{ 2, 3 },
273-
{ "a", "b", "c", "d", "E", "f" },
274-
{ "xa", "ya", "az", "dd", "Sz", "cc"},
275-
{ "a ", "b ", "az", "d ", "E ", "cc"}
276-
}
277-
};
270+
{{2, 3}, {"a", "b", "c", "d", "E", "f"},
271+
{"xa", "ya", "az", "dd", "Sz", "cc"},
272+
{"a ", "b ", "az", "d ", "E ", "cc"}}};
278273
RunExtremumTests<TypeParam>("MIN", RTNAME(CharacterMin), tests);
279274
}
280275

0 commit comments

Comments
 (0)