Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Flang] Promote FortranEvaluateTesting library #124417

Merged
merged 24 commits into from
Feb 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
72e3c5d
[Flang] Introduce FortranSupport
Meinersbur Jan 24, 2025
71015c8
[Flang] Promote FortranEvaluateTesting library
Meinersbur Jan 24, 2025
24fb760
Sort files alphabetically
Meinersbur Jan 27, 2025
0810293
Merge branch 'main' into users/meinersbur/flang_runtime_FortranSupport
Meinersbur Jan 27, 2025
a7cd5b2
Merge branch 'users/meinersbur/flang_runtime_FortranSupport' into use…
Meinersbur Jan 27, 2025
b9ab00d
Move files back to Common
Meinersbur Jan 29, 2025
f3e9c15
add missing includes
Meinersbur Jan 29, 2025
8349624
Merge branch 'users/meinersbur/flang_runtime_FortranSupport' into use…
Meinersbur Jan 29, 2025
6a7bd03
Use C++style comments for header guards
Meinersbur Jan 29, 2025
db749b9
Use C++style comments for header guards II
Meinersbur Jan 29, 2025
d3c1b9a
Merge branch 'main' into users/meinersbur/flang_runtime_FortranSupport
Meinersbur Jan 30, 2025
d9023dd
Merge branch 'users/meinersbur/flang_runtime_FortranSupport' into use…
Meinersbur Jan 30, 2025
7dc5f20
Merge branch 'main' into users/meinersbur/flang_runtime_FortranSupport
Meinersbur Feb 4, 2025
88ecb82
Merge branch 'users/meinersbur/flang_runtime_FortranSupport' into use…
Meinersbur Feb 4, 2025
0a4dfcc
Merge branch 'main' into users/meinersbur/flang_runtime_FortranSupport
Meinersbur Feb 4, 2025
0a9c5fd
Merge branch 'users/meinersbur/flang_runtime_FortranSupport' into use…
Meinersbur Feb 4, 2025
7158e15
Merge remote-tracking branch 'official/main' into users/meinersbur/fl…
Meinersbur Feb 5, 2025
b286a88
clang-format includes
Meinersbur Feb 6, 2025
40b2f71
Merge branch 'users/meinersbur/flang_runtime_FortranSupport' into use…
Meinersbur Feb 6, 2025
080f30c
Merge commit 'b815a3942a0b0a9e7aab6b269ffdb0e93abc4368' into users/me…
Meinersbur Feb 6, 2025
919919f
Merge branch 'users/meinersbur/flang_runtime_FortranSupport' into use…
Meinersbur Feb 6, 2025
4c9e378
Merge branch 'main' into users/meinersbur/flang_runtime_FortranSupport
Meinersbur Feb 6, 2025
08a7bbc
Merge branch 'users/meinersbur/flang_runtime_FortranSupport' into use…
Meinersbur Feb 6, 2025
f258e0e
Use C++ header guards III
Meinersbur Feb 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
#ifndef FORTRAN_TEST_EVALUATE_FP_TESTING_H_
#define FORTRAN_TEST_EVALUATE_FP_TESTING_H_
//===-- include/flang/Testing/fp-testing.h ----------------------*- C++ -*-===//
//
// 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
//
//===----------------------------------------------------------------------===//

#ifndef FORTRAN_TESTING_FP_TESTING_H_
#define FORTRAN_TESTING_FP_TESTING_H_

#include "flang/Common/target-rounding.h"
#include <fenv.h>
Expand All @@ -24,4 +32,4 @@ class ScopedHostFloatingPointEnvironment {
#endif
};

#endif // FORTRAN_TEST_EVALUATE_FP_TESTING_H_
#endif // FORTRAN_TESTING_FP_TESTING_H_
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
#ifndef FORTRAN_EVALUATE_TESTING_H_
#define FORTRAN_EVALUATE_TESTING_H_
//===-- include/flang/Testing/testing.h -------------------------*- C++ -*-===//
//
// 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
//
//===----------------------------------------------------------------------===//

#ifndef FORTRAN_TESTING_TESTING_H_
#define FORTRAN_TESTING_TESTING_H_

#include <cinttypes>
#include <string>
Expand Down Expand Up @@ -33,4 +41,4 @@ FailureDetailPrinter Match(const char *file, int line, const std::string &want,
FailureDetailPrinter Compare(const char *file, int line, const char *xs,
const char *rel, const char *ys, std::uint64_t x, std::uint64_t y);
} // namespace testing
#endif // FORTRAN_EVALUATE_TESTING_H_
#endif // FORTRAN_TESTING_TESTING_H_
4 changes: 4 additions & 0 deletions flang/lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@ add_subdirectory(Frontend)
add_subdirectory(FrontendTool)

add_subdirectory(Optimizer)

if (FLANG_INCLUDE_TESTS)
add_subdirectory(Testing)
endif ()
20 changes: 20 additions & 0 deletions flang/lib/Testing/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#===-- lib/Testing/CMakeLists.txt ------------------------------------------===#
#
# 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
#
#===------------------------------------------------------------------------===#

add_library(NonGTestTesting EXCLUDE_FROM_ALL
testing.cpp
fp-testing.cpp
)
set_target_properties(NonGTestTesting PROPERTIES FOLDER "Flang/Tests")

if (LLVM_LINK_LLVM_DYLIB)
set(llvm_libs LLVM)
else()
llvm_map_components_to_libnames(llvm_libs Support)
endif()
target_link_libraries(NonGTestTesting ${llvm_libs})
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
#include "fp-testing.h"
//===-- lib/Testing/fp-testing.cpp ------------------------------*- C++ -*-===//
//
// 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
//
//===----------------------------------------------------------------------===//

#include "flang/Testing/fp-testing.h"
#include "llvm/Support/Errno.h"
#include <cstdio>
#include <cstdlib>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
#include "testing.h"
//===-- lib/Testing/testing.cpp ---------------------------------*- C++ -*-===//
//
// 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
//
//===----------------------------------------------------------------------===//

#include "flang/Testing/testing.h"
#include "llvm/Support/raw_ostream.h"
#include <cstdarg>
#include <cstdio>
Expand Down
35 changes: 11 additions & 24 deletions flang/unittests/Evaluate/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,47 +1,34 @@
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
add_library(FortranEvaluateTesting
testing.cpp
fp-testing.cpp
)
set_target_properties(FortranEvaluateTesting PROPERTIES FOLDER "Flang/Tests")
if (LLVM_LINK_LLVM_DYLIB)
set(llvm_libs LLVM)
else()
llvm_map_components_to_libnames(llvm_libs Support)
endif()

target_link_libraries(FortranEvaluateTesting
${llvm_libs})

add_flang_nongtest_unittest(leading-zero-bit-count
FortranEvaluateTesting
NonGTestTesting
)

add_flang_nongtest_unittest(bit-population-count
FortranEvaluateTesting
NonGTestTesting
)

add_flang_nongtest_unittest(uint128
FortranEvaluateTesting
NonGTestTesting
)

add_flang_nongtest_unittest(expression
FortranSupport
FortranEvaluateTesting
NonGTestTesting
FortranEvaluate
FortranSemantics
FortranParser
)

add_flang_nongtest_unittest(integer
FortranEvaluateTesting
NonGTestTesting
FortranEvaluate
FortranSemantics
)

add_flang_nongtest_unittest(intrinsics
FortranSupport
FortranEvaluateTesting
NonGTestTesting
FortranEvaluate
FortranDecimal
FortranSemantics
Expand All @@ -50,7 +37,7 @@ add_flang_nongtest_unittest(intrinsics
)

add_flang_nongtest_unittest(logical
FortranEvaluateTesting
NonGTestTesting
FortranEvaluate
FortranSemantics
)
Expand All @@ -62,30 +49,30 @@ add_flang_nongtest_unittest(logical
set(LLVM_REQUIRES_EH ON)
set(LLVM_REQUIRES_RTTI ON)
add_flang_nongtest_unittest(real
FortranEvaluateTesting
NonGTestTesting
FortranEvaluate
FortranDecimal
FortranSemantics
)
llvm_update_compile_flags(real.test)

add_flang_nongtest_unittest(reshape
FortranEvaluateTesting
NonGTestTesting
FortranSemantics
FortranEvaluate
FortranRuntime
)

add_flang_nongtest_unittest(ISO-Fortran-binding
FortranEvaluateTesting
NonGTestTesting
FortranEvaluate
FortranSemantics
FortranRuntime
)

add_flang_nongtest_unittest(folding
FortranSupport
FortranEvaluateTesting
NonGTestTesting
FortranEvaluate
FortranSemantics
)
2 changes: 1 addition & 1 deletion flang/unittests/Evaluate/ISO-Fortran-binding.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "testing.h"
#include "flang/Common/ISO_Fortran_binding_wrapper.h"
#include "flang/Runtime/descriptor.h"
#include "flang/Testing/testing.h"
#include "llvm/Support/raw_ostream.h"
#include <type_traits>

Expand Down
2 changes: 1 addition & 1 deletion flang/unittests/Evaluate/bit-population-count.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "flang/Common/bit-population-count.h"
#include "testing.h"
#include "flang/Testing/testing.h"

using Fortran::common::BitPopulationCount;
using Fortran::common::Parity;
Expand Down
2 changes: 1 addition & 1 deletion flang/unittests/Evaluate/expression.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#include "flang/Evaluate/expression.h"
#include "testing.h"
#include "flang/Evaluate/fold.h"
#include "flang/Evaluate/intrinsics.h"
#include "flang/Evaluate/target.h"
#include "flang/Evaluate/tools.h"
#include "flang/Parser/message.h"
#include "flang/Testing/testing.h"
#include <cstdio>
#include <cstdlib>
#include <string>
Expand Down
2 changes: 1 addition & 1 deletion flang/unittests/Evaluate/folding.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#include "testing.h"
#include "../../lib/Evaluate/host.h"
#include "flang/Evaluate/call.h"
#include "flang/Evaluate/expression.h"
Expand All @@ -7,6 +6,7 @@
#include "flang/Evaluate/intrinsics.h"
#include "flang/Evaluate/target.h"
#include "flang/Evaluate/tools.h"
#include "flang/Testing/testing.h"
#include <tuple>

using namespace Fortran::evaluate;
Expand Down
2 changes: 1 addition & 1 deletion flang/unittests/Evaluate/integer.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "flang/Evaluate/integer.h"
#include "testing.h"
#include "flang/Testing/testing.h"
#include <cstdio>
#include <string>

Expand Down
2 changes: 1 addition & 1 deletion flang/unittests/Evaluate/intrinsics.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#include "flang/Evaluate/intrinsics.h"
#include "testing.h"
#include "flang/Evaluate/common.h"
#include "flang/Evaluate/expression.h"
#include "flang/Evaluate/target.h"
#include "flang/Evaluate/tools.h"
#include "flang/Parser/provenance.h"
#include "flang/Testing/testing.h"
#include "llvm/Support/raw_ostream.h"
#include <initializer_list>
#include <map>
Expand Down
2 changes: 1 addition & 1 deletion flang/unittests/Evaluate/leading-zero-bit-count.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "flang/Common/leading-zero-bit-count.h"
#include "testing.h"
#include "flang/Testing/testing.h"

using Fortran::common::LeadingZeroBitCount;

Expand Down
2 changes: 1 addition & 1 deletion flang/unittests/Evaluate/logical.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "testing.h"
#include "flang/Evaluate/type.h"
#include "flang/Testing/testing.h"
#include <cstdio>

template <int KIND> void testKind() {
Expand Down
4 changes: 2 additions & 2 deletions flang/unittests/Evaluate/real.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "fp-testing.h"
#include "testing.h"
#include "flang/Evaluate/type.h"
#include "flang/Testing/fp-testing.h"
#include "flang/Testing/testing.h"
#include "llvm/Support/raw_ostream.h"
#include <cmath>
#include <cstdio>
Expand Down
2 changes: 1 addition & 1 deletion flang/unittests/Evaluate/reshape.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "testing.h"
#include "flang/Runtime/descriptor.h"
#include "flang/Runtime/transformational.h"
#include "flang/Testing/testing.h"
#include <cinttypes>

using namespace Fortran::common;
Expand Down
2 changes: 1 addition & 1 deletion flang/unittests/Evaluate/uint128.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#define AVOID_NATIVE_UINT128_T 1
#include "flang/Common/uint128.h"
#include "testing.h"
#include "flang/Testing/testing.h"
#include "llvm/Support/raw_ostream.h"
#include <cinttypes>

Expand Down