[flang-commits] [flang] [llvm] Add print statements to lit for tracing purposes (PR #92694)
Vlad Serebrennikov via flang-commits
flang-commits at lists.llvm.org
Sun May 19 13:32:47 PDT 2024
https://github.com/Endilll updated https://github.com/llvm/llvm-project/pull/92694
>From 2d419dd0910260272fea457beb59414798ee2594 Mon Sep 17 00:00:00 2001
From: Vlad Serebrennikov <serebrennikov.vladislav at gmail.com>
Date: Sun, 19 May 2024 15:54:44 +0300
Subject: [PATCH 01/13] Add print statements to lit for tracing purposes
---
llvm/utils/lit/lit/main.py | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/llvm/utils/lit/lit/main.py b/llvm/utils/lit/lit/main.py
index db9f24f748d9e..288558b90b77a 100755
--- a/llvm/utils/lit/lit/main.py
+++ b/llvm/utils/lit/lit/main.py
@@ -118,34 +118,56 @@ def main(builtin_params={}):
mark_xfail(discovered_tests, opts)
+ print("Endill 10")
+
mark_excluded(discovered_tests, selected_tests)
+ print("Endill 20")
+
start = time.time()
+ print("Endill 30")
run_tests(selected_tests, lit_config, opts, len(discovered_tests))
+ print("Endill 40")
elapsed = time.time() - start
+ print("Endill 50")
+
record_test_times(selected_tests, lit_config)
+ print("Endill 60")
+
selected_tests, discovered_tests = GoogleTest.post_process_shard_results(
selected_tests, discovered_tests
)
+ print("Endill 70")
+
if opts.time_tests:
print_histogram(discovered_tests)
+ print("Endill 80")
+
print_results(discovered_tests, elapsed, opts)
+ print("Endill 90")
+
tests_for_report = selected_tests if opts.shard else discovered_tests
for report in opts.reports:
report.write_results(tests_for_report, elapsed)
+ print("Endill 100")
+
if lit_config.numErrors:
sys.stderr.write("\n%d error(s) in tests\n" % lit_config.numErrors)
sys.exit(2)
+
+ print("Endill 110")
if lit_config.numWarnings:
sys.stderr.write("\n%d warning(s) in tests\n" % lit_config.numWarnings)
+ print("Endill 120")
+
has_failure = any(t.isFailure() for t in discovered_tests)
if has_failure:
if opts.ignoreFail:
>From 7edeaee2dfa50586406f27609bbd55d75e590aef Mon Sep 17 00:00:00 2001
From: Vlad Serebrennikov <serebrennikov.vladislav at gmail.com>
Date: Sun, 19 May 2024 17:12:16 +0300
Subject: [PATCH 02/13] Add more tracing
---
llvm/utils/lit/lit/main.py | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/llvm/utils/lit/lit/main.py b/llvm/utils/lit/lit/main.py
index 288558b90b77a..91e9d2310e52f 100755
--- a/llvm/utils/lit/lit/main.py
+++ b/llvm/utils/lit/lit/main.py
@@ -266,19 +266,23 @@ def mark_excluded(discovered_tests, selected_tests):
def run_tests(tests, lit_config, opts, discovered_tests):
+ print("Endill 310")
workers = min(len(tests), opts.workers)
+ print("Endill 320")
display = lit.display.create_display(opts, tests, discovered_tests, workers)
-
+ print("Endill 330")
run = lit.run.Run(
tests, lit_config, workers, display.update, opts.max_failures, opts.timeout
)
-
+ print("Endill 340")
display.print_header()
-
+ print("Endill 350")
interrupted = False
error = None
try:
+ print("Endill 360")
execute_in_tmp_dir(run, lit_config)
+ print("Endill 370")
except KeyboardInterrupt:
interrupted = True
error = " interrupted by user"
@@ -286,10 +290,13 @@ def run_tests(tests, lit_config, opts, discovered_tests):
error = "warning: reached maximum number of test failures"
except lit.run.TimeoutError:
error = "warning: reached timeout"
+ print("Endill 380")
display.clear(interrupted)
+ print("Endill 390")
if error:
sys.stderr.write("%s, skipping remaining tests\n" % error)
+ print("Endill 3100")
def execute_in_tmp_dir(run, lit_config):
>From 13a86f1060c84e82bfbb925e16f5985907b29dd0 Mon Sep 17 00:00:00 2001
From: Vlad Serebrennikov <serebrennikov.vladislav at gmail.com>
Date: Sun, 19 May 2024 17:12:45 +0300
Subject: [PATCH 03/13] Fix indentation
---
llvm/utils/lit/lit/main.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/llvm/utils/lit/lit/main.py b/llvm/utils/lit/lit/main.py
index 91e9d2310e52f..ee991f5360a4d 100755
--- a/llvm/utils/lit/lit/main.py
+++ b/llvm/utils/lit/lit/main.py
@@ -293,7 +293,7 @@ def run_tests(tests, lit_config, opts, discovered_tests):
print("Endill 380")
display.clear(interrupted)
- print("Endill 390")
+ print("Endill 390")
if error:
sys.stderr.write("%s, skipping remaining tests\n" % error)
print("Endill 3100")
>From 34619d6b865645e30af729aed03ff2d35a974062 Mon Sep 17 00:00:00 2001
From: Vlad Serebrennikov <serebrennikov.vladislav at gmail.com>
Date: Sun, 19 May 2024 17:16:15 +0300
Subject: [PATCH 04/13] Add even more tracing
---
llvm/utils/lit/lit/main.py | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/llvm/utils/lit/lit/main.py b/llvm/utils/lit/lit/main.py
index ee991f5360a4d..09354b3092d8a 100755
--- a/llvm/utils/lit/lit/main.py
+++ b/llvm/utils/lit/lit/main.py
@@ -300,6 +300,7 @@ def run_tests(tests, lit_config, opts, discovered_tests):
def execute_in_tmp_dir(run, lit_config):
+ print("Endill 3600")
# Create a temp directory inside the normal temp directory so that we can
# try to avoid temporary test file leaks. The user can avoid this behavior
# by setting LIT_PRESERVES_TMP in the environment, so they can easily use
@@ -308,26 +309,36 @@ def execute_in_tmp_dir(run, lit_config):
tmp_dir = None
if "LIT_PRESERVES_TMP" not in os.environ:
import tempfile
-
+ print("Endill 3610")
# z/OS linker does not support '_' in paths, so use '-'.
tmp_dir = tempfile.mkdtemp(prefix="lit-tmp-")
+ print("Endill 3620")
tmp_dir_envs = {k: tmp_dir for k in ["TMP", "TMPDIR", "TEMP", "TEMPDIR"]}
os.environ.update(tmp_dir_envs)
+ print("Endill 3630")
for cfg in {t.config for t in run.tests}:
cfg.environment.update(tmp_dir_envs)
+ print("Endill 3640")
try:
+ print("Endill 3650")
run.execute()
+ print("Endill 3660")
finally:
+ print("Endill 3670")
if tmp_dir:
try:
+ print("Endill 3680")
import shutil
-
+ print("Endill 3690")
shutil.rmtree(tmp_dir)
+ print("Endill 36100")
except Exception as e:
+ print("Endill 36110")
lit_config.warning(
"Failed to delete temp directory '%s', try upgrading your version of Python to fix this"
% tmp_dir
)
+ print("Endill 36120")
def print_histogram(tests):
>From bc6d8fd4a834a2a48fb450e1627680f36a35e066 Mon Sep 17 00:00:00 2001
From: Vlad Serebrennikov <serebrennikov.vladislav at gmail.com>
Date: Sun, 19 May 2024 18:17:34 +0300
Subject: [PATCH 05/13] Add even more tracing
---
llvm/utils/lit/lit/formats/googletest.py | 11 ++++++++--
llvm/utils/lit/lit/run.py | 28 ++++++++++++++++++++++++
2 files changed, 37 insertions(+), 2 deletions(-)
diff --git a/llvm/utils/lit/lit/formats/googletest.py b/llvm/utils/lit/lit/formats/googletest.py
index 8037094a91067..25dcc85df81e4 100644
--- a/llvm/utils/lit/lit/formats/googletest.py
+++ b/llvm/utils/lit/lit/formats/googletest.py
@@ -140,18 +140,20 @@ def getTestsInDirectory(self, testSuite, path_in_suite, litConfig, localConfig):
)
def execute(self, test, litConfig):
+ print("Endill gt-0")
if test.gtest_json_file is None:
return lit.Test.FAIL, ""
testPath = test.getSourcePath()
from lit.cl_arguments import TestOrder
-
+ print("Endill gt-1")
use_shuffle = TestOrder(litConfig.order) == TestOrder.RANDOM
shard_env = {
"GTEST_OUTPUT": "json:" + test.gtest_json_file,
"GTEST_SHUFFLE": "1" if use_shuffle else "0",
}
if litConfig.gtest_sharding:
+ print("Endill gt-2")
testPath, testName = os.path.split(test.getSourcePath())
while not os.path.exists(testPath):
# Handle GTest parameterized and typed tests, whose name includes
@@ -186,13 +188,16 @@ def get_shard_header(shard_env):
shard_header = get_shard_header(shard_env)
try:
+ print("Endill gt-3")
out, _, exitCode = lit.util.executeCommand(
cmd,
env=test.config.environment,
timeout=litConfig.maxIndividualTestTime,
redirect_stderr=True,
)
+ print("Endill gt-4")
except lit.util.ExecuteCommandTimeoutException as e:
+ print("Endill gt-5")
stream_msg = f"\n{e.out}\n--\nexit: {e.exitCode}\n--\n"
return (
lit.Test.TIMEOUT,
@@ -225,7 +230,9 @@ def get_test_stdout(test_name):
found_failed_test = False
with open(test.gtest_json_file, encoding="utf-8") as f:
+ print("Endill gt-6")
jf = json.load(f)
+ print("Endill gt-7")
if use_shuffle:
shard_env["GTEST_RANDOM_SEED"] = str(jf["random_seed"])
@@ -258,7 +265,7 @@ def get_test_stdout(test_name):
# the shard could still fail due to memory issues.
if not found_failed_test:
output += f"\n{out}\n--\nexit: {exitCode}\n--\n"
-
+ print("Endill gt-8")
return lit.Test.FAIL, output
def prepareCmd(self, cmd):
diff --git a/llvm/utils/lit/lit/run.py b/llvm/utils/lit/lit/run.py
index 535c859352cc4..ebbce0e75a9ce 100644
--- a/llvm/utils/lit/lit/run.py
+++ b/llvm/utils/lit/lit/run.py
@@ -30,6 +30,7 @@ def __init__(
assert workers > 0
def execute(self):
+ print("Endill 36500")
"""
Execute the tests in the run using up to the specified number of
parallel tasks, and inform the caller of each individual result. The
@@ -55,25 +56,36 @@ def execute(self):
deadline = time.time() + timeout
try:
+ print("Endill 36510")
self._execute(deadline)
+ print("Endill 36520")
finally:
+ print("Endill 36530")
skipped = lit.Test.Result(lit.Test.SKIPPED)
+ print("Endill 36540")
for test in self.tests:
+ print("Endill 36550")
if test.result is None:
test.setResult(skipped)
+ print("Endill 36560")
+
def _execute(self, deadline):
+ print("Endill 365100")
self._increase_process_limit()
+ print("Endill 365110")
semaphores = {
k: multiprocessing.BoundedSemaphore(v)
for k, v in self.lit_config.parallelism_groups.items()
if v is not None
}
+ print("Endill 365120")
pool = multiprocessing.Pool(
self.workers, lit.worker.initialize, (self.lit_config, semaphores)
)
+ print("Endill 365130")
async_results = [
pool.apply_async(
@@ -81,29 +93,45 @@ def _execute(self, deadline):
)
for test in self.tests
]
+ print("Endill 365140")
pool.close()
+ print("Endill 365150")
try:
+ print("Endill 365160")
self._wait_for(async_results, deadline)
+ print("Endill 365170")
except:
+ print("Endill 365180")
pool.terminate()
+ print("Endill 365190")
raise
finally:
+ print("Endill 3651100")
pool.join()
+ print("Endill 3651110")
def _wait_for(self, async_results, deadline):
+ print("Endill 3651600")
timeout = deadline - time.time()
for idx, ar in enumerate(async_results):
+ print("Endill 3651610")
try:
+ print("Endill 3651620")
test = ar.get(timeout)
+ print("Endill 3651630")
except multiprocessing.TimeoutError:
+ print("Endill 3651640")
raise TimeoutError()
else:
+ print("Endill 3651650")
self._update_test(self.tests[idx], test)
+ print("Endill 3651660")
if test.isFailure():
self.failures += 1
if self.failures == self.max_failures:
raise MaxFailuresError()
+ print("Endill 3651670")
# Update local test object "in place" from remote test object. This
# ensures that the original test object which is used for printing test
>From e6256b3019b721077847c23b648d0b98eb2fe872 Mon Sep 17 00:00:00 2001
From: Vlad Serebrennikov <serebrennikov.vladislav at gmail.com>
Date: Sun, 19 May 2024 19:20:13 +0300
Subject: [PATCH 06/13] Print individual test details
---
llvm/utils/lit/lit/formats/googletest.py | 4 ++++
llvm/utils/lit/lit/run.py | 4 +++-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/llvm/utils/lit/lit/formats/googletest.py b/llvm/utils/lit/lit/formats/googletest.py
index 25dcc85df81e4..a054e044beff9 100644
--- a/llvm/utils/lit/lit/formats/googletest.py
+++ b/llvm/utils/lit/lit/formats/googletest.py
@@ -205,12 +205,15 @@ def get_shard_header(shard_env):
f"timeout of {litConfig.maxIndividualTestTime} seconds",
)
+ print("Endill gt-5-1")
if not os.path.exists(test.gtest_json_file):
+ print("Endill gt-5-2")
errmsg = f"shard JSON output does not exist: %s" % (test.gtest_json_file)
stream_msg = f"\n{out}\n--\nexit: {exitCode}\n--\n"
return lit.Test.FAIL, shard_header + stream_msg + errmsg
if exitCode == 0:
+ print("Endill gt-5-3")
return lit.Test.PASS, ""
def get_test_stdout(test_name):
@@ -229,6 +232,7 @@ def get_test_stdout(test_name):
found_failed_test = False
+ print("Endill gt-5-4")
with open(test.gtest_json_file, encoding="utf-8") as f:
print("Endill gt-6")
jf = json.load(f)
diff --git a/llvm/utils/lit/lit/run.py b/llvm/utils/lit/lit/run.py
index ebbce0e75a9ce..54482071a67b2 100644
--- a/llvm/utils/lit/lit/run.py
+++ b/llvm/utils/lit/lit/run.py
@@ -64,7 +64,6 @@ def execute(self):
skipped = lit.Test.Result(lit.Test.SKIPPED)
print("Endill 36540")
for test in self.tests:
- print("Endill 36550")
if test.result is None:
test.setResult(skipped)
print("Endill 36560")
@@ -120,6 +119,9 @@ def _wait_for(self, async_results, deadline):
print("Endill 3651620")
test = ar.get(timeout)
print("Endill 3651630")
+ print("Endill: test.file_path: {}".format(test.file_path))
+ print("Endill: test.path_in_suite: {}".format(test.path_in_suite))
+ print("Endill 3651635")
except multiprocessing.TimeoutError:
print("Endill 3651640")
raise TimeoutError()
>From 15fc2f17fbb6aa4b1500f713ea00540b2b70df53 Mon Sep 17 00:00:00 2001
From: Vlad Serebrennikov <serebrennikov.vladislav at gmail.com>
Date: Sun, 19 May 2024 20:27:31 +0300
Subject: [PATCH 07/13] Print names of unit tests in shards
---
llvm/utils/lit/lit/formats/googletest.py | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/llvm/utils/lit/lit/formats/googletest.py b/llvm/utils/lit/lit/formats/googletest.py
index a054e044beff9..e665ac6a98cae 100644
--- a/llvm/utils/lit/lit/formats/googletest.py
+++ b/llvm/utils/lit/lit/formats/googletest.py
@@ -214,6 +214,16 @@ def get_shard_header(shard_env):
if exitCode == 0:
print("Endill gt-5-3")
+ print("Endill: shard header: {}".format(get_shard_header(shard_env)))
+ with open(test.gtest_json_file, encoding="utf-8") as f:
+ print("Endill gt-5-6")
+ jf = json.load(f)
+ print("Endill gt-5-7")
+ for testcase in jf["testsuites"]:
+ for testinfo in testcase["testsuite"]:
+ testname = testcase["name"] + "." + testinfo["name"]
+ print("Endill: testnamae: {}".format(testname))
+
return lit.Test.PASS, ""
def get_test_stdout(test_name):
>From 1c785a63d029dc55fc06ec236e55983729767e2f Mon Sep 17 00:00:00 2001
From: Vlad Serebrennikov <serebrennikov.vladislav at gmail.com>
Date: Sun, 19 May 2024 21:30:55 +0300
Subject: [PATCH 08/13] Disable a bunch of flang tests
---
.../Optimizer/Builder/ComplexTest.cpp | 44 ++--
.../Optimizer/Builder/DoLoopHelperTest.cpp | 30 +--
.../Optimizer/Builder/FIRBuilderTest.cpp | 12 +-
.../Optimizer/Builder/HLFIRToolsTest.cpp | 64 +++---
.../Builder/Runtime/CharacterTest.cpp | 22 +-
.../Optimizer/Builder/Runtime/CommandTest.cpp | 12 +-
.../Builder/Runtime/ReductionTest.cpp | 42 ++--
flang/unittests/Optimizer/FIRTypesTest.cpp | 54 ++---
.../Optimizer/FortranVariableTest.cpp | 44 ++--
.../unittests/Optimizer/InternalNamesTest.cpp | 64 +++---
flang/unittests/Runtime/CharacterTest.cpp | 96 ++++-----
flang/unittests/Runtime/CommandTest.cpp | 74 +++----
flang/unittests/Runtime/Complex.cpp | 34 +--
flang/unittests/Runtime/ExternalIOTest.cpp | 194 +++++++++---------
flang/unittests/Runtime/Format.cpp | 24 +--
flang/unittests/Runtime/ListInputTest.cpp | 58 +++---
flang/unittests/Runtime/MiscIntrinsic.cpp | 36 ++--
flang/unittests/Runtime/Numeric.cpp | 120 +++++------
.../unittests/Runtime/NumericalFormatTest.cpp | 30 +--
flang/unittests/Runtime/Pointer.cpp | 38 ++--
flang/unittests/Runtime/RuntimeCrashTest.cpp | 18 +-
flang/unittests/Runtime/Stop.cpp | 36 ++--
flang/unittests/Runtime/TemporaryStack.cpp | 160 +++++++--------
23 files changed, 653 insertions(+), 653 deletions(-)
diff --git a/flang/unittests/Optimizer/Builder/ComplexTest.cpp b/flang/unittests/Optimizer/Builder/ComplexTest.cpp
index 17171512470ac..b17ef9ef2f348 100644
--- a/flang/unittests/Optimizer/Builder/ComplexTest.cpp
+++ b/flang/unittests/Optimizer/Builder/ComplexTest.cpp
@@ -62,30 +62,30 @@ struct ComplexTest : public testing::Test {
mlir::Value rFour;
};
-TEST_F(ComplexTest, verifyTypes) {
- mlir::Value cVal1 = helper->createComplex(complexTy1, rOne, rTwo);
- mlir::Value cVal2 = helper->createComplex(4, rOne, rTwo);
- EXPECT_TRUE(fir::isa_complex(cVal1.getType()));
- EXPECT_TRUE(fir::isa_complex(cVal2.getType()));
- EXPECT_TRUE(fir::isa_real(helper->getComplexPartType(cVal1)));
- EXPECT_TRUE(fir::isa_real(helper->getComplexPartType(cVal2)));
+// TEST_F(ComplexTest, verifyTypes) {
+// mlir::Value cVal1 = helper->createComplex(complexTy1, rOne, rTwo);
+// mlir::Value cVal2 = helper->createComplex(4, rOne, rTwo);
+// EXPECT_TRUE(fir::isa_complex(cVal1.getType()));
+// EXPECT_TRUE(fir::isa_complex(cVal2.getType()));
+// EXPECT_TRUE(fir::isa_real(helper->getComplexPartType(cVal1)));
+// EXPECT_TRUE(fir::isa_real(helper->getComplexPartType(cVal2)));
- mlir::Value real1 = helper->extractComplexPart(cVal1, /*isImagPart=*/false);
- mlir::Value imag1 = helper->extractComplexPart(cVal1, /*isImagPart=*/true);
- mlir::Value real2 = helper->extractComplexPart(cVal2, /*isImagPart=*/false);
- mlir::Value imag2 = helper->extractComplexPart(cVal2, /*isImagPart=*/true);
- EXPECT_EQ(realTy1, real1.getType());
- EXPECT_EQ(realTy1, imag1.getType());
- EXPECT_EQ(realTy1, real2.getType());
- EXPECT_EQ(realTy1, imag2.getType());
+// mlir::Value real1 = helper->extractComplexPart(cVal1, /*isImagPart=*/false);
+// mlir::Value imag1 = helper->extractComplexPart(cVal1, /*isImagPart=*/true);
+// mlir::Value real2 = helper->extractComplexPart(cVal2, /*isImagPart=*/false);
+// mlir::Value imag2 = helper->extractComplexPart(cVal2, /*isImagPart=*/true);
+// EXPECT_EQ(realTy1, real1.getType());
+// EXPECT_EQ(realTy1, imag1.getType());
+// EXPECT_EQ(realTy1, real2.getType());
+// EXPECT_EQ(realTy1, imag2.getType());
- mlir::Value cVal3 =
- helper->insertComplexPart(cVal1, rThree, /*isImagPart=*/false);
- mlir::Value cVal4 =
- helper->insertComplexPart(cVal3, rFour, /*isImagPart=*/true);
- EXPECT_TRUE(fir::isa_complex(cVal4.getType()));
- EXPECT_TRUE(fir::isa_real(helper->getComplexPartType(cVal4)));
-}
+// mlir::Value cVal3 =
+// helper->insertComplexPart(cVal1, rThree, /*isImagPart=*/false);
+// mlir::Value cVal4 =
+// helper->insertComplexPart(cVal3, rFour, /*isImagPart=*/true);
+// EXPECT_TRUE(fir::isa_complex(cVal4.getType()));
+// EXPECT_TRUE(fir::isa_real(helper->getComplexPartType(cVal4)));
+// }
TEST_F(ComplexTest, verifyConvertWithSemantics) {
auto loc = firBuilder->getUnknownLoc();
diff --git a/flang/unittests/Optimizer/Builder/DoLoopHelperTest.cpp b/flang/unittests/Optimizer/Builder/DoLoopHelperTest.cpp
index d0a9342914a39..9da6cde3e1d1e 100644
--- a/flang/unittests/Optimizer/Builder/DoLoopHelperTest.cpp
+++ b/flang/unittests/Optimizer/Builder/DoLoopHelperTest.cpp
@@ -69,19 +69,19 @@ TEST_F(DoLoopHelperTest, createLoopWithLowerAndUpperBound) {
checkConstantValue(loop.getStep(), 1);
}
-TEST_F(DoLoopHelperTest, createLoopWithStep) {
- auto firBuilder = getBuilder();
- fir::factory::DoLoopHelper helper(firBuilder, firBuilder.getUnknownLoc());
+// TEST_F(DoLoopHelperTest, createLoopWithStep) {
+// auto firBuilder = getBuilder();
+// fir::factory::DoLoopHelper helper(firBuilder, firBuilder.getUnknownLoc());
- auto lb = firBuilder.createIntegerConstant(
- firBuilder.getUnknownLoc(), firBuilder.getIndexType(), 1);
- auto ub = firBuilder.createIntegerConstant(
- firBuilder.getUnknownLoc(), firBuilder.getIndexType(), 20);
- auto step = firBuilder.createIntegerConstant(
- firBuilder.getUnknownLoc(), firBuilder.getIndexType(), 2);
- auto loop = helper.createLoop(
- lb, ub, step, [&](fir::FirOpBuilder &, mlir::Value index) {});
- checkConstantValue(loop.getLowerBound(), 1);
- checkConstantValue(loop.getUpperBound(), 20);
- checkConstantValue(loop.getStep(), 2);
-}
+// auto lb = firBuilder.createIntegerConstant(
+// firBuilder.getUnknownLoc(), firBuilder.getIndexType(), 1);
+// auto ub = firBuilder.createIntegerConstant(
+// firBuilder.getUnknownLoc(), firBuilder.getIndexType(), 20);
+// auto step = firBuilder.createIntegerConstant(
+// firBuilder.getUnknownLoc(), firBuilder.getIndexType(), 2);
+// auto loop = helper.createLoop(
+// lb, ub, step, [&](fir::FirOpBuilder &, mlir::Value index) {});
+// checkConstantValue(loop.getLowerBound(), 1);
+// checkConstantValue(loop.getUpperBound(), 20);
+// checkConstantValue(loop.getStep(), 2);
+// }
diff --git a/flang/unittests/Optimizer/Builder/FIRBuilderTest.cpp b/flang/unittests/Optimizer/Builder/FIRBuilderTest.cpp
index e5e5454ee88ad..3f18ea073711f 100644
--- a/flang/unittests/Optimizer/Builder/FIRBuilderTest.cpp
+++ b/flang/unittests/Optimizer/Builder/FIRBuilderTest.cpp
@@ -154,12 +154,12 @@ TEST_F(FIRBuilderTest, createRealZeroConstant) {
0u, mlir::cast<FloatAttr>(cstOp.getValue()).getValue().convertToDouble());
}
-TEST_F(FIRBuilderTest, createBool) {
- auto builder = getBuilder();
- auto loc = builder.getUnknownLoc();
- auto b = builder.createBool(loc, false);
- checkIntegerConstant(b, builder.getIntegerType(1), 0);
-}
+// TEST_F(FIRBuilderTest, createBool) {
+// auto builder = getBuilder();
+// auto loc = builder.getUnknownLoc();
+// auto b = builder.createBool(loc, false);
+// checkIntegerConstant(b, builder.getIntegerType(1), 0);
+// }
TEST_F(FIRBuilderTest, getVarLenSeqTy) {
auto builder = getBuilder();
diff --git a/flang/unittests/Optimizer/Builder/HLFIRToolsTest.cpp b/flang/unittests/Optimizer/Builder/HLFIRToolsTest.cpp
index 1858b276f1fc3..616045f275e16 100644
--- a/flang/unittests/Optimizer/Builder/HLFIRToolsTest.cpp
+++ b/flang/unittests/Optimizer/Builder/HLFIRToolsTest.cpp
@@ -126,38 +126,38 @@ TEST_F(HLFIRToolsTest, testScalarCharRoundTrip) {
EXPECT_FALSE(scalarCharEntity.isValue());
}
-TEST_F(HLFIRToolsTest, testArrayCharRoundTrip) {
- auto &builder = getBuilder();
- mlir::Location loc = getLoc();
- llvm::SmallVector<mlir::Value> extents{
- createConstant(20), createConstant(30)};
- llvm::SmallVector<mlir::Value> lbounds{
- createConstant(-1), createConstant(-2)};
- mlir::Value len = createConstant(42);
- mlir::Type charType = fir::CharacterType::getUnknownLen(&context, 1);
- mlir::Type seqCharType = builder.getVarLenSeqTy(charType, 2);
- mlir::Type arrayCharType = builder.getRefType(seqCharType);
- mlir::Value arrayCharAddr = builder.create<fir::UndefOp>(loc, arrayCharType);
- fir::CharArrayBoxValue arrayChar{arrayCharAddr, len, extents, lbounds};
- hlfir::EntityWithAttributes arrayCharEntity(createDeclare(arrayChar));
- auto [arrayCharResult, cleanup] =
- hlfir::translateToExtendedValue(loc, builder, arrayCharEntity);
- auto *res = arrayCharResult.getBoxOf<fir::CharArrayBoxValue>();
- EXPECT_FALSE(cleanup.has_value());
- ASSERT_NE(res, nullptr);
- // gtest has a terrible time printing mlir::Value in case of failing
- // EXPECT_EQ(mlir::Value, mlir::Value). So use EXPECT_TRUE instead.
- EXPECT_TRUE(fir::getBase(*res) == arrayCharEntity.getFirBase());
- EXPECT_TRUE(res->getLen() == arrayChar.getLen());
- ASSERT_EQ(res->getExtents().size(), arrayChar.getExtents().size());
- for (unsigned i = 0; i < arrayChar.getExtents().size(); ++i)
- EXPECT_TRUE(res->getExtents()[i] == arrayChar.getExtents()[i]);
- ASSERT_EQ(res->getLBounds().size(), arrayChar.getLBounds().size());
- for (unsigned i = 0; i < arrayChar.getLBounds().size(); ++i)
- EXPECT_TRUE(res->getLBounds()[i] == arrayChar.getLBounds()[i]);
- EXPECT_TRUE(arrayCharEntity.isVariable());
- EXPECT_FALSE(arrayCharEntity.isValue());
-}
+// TEST_F(HLFIRToolsTest, testArrayCharRoundTrip) {
+// auto &builder = getBuilder();
+// mlir::Location loc = getLoc();
+// llvm::SmallVector<mlir::Value> extents{
+// createConstant(20), createConstant(30)};
+// llvm::SmallVector<mlir::Value> lbounds{
+// createConstant(-1), createConstant(-2)};
+// mlir::Value len = createConstant(42);
+// mlir::Type charType = fir::CharacterType::getUnknownLen(&context, 1);
+// mlir::Type seqCharType = builder.getVarLenSeqTy(charType, 2);
+// mlir::Type arrayCharType = builder.getRefType(seqCharType);
+// mlir::Value arrayCharAddr = builder.create<fir::UndefOp>(loc, arrayCharType);
+// fir::CharArrayBoxValue arrayChar{arrayCharAddr, len, extents, lbounds};
+// hlfir::EntityWithAttributes arrayCharEntity(createDeclare(arrayChar));
+// auto [arrayCharResult, cleanup] =
+// hlfir::translateToExtendedValue(loc, builder, arrayCharEntity);
+// auto *res = arrayCharResult.getBoxOf<fir::CharArrayBoxValue>();
+// EXPECT_FALSE(cleanup.has_value());
+// ASSERT_NE(res, nullptr);
+// // gtest has a terrible time printing mlir::Value in case of failing
+// // EXPECT_EQ(mlir::Value, mlir::Value). So use EXPECT_TRUE instead.
+// EXPECT_TRUE(fir::getBase(*res) == arrayCharEntity.getFirBase());
+// EXPECT_TRUE(res->getLen() == arrayChar.getLen());
+// ASSERT_EQ(res->getExtents().size(), arrayChar.getExtents().size());
+// for (unsigned i = 0; i < arrayChar.getExtents().size(); ++i)
+// EXPECT_TRUE(res->getExtents()[i] == arrayChar.getExtents()[i]);
+// ASSERT_EQ(res->getLBounds().size(), arrayChar.getLBounds().size());
+// for (unsigned i = 0; i < arrayChar.getLBounds().size(); ++i)
+// EXPECT_TRUE(res->getLBounds()[i] == arrayChar.getLBounds()[i]);
+// EXPECT_TRUE(arrayCharEntity.isVariable());
+// EXPECT_FALSE(arrayCharEntity.isValue());
+// }
TEST_F(HLFIRToolsTest, testArrayCharBoxRoundTrip) {
auto &builder = getBuilder();
diff --git a/flang/unittests/Optimizer/Builder/Runtime/CharacterTest.cpp b/flang/unittests/Optimizer/Builder/Runtime/CharacterTest.cpp
index 315f8c80dc33f..18f7dd0743a73 100644
--- a/flang/unittests/Optimizer/Builder/Runtime/CharacterTest.cpp
+++ b/flang/unittests/Optimizer/Builder/Runtime/CharacterTest.cpp
@@ -113,17 +113,17 @@ TEST_F(RuntimeCallTest, genIndexTest) {
checkGenIndex(*firBuilder, "_FortranAIndex4", 4);
}
-TEST_F(RuntimeCallTest, genIndexDescriptorTest) {
- auto loc = firBuilder->getUnknownLoc();
- mlir::Value resultBox = firBuilder->create<fir::UndefOp>(loc, boxTy);
- mlir::Value stringBox = firBuilder->create<fir::UndefOp>(loc, boxTy);
- mlir::Value substringBox = firBuilder->create<fir::UndefOp>(loc, boxTy);
- mlir::Value backOpt = firBuilder->create<fir::UndefOp>(loc, boxTy);
- mlir::Value kind = firBuilder->create<fir::UndefOp>(loc, i32Ty);
- fir::runtime::genIndexDescriptor(
- *firBuilder, loc, resultBox, stringBox, substringBox, backOpt, kind);
- checkCallOpFromResultBox(resultBox, "_FortranAIndex", 5);
-}
+// TEST_F(RuntimeCallTest, genIndexDescriptorTest) {
+// auto loc = firBuilder->getUnknownLoc();
+// mlir::Value resultBox = firBuilder->create<fir::UndefOp>(loc, boxTy);
+// mlir::Value stringBox = firBuilder->create<fir::UndefOp>(loc, boxTy);
+// mlir::Value substringBox = firBuilder->create<fir::UndefOp>(loc, boxTy);
+// mlir::Value backOpt = firBuilder->create<fir::UndefOp>(loc, boxTy);
+// mlir::Value kind = firBuilder->create<fir::UndefOp>(loc, i32Ty);
+// fir::runtime::genIndexDescriptor(
+// *firBuilder, loc, resultBox, stringBox, substringBox, backOpt, kind);
+// checkCallOpFromResultBox(resultBox, "_FortranAIndex", 5);
+// }
TEST_F(RuntimeCallTest, genRepeatTest) {
auto loc = firBuilder->getUnknownLoc();
diff --git a/flang/unittests/Optimizer/Builder/Runtime/CommandTest.cpp b/flang/unittests/Optimizer/Builder/Runtime/CommandTest.cpp
index 58a151447d5b4..57347e56b4c61 100644
--- a/flang/unittests/Optimizer/Builder/Runtime/CommandTest.cpp
+++ b/flang/unittests/Optimizer/Builder/Runtime/CommandTest.cpp
@@ -10,12 +10,12 @@
#include "RuntimeCallTestBase.h"
#include "gtest/gtest.h"
-TEST_F(RuntimeCallTest, genCommandArgumentCountTest) {
- mlir::Location loc = firBuilder->getUnknownLoc();
- mlir::Value result = fir::runtime::genCommandArgumentCount(*firBuilder, loc);
- checkCallOp(result.getDefiningOp(), "_FortranAArgumentCount", /*nbArgs=*/0,
- /*addLocArgs=*/false);
-}
+// TEST_F(RuntimeCallTest, genCommandArgumentCountTest) {
+// mlir::Location loc = firBuilder->getUnknownLoc();
+// mlir::Value result = fir::runtime::genCommandArgumentCount(*firBuilder, loc);
+// checkCallOp(result.getDefiningOp(), "_FortranAArgumentCount", /*nbArgs=*/0,
+// /*addLocArgs=*/false);
+// }
TEST_F(RuntimeCallTest, genGetCommandArgument) {
mlir::Location loc = firBuilder->getUnknownLoc();
diff --git a/flang/unittests/Optimizer/Builder/Runtime/ReductionTest.cpp b/flang/unittests/Optimizer/Builder/Runtime/ReductionTest.cpp
index a4006c6b59c12..994e113da70e4 100644
--- a/flang/unittests/Optimizer/Builder/Runtime/ReductionTest.cpp
+++ b/flang/unittests/Optimizer/Builder/Runtime/ReductionTest.cpp
@@ -52,15 +52,15 @@ TEST_F(RuntimeCallTest, genCountTest) {
checkCallOp(count.getDefiningOp(), "_FortranACount", 2);
}
-TEST_F(RuntimeCallTest, genCountDimTest) {
- mlir::Location loc = firBuilder->getUnknownLoc();
- mlir::Value result = firBuilder->create<fir::UndefOp>(loc, seqTy10);
- mlir::Value mask = firBuilder->create<fir::UndefOp>(loc, seqTy10);
- mlir::Value dim = firBuilder->createIntegerConstant(loc, i32Ty, 1);
- mlir::Value kind = firBuilder->createIntegerConstant(loc, i32Ty, 1);
- fir::runtime::genCountDim(*firBuilder, loc, result, mask, dim, kind);
- checkCallOpFromResultBox(result, "_FortranACountDim", 4);
-}
+// TEST_F(RuntimeCallTest, genCountDimTest) {
+// mlir::Location loc = firBuilder->getUnknownLoc();
+// mlir::Value result = firBuilder->create<fir::UndefOp>(loc, seqTy10);
+// mlir::Value mask = firBuilder->create<fir::UndefOp>(loc, seqTy10);
+// mlir::Value dim = firBuilder->createIntegerConstant(loc, i32Ty, 1);
+// mlir::Value kind = firBuilder->createIntegerConstant(loc, i32Ty, 1);
+// fir::runtime::genCountDim(*firBuilder, loc, result, mask, dim, kind);
+// checkCallOpFromResultBox(result, "_FortranACountDim", 4);
+// }
void testGenMaxVal(
fir::FirOpBuilder &builder, mlir::Type eleTy, llvm::StringRef fctName) {
@@ -120,14 +120,14 @@ TEST_F(RuntimeCallTest, genParityTest) {
checkCallOp(parity.getDefiningOp(), "_FortranAParity", 2);
}
-TEST_F(RuntimeCallTest, genParityDescriptorTest) {
- mlir::Location loc = firBuilder->getUnknownLoc();
- mlir::Value result = firBuilder->create<fir::UndefOp>(loc, seqTy10);
- mlir::Value mask = firBuilder->create<fir::UndefOp>(loc, seqTy10);
- mlir::Value dim = firBuilder->createIntegerConstant(loc, i32Ty, 1);
- fir::runtime::genParityDescriptor(*firBuilder, loc, result, mask, dim);
- checkCallOpFromResultBox(result, "_FortranAParityDim", 3);
-}
+// TEST_F(RuntimeCallTest, genParityDescriptorTest) {
+// mlir::Location loc = firBuilder->getUnknownLoc();
+// mlir::Value result = firBuilder->create<fir::UndefOp>(loc, seqTy10);
+// mlir::Value mask = firBuilder->create<fir::UndefOp>(loc, seqTy10);
+// mlir::Value dim = firBuilder->createIntegerConstant(loc, i32Ty, 1);
+// fir::runtime::genParityDescriptor(*firBuilder, loc, result, mask, dim);
+// checkCallOpFromResultBox(result, "_FortranAParityDim", 3);
+// }
void testGenSum(
fir::FirOpBuilder &builder, mlir::Type eleTy, llvm::StringRef fctName) {
@@ -349,10 +349,10 @@ TEST_F(RuntimeCallTest, genMaxvalCharTest) {
*firBuilder, fir::runtime::genMaxvalChar, "_FortranAMaxvalCharacter", 3);
}
-TEST_F(RuntimeCallTest, genMinvalCharTest) {
- checkGenMxxvalChar(
- *firBuilder, fir::runtime::genMinvalChar, "_FortranAMinvalCharacter", 3);
-}
+// TEST_F(RuntimeCallTest, genMinvalCharTest) {
+// checkGenMxxvalChar(
+// *firBuilder, fir::runtime::genMinvalChar, "_FortranAMinvalCharacter", 3);
+// }
void checkGen4argsDim(fir::FirOpBuilder &builder,
void (*genFct)(fir::FirOpBuilder &, mlir::Location, mlir::Value,
diff --git a/flang/unittests/Optimizer/FIRTypesTest.cpp b/flang/unittests/Optimizer/FIRTypesTest.cpp
index 238aa6939d5df..5ea621eebcdd4 100644
--- a/flang/unittests/Optimizer/FIRTypesTest.cpp
+++ b/flang/unittests/Optimizer/FIRTypesTest.cpp
@@ -125,33 +125,33 @@ TEST_F(FIRTypesTest, isUnlimitedPolymorphicTypeTest) {
}
// Test fir::isBoxedRecordType from flang/Optimizer/Dialect/FIRType.h.
-TEST_F(FIRTypesTest, isBoxedRecordType) {
- mlir::Type recTy = fir::RecordType::get(&context, "dt");
- mlir::Type seqRecTy =
- fir::SequenceType::get({fir::SequenceType::getUnknownExtent()}, recTy);
- mlir::Type ty = fir::BoxType::get(recTy);
- EXPECT_TRUE(fir::isBoxedRecordType(ty));
- EXPECT_TRUE(fir::isBoxedRecordType(fir::ReferenceType::get(ty)));
-
- // TYPE(T), ALLOCATABLE
- ty = fir::BoxType::get(fir::HeapType::get(recTy));
- EXPECT_TRUE(fir::isBoxedRecordType(ty));
-
- // TYPE(T), POINTER
- ty = fir::BoxType::get(fir::PointerType::get(recTy));
- EXPECT_TRUE(fir::isBoxedRecordType(ty));
-
- // TYPE(T), DIMENSION(10)
- ty = fir::BoxType::get(fir::SequenceType::get({10}, recTy));
- EXPECT_TRUE(fir::isBoxedRecordType(ty));
-
- // TYPE(T), DIMENSION(:)
- ty = fir::BoxType::get(seqRecTy);
- EXPECT_TRUE(fir::isBoxedRecordType(ty));
-
- EXPECT_FALSE(fir::isBoxedRecordType(fir::BoxType::get(
- fir::ReferenceType::get(mlir::IntegerType::get(&context, 32)))));
-}
+// TEST_F(FIRTypesTest, isBoxedRecordType) {
+// mlir::Type recTy = fir::RecordType::get(&context, "dt");
+// mlir::Type seqRecTy =
+// fir::SequenceType::get({fir::SequenceType::getUnknownExtent()}, recTy);
+// mlir::Type ty = fir::BoxType::get(recTy);
+// EXPECT_TRUE(fir::isBoxedRecordType(ty));
+// EXPECT_TRUE(fir::isBoxedRecordType(fir::ReferenceType::get(ty)));
+
+// // TYPE(T), ALLOCATABLE
+// ty = fir::BoxType::get(fir::HeapType::get(recTy));
+// EXPECT_TRUE(fir::isBoxedRecordType(ty));
+
+// // TYPE(T), POINTER
+// ty = fir::BoxType::get(fir::PointerType::get(recTy));
+// EXPECT_TRUE(fir::isBoxedRecordType(ty));
+
+// // TYPE(T), DIMENSION(10)
+// ty = fir::BoxType::get(fir::SequenceType::get({10}, recTy));
+// EXPECT_TRUE(fir::isBoxedRecordType(ty));
+
+// // TYPE(T), DIMENSION(:)
+// ty = fir::BoxType::get(seqRecTy);
+// EXPECT_TRUE(fir::isBoxedRecordType(ty));
+
+// EXPECT_FALSE(fir::isBoxedRecordType(fir::BoxType::get(
+// fir::ReferenceType::get(mlir::IntegerType::get(&context, 32)))));
+// }
// Test fir::isScalarBoxedRecordType from flang/Optimizer/Dialect/FIRType.h.
TEST_F(FIRTypesTest, isScalarBoxedRecordType) {
diff --git a/flang/unittests/Optimizer/FortranVariableTest.cpp b/flang/unittests/Optimizer/FortranVariableTest.cpp
index 87efb624735cf..ae48cdb18533e 100644
--- a/flang/unittests/Optimizer/FortranVariableTest.cpp
+++ b/flang/unittests/Optimizer/FortranVariableTest.cpp
@@ -42,29 +42,29 @@ struct FortranVariableTest : public testing::Test {
std::unique_ptr<mlir::OpBuilder> builder;
};
-TEST_F(FortranVariableTest, SimpleScalar) {
- mlir::Location loc = getLoc();
- mlir::Type eleType = mlir::FloatType::getF32(&context);
- mlir::Value addr = builder->create<fir::AllocaOp>(loc, eleType);
- auto name = mlir::StringAttr::get(&context, "x");
- auto declare = builder->create<fir::DeclareOp>(loc, addr.getType(), addr,
- /*shape=*/mlir::Value{}, /*typeParams=*/std::nullopt,
- /*dummy_scope=*/nullptr, name,
- /*fortran_attrs=*/fir::FortranVariableFlagsAttr{},
- /*data_attr=*/cuf::DataAttributeAttr{});
+// TEST_F(FortranVariableTest, SimpleScalar) {
+// mlir::Location loc = getLoc();
+// mlir::Type eleType = mlir::FloatType::getF32(&context);
+// mlir::Value addr = builder->create<fir::AllocaOp>(loc, eleType);
+// auto name = mlir::StringAttr::get(&context, "x");
+// auto declare = builder->create<fir::DeclareOp>(loc, addr.getType(), addr,
+// /*shape=*/mlir::Value{}, /*typeParams=*/std::nullopt,
+// /*dummy_scope=*/nullptr, name,
+// /*fortran_attrs=*/fir::FortranVariableFlagsAttr{},
+// /*data_attr=*/cuf::DataAttributeAttr{});
- fir::FortranVariableOpInterface fortranVariable = declare;
- EXPECT_FALSE(fortranVariable.isArray());
- EXPECT_FALSE(fortranVariable.isCharacter());
- EXPECT_FALSE(fortranVariable.isPointer());
- EXPECT_FALSE(fortranVariable.isAllocatable());
- EXPECT_FALSE(fortranVariable.hasExplicitCharLen());
- EXPECT_EQ(fortranVariable.getElementType(), eleType);
- EXPECT_EQ(fortranVariable.getElementOrSequenceType(),
- fortranVariable.getElementType());
- EXPECT_NE(fortranVariable.getBase(), addr);
- EXPECT_EQ(fortranVariable.getBase().getType(), addr.getType());
-}
+// fir::FortranVariableOpInterface fortranVariable = declare;
+// EXPECT_FALSE(fortranVariable.isArray());
+// EXPECT_FALSE(fortranVariable.isCharacter());
+// EXPECT_FALSE(fortranVariable.isPointer());
+// EXPECT_FALSE(fortranVariable.isAllocatable());
+// EXPECT_FALSE(fortranVariable.hasExplicitCharLen());
+// EXPECT_EQ(fortranVariable.getElementType(), eleType);
+// EXPECT_EQ(fortranVariable.getElementOrSequenceType(),
+// fortranVariable.getElementType());
+// EXPECT_NE(fortranVariable.getBase(), addr);
+// EXPECT_EQ(fortranVariable.getBase().getType(), addr.getType());
+// }
TEST_F(FortranVariableTest, CharacterScalar) {
mlir::Location loc = getLoc();
diff --git a/flang/unittests/Optimizer/InternalNamesTest.cpp b/flang/unittests/Optimizer/InternalNamesTest.cpp
index 058bbeef9b007..470791d41541a 100644
--- a/flang/unittests/Optimizer/InternalNamesTest.cpp
+++ b/flang/unittests/Optimizer/InternalNamesTest.cpp
@@ -88,38 +88,38 @@ TEST(InternalNamesTest, doTypeTest) {
ASSERT_EQ(actual, expectedMangledName);
}
-TEST(InternalNamesTest, doIntrinsicTypeDescriptorTest) {
- using IntrinsicType = fir::NameUniquer::IntrinsicType;
- std::string actual = NameUniquer::doIntrinsicTypeDescriptor(
- {}, {}, 0, IntrinsicType::REAL, 42);
- std::string expectedMangledName = "_QYIrealK42";
- ASSERT_EQ(actual, expectedMangledName);
-
- actual = NameUniquer::doIntrinsicTypeDescriptor(
- {}, {}, 0, IntrinsicType::REAL, {});
- expectedMangledName = "_QYIrealK0";
- ASSERT_EQ(actual, expectedMangledName);
-
- actual = NameUniquer::doIntrinsicTypeDescriptor(
- {}, {}, 0, IntrinsicType::INTEGER, 3);
- expectedMangledName = "_QYIintegerK3";
- ASSERT_EQ(actual, expectedMangledName);
-
- actual = NameUniquer::doIntrinsicTypeDescriptor(
- {}, {}, 0, IntrinsicType::LOGICAL, 2);
- expectedMangledName = "_QYIlogicalK2";
- ASSERT_EQ(actual, expectedMangledName);
-
- actual = NameUniquer::doIntrinsicTypeDescriptor(
- {}, {}, 0, IntrinsicType::CHARACTER, 4);
- expectedMangledName = "_QYIcharacterK4";
- ASSERT_EQ(actual, expectedMangledName);
-
- actual = NameUniquer::doIntrinsicTypeDescriptor(
- {}, {}, 0, IntrinsicType::COMPLEX, 4);
- expectedMangledName = "_QYIcomplexK4";
- ASSERT_EQ(actual, expectedMangledName);
-}
+// TEST(InternalNamesTest, doIntrinsicTypeDescriptorTest) {
+// using IntrinsicType = fir::NameUniquer::IntrinsicType;
+// std::string actual = NameUniquer::doIntrinsicTypeDescriptor(
+// {}, {}, 0, IntrinsicType::REAL, 42);
+// std::string expectedMangledName = "_QYIrealK42";
+// ASSERT_EQ(actual, expectedMangledName);
+
+// actual = NameUniquer::doIntrinsicTypeDescriptor(
+// {}, {}, 0, IntrinsicType::REAL, {});
+// expectedMangledName = "_QYIrealK0";
+// ASSERT_EQ(actual, expectedMangledName);
+
+// actual = NameUniquer::doIntrinsicTypeDescriptor(
+// {}, {}, 0, IntrinsicType::INTEGER, 3);
+// expectedMangledName = "_QYIintegerK3";
+// ASSERT_EQ(actual, expectedMangledName);
+
+// actual = NameUniquer::doIntrinsicTypeDescriptor(
+// {}, {}, 0, IntrinsicType::LOGICAL, 2);
+// expectedMangledName = "_QYIlogicalK2";
+// ASSERT_EQ(actual, expectedMangledName);
+
+// actual = NameUniquer::doIntrinsicTypeDescriptor(
+// {}, {}, 0, IntrinsicType::CHARACTER, 4);
+// expectedMangledName = "_QYIcharacterK4";
+// ASSERT_EQ(actual, expectedMangledName);
+
+// actual = NameUniquer::doIntrinsicTypeDescriptor(
+// {}, {}, 0, IntrinsicType::COMPLEX, 4);
+// expectedMangledName = "_QYIcomplexK4";
+// ASSERT_EQ(actual, expectedMangledName);
+// }
TEST(InternalNamesTest, doDispatchTableTest) {
std::string actual =
diff --git a/flang/unittests/Runtime/CharacterTest.cpp b/flang/unittests/Runtime/CharacterTest.cpp
index e54fd8a5075f6..e9522fae9a2c8 100644
--- a/flang/unittests/Runtime/CharacterTest.cpp
+++ b/flang/unittests/Runtime/CharacterTest.cpp
@@ -199,32 +199,32 @@ struct CharacterComparisonTests : public ::testing::Test {
TYPED_TEST_SUITE(CharacterComparisonTests, CharacterTypes, );
-TYPED_TEST(CharacterComparisonTests, CompareCharacters) {
- for (auto &[x, y, xBytes, yBytes, expect] : this->parameters) {
- int cmp{this->characterComparisonFunc(x, y, xBytes, yBytes)};
- TypeParam buf[2][8];
- std::memset(buf, 0, sizeof buf);
- std::memcpy(buf[0], x, xBytes);
- std::memcpy(buf[1], y, yBytes);
- ASSERT_EQ(cmp, expect) << "compare '" << x << "'(" << xBytes << ") to '"
- << y << "'(" << yBytes << "), got " << cmp
- << ", should be " << expect << '\n';
-
- // Perform the same test with the parameters reversed and the difference
- // negated
- std::swap(x, y);
- std::swap(xBytes, yBytes);
- expect = -expect;
-
- cmp = this->characterComparisonFunc(x, y, xBytes, yBytes);
- std::memset(buf, 0, sizeof buf);
- std::memcpy(buf[0], x, xBytes);
- std::memcpy(buf[1], y, yBytes);
- ASSERT_EQ(cmp, expect) << "compare '" << x << "'(" << xBytes << ") to '"
- << y << "'(" << yBytes << "'), got " << cmp
- << ", should be " << expect << '\n';
- }
-}
+// TYPED_TEST(CharacterComparisonTests, CompareCharacters) {
+// for (auto &[x, y, xBytes, yBytes, expect] : this->parameters) {
+// int cmp{this->characterComparisonFunc(x, y, xBytes, yBytes)};
+// TypeParam buf[2][8];
+// std::memset(buf, 0, sizeof buf);
+// std::memcpy(buf[0], x, xBytes);
+// std::memcpy(buf[1], y, yBytes);
+// ASSERT_EQ(cmp, expect) << "compare '" << x << "'(" << xBytes << ") to '"
+// << y << "'(" << yBytes << "), got " << cmp
+// << ", should be " << expect << '\n';
+
+// // Perform the same test with the parameters reversed and the difference
+// // negated
+// std::swap(x, y);
+// std::swap(xBytes, yBytes);
+// expect = -expect;
+
+// cmp = this->characterComparisonFunc(x, y, xBytes, yBytes);
+// std::memset(buf, 0, sizeof buf);
+// std::memcpy(buf[0], x, xBytes);
+// std::memcpy(buf[1], y, yBytes);
+// ASSERT_EQ(cmp, expect) << "compare '" << x << "'(" << xBytes << ") to '"
+// << y << "'(" << yBytes << "'), got " << cmp
+// << ", should be " << expect << '\n';
+// }
+// }
// Test MIN() and MAX()
struct ExtremumTestCase {
@@ -275,14 +275,14 @@ TYPED_TEST(ExtremumTests, MinTests) {
RunExtremumTests<TypeParam>("MIN", RTNAME(CharacterMin), tests);
}
-TYPED_TEST(ExtremumTests, MaxTests) {
- static std::vector<ExtremumTestCase> tests{
- {{}, {"a"}, {"z"}, {"z"}},
- {{1}, {"zaa"}, {"aaaaa"}, {"zaa "}},
- {{1, 1, 1}, {"aaaaa"}, {"aazaa"}, {"aazaa"}},
- };
- RunExtremumTests<TypeParam>("MAX", RTNAME(CharacterMax), tests);
-}
+// TYPED_TEST(ExtremumTests, MaxTests) {
+// static std::vector<ExtremumTestCase> tests{
+// {{}, {"a"}, {"z"}, {"z"}},
+// {{1}, {"zaa"}, {"aaaaa"}, {"zaa "}},
+// {{1, 1, 1}, {"aaaaa"}, {"aazaa"}, {"aazaa"}},
+// };
+// RunExtremumTests<TypeParam>("MAX", RTNAME(CharacterMax), tests);
+// }
template <typename CHAR>
void RunAllocationTest(const char *xRaw, const char *yRaw) {
@@ -373,20 +373,20 @@ TYPED_TEST(SearchTests, ScanTests) {
RunSearchTests("SCAN", tests, std::get<SearchFunction<TypeParam>>(functions));
}
-TYPED_TEST(SearchTests, VerifyTests) {
- static SearchFunctions functions{
- RTNAME(Verify1), RTNAME(Verify2), RTNAME(Verify4)};
- static std::vector<SearchTestCase> tests{
- {"abc", "abc", false, 0},
- {"abc", "abc", true, 0},
- {"abc", "cde", false, 1},
- {"abc", "cde", true, 2},
- {"abc", "x", false, 1},
- {"", "x", false, 0},
- };
- RunSearchTests(
- "VERIFY", tests, std::get<SearchFunction<TypeParam>>(functions));
-}
+// TYPED_TEST(SearchTests, VerifyTests) {
+// static SearchFunctions functions{
+// RTNAME(Verify1), RTNAME(Verify2), RTNAME(Verify4)};
+// static std::vector<SearchTestCase> tests{
+// {"abc", "abc", false, 0},
+// {"abc", "abc", true, 0},
+// {"abc", "cde", false, 1},
+// {"abc", "cde", true, 2},
+// {"abc", "x", false, 1},
+// {"", "x", false, 0},
+// };
+// RunSearchTests(
+// "VERIFY", tests, std::get<SearchFunction<TypeParam>>(functions));
+// }
// Test REPEAT()
template <typename CHAR> struct RepeatTests : public ::testing::Test {};
diff --git a/flang/unittests/Runtime/CommandTest.cpp b/flang/unittests/Runtime/CommandTest.cpp
index 08daa4ba37f26..c67eb091d0b11 100644
--- a/flang/unittests/Runtime/CommandTest.cpp
+++ b/flang/unittests/Runtime/CommandTest.cpp
@@ -308,21 +308,21 @@ TEST_F(ZeroArguments, GetCommandArgument) {
TEST_F(ZeroArguments, GetCommand) { CheckCommandValue(commandOnlyArgv, 1); }
-TEST_F(ZeroArguments, ECLValidCommandAndPadSync) {
- OwningPtr<Descriptor> command{CharDescriptor("echo hi")};
- bool wait{true};
- OwningPtr<Descriptor> exitStat{EmptyIntDescriptor()};
- OwningPtr<Descriptor> cmdStat{EmptyIntDescriptor()};
- OwningPtr<Descriptor> cmdMsg{CharDescriptor("No change")};
-
- RTNAME(ExecuteCommandLine)
- (*command.get(), wait, exitStat.get(), cmdStat.get(), cmdMsg.get());
-
- std::string spaces(cmdMsg->ElementBytes(), ' ');
- CheckDescriptorEqInt<std::int64_t>(exitStat.get(), 0);
- CheckDescriptorEqInt<std::int64_t>(cmdStat.get(), 0);
- CheckDescriptorEqStr(cmdMsg.get(), "No change");
-}
+// TEST_F(ZeroArguments, ECLValidCommandAndPadSync) {
+// OwningPtr<Descriptor> command{CharDescriptor("echo hi")};
+// bool wait{true};
+// OwningPtr<Descriptor> exitStat{EmptyIntDescriptor()};
+// OwningPtr<Descriptor> cmdStat{EmptyIntDescriptor()};
+// OwningPtr<Descriptor> cmdMsg{CharDescriptor("No change")};
+
+// RTNAME(ExecuteCommandLine)
+// (*command.get(), wait, exitStat.get(), cmdStat.get(), cmdMsg.get());
+
+// std::string spaces(cmdMsg->ElementBytes(), ' ');
+// CheckDescriptorEqInt<std::int64_t>(exitStat.get(), 0);
+// CheckDescriptorEqInt<std::int64_t>(cmdStat.get(), 0);
+// CheckDescriptorEqStr(cmdMsg.get(), "No change");
+// }
TEST_F(ZeroArguments, ECLValidCommandStatusSetSync) {
OwningPtr<Descriptor> command{CharDescriptor("echo hi")};
@@ -404,14 +404,14 @@ TEST_F(ZeroArguments, ECLInvalidCommandParentNotTerminatedAsync) {
CheckDescriptorEqStr(cmdMsg.get(), "No change");
}
-TEST_F(ZeroArguments, ECLInvalidCommandAsyncDontAffectSync) {
- OwningPtr<Descriptor> command{CharDescriptor("echo hi")};
+// TEST_F(ZeroArguments, ECLInvalidCommandAsyncDontAffectSync) {
+// OwningPtr<Descriptor> command{CharDescriptor("echo hi")};
- EXPECT_NO_FATAL_FAILURE(RTNAME(ExecuteCommandLine)(
- *command.get(), false, nullptr, nullptr, nullptr));
- EXPECT_NO_FATAL_FAILURE(RTNAME(ExecuteCommandLine)(
- *command.get(), true, nullptr, nullptr, nullptr));
-}
+// EXPECT_NO_FATAL_FAILURE(RTNAME(ExecuteCommandLine)(
+// *command.get(), false, nullptr, nullptr, nullptr));
+// EXPECT_NO_FATAL_FAILURE(RTNAME(ExecuteCommandLine)(
+// *command.get(), true, nullptr, nullptr, nullptr));
+// }
TEST_F(ZeroArguments, ECLInvalidCommandAsyncDontAffectAsync) {
OwningPtr<Descriptor> command{CharDescriptor("echo hi")};
@@ -560,18 +560,18 @@ TEST_F(SeveralArguments, GetCommand) {
CheckMissingCommandValue("Missing argument");
}
-TEST_F(SeveralArguments, CommandErrMsgTooShort) {
- OwningPtr<Descriptor> value{CreateEmptyCharDescriptor()};
- OwningPtr<Descriptor> length{EmptyIntDescriptor()};
- OwningPtr<Descriptor> errMsg{CreateEmptyCharDescriptor<3>()};
+// TEST_F(SeveralArguments, CommandErrMsgTooShort) {
+// OwningPtr<Descriptor> value{CreateEmptyCharDescriptor()};
+// OwningPtr<Descriptor> length{EmptyIntDescriptor()};
+// OwningPtr<Descriptor> errMsg{CreateEmptyCharDescriptor<3>()};
- EXPECT_GT(RTNAME(GetCommand)(value.get(), length.get(), errMsg.get()), 0);
+// EXPECT_GT(RTNAME(GetCommand)(value.get(), length.get(), errMsg.get()), 0);
- std::string spaces(value->ElementBytes(), ' ');
- CheckDescriptorEqStr(value.get(), spaces);
- CheckDescriptorEqInt<std::int64_t>(length.get(), 0);
- CheckDescriptorEqStr(errMsg.get(), "Mis");
-}
+// std::string spaces(value->ElementBytes(), ' ');
+// CheckDescriptorEqStr(value.get(), spaces);
+// CheckDescriptorEqInt<std::int64_t>(length.get(), 0);
+// CheckDescriptorEqStr(errMsg.get(), "Mis");
+// }
TEST_F(SeveralArguments, GetCommandCanTakeNull) {
EXPECT_GT(RTNAME(GetCommand)(nullptr, nullptr, nullptr), 0);
@@ -700,11 +700,11 @@ TEST_F(EnvironmentVariables, NoTrim) {
}
}
-TEST_F(EnvironmentVariables, Empty) {
- if (EnableFineGrainedTests()) {
- CheckEnvVarValue("", "EMPTY");
- }
-}
+// TEST_F(EnvironmentVariables, Empty) {
+// if (EnableFineGrainedTests()) {
+// CheckEnvVarValue("", "EMPTY");
+// }
+// }
TEST_F(EnvironmentVariables, NoValueOrErrmsg) {
ASSERT_EQ(std::getenv("DOESNT_EXIST"), nullptr)
diff --git a/flang/unittests/Runtime/Complex.cpp b/flang/unittests/Runtime/Complex.cpp
index 46f3ad2f2712b..f87b890c825d3 100644
--- a/flang/unittests/Runtime/Complex.cpp
+++ b/flang/unittests/Runtime/Complex.cpp
@@ -133,23 +133,23 @@ TEST(Complex, cpowk) {
cpowk(0.f + 1if, std::numeric_limits<std::int64_t>::min()), 1.f + 0if);
}
-TEST(Complex, zpowi) {
- EXPECT_COMPLEX_DOUBLE_EQ(zpowi(3. + 4i, 0), 1. + 0i);
- EXPECT_COMPLEX_DOUBLE_EQ(zpowi(3. + 4i, 1), 3. + 4i);
- EXPECT_COMPLEX_DOUBLE_EQ(zpowi(3. + 4i, 2), -7. + 24i);
- EXPECT_COMPLEX_DOUBLE_EQ(zpowi(3. + 4i, 3), -117. + 44i);
- EXPECT_COMPLEX_DOUBLE_EQ(zpowi(3. + 4i, 4), -527. - 336i);
-
- EXPECT_COMPLEX_DOUBLE_EQ(zpowi(3. + 4i, -2), -0.0112 - 0.0384i);
- EXPECT_COMPLEX_DOUBLE_EQ(zpowi(2. + 1i, 10), -237. - 3116i);
- EXPECT_COMPLEX_DOUBLE_EQ(zpowi(0.5 + 0.6i, -10), -9.32293628 - 7.29848564i);
-
- EXPECT_COMPLEX_DOUBLE_EQ(zpowi(2. + 1i, 5), -38. + 41i);
- EXPECT_COMPLEX_DOUBLE_EQ(zpowi(0.5 + 0.6i, -5), -1.12183773 + 3.25291503i);
-
- EXPECT_COMPLEX_DOUBLE_EQ(
- zpowi(0. + 1i, std::numeric_limits<std::int32_t>::min()), 1. + 0i);
-}
+// TEST(Complex, zpowi) {
+// EXPECT_COMPLEX_DOUBLE_EQ(zpowi(3. + 4i, 0), 1. + 0i);
+// EXPECT_COMPLEX_DOUBLE_EQ(zpowi(3. + 4i, 1), 3. + 4i);
+// EXPECT_COMPLEX_DOUBLE_EQ(zpowi(3. + 4i, 2), -7. + 24i);
+// EXPECT_COMPLEX_DOUBLE_EQ(zpowi(3. + 4i, 3), -117. + 44i);
+// EXPECT_COMPLEX_DOUBLE_EQ(zpowi(3. + 4i, 4), -527. - 336i);
+
+// EXPECT_COMPLEX_DOUBLE_EQ(zpowi(3. + 4i, -2), -0.0112 - 0.0384i);
+// EXPECT_COMPLEX_DOUBLE_EQ(zpowi(2. + 1i, 10), -237. - 3116i);
+// EXPECT_COMPLEX_DOUBLE_EQ(zpowi(0.5 + 0.6i, -10), -9.32293628 - 7.29848564i);
+
+// EXPECT_COMPLEX_DOUBLE_EQ(zpowi(2. + 1i, 5), -38. + 41i);
+// EXPECT_COMPLEX_DOUBLE_EQ(zpowi(0.5 + 0.6i, -5), -1.12183773 + 3.25291503i);
+
+// EXPECT_COMPLEX_DOUBLE_EQ(
+// zpowi(0. + 1i, std::numeric_limits<std::int32_t>::min()), 1. + 0i);
+// }
TEST(Complex, zpowk) {
EXPECT_COMPLEX_DOUBLE_EQ(zpowk(3. + 4i, 0), 1. + 0i);
diff --git a/flang/unittests/Runtime/ExternalIOTest.cpp b/flang/unittests/Runtime/ExternalIOTest.cpp
index 13327964e12a4..0f3da0784f9d4 100644
--- a/flang/unittests/Runtime/ExternalIOTest.cpp
+++ b/flang/unittests/Runtime/ExternalIOTest.cpp
@@ -585,103 +585,103 @@ TEST(ExternalIOTests, TestNonAvancingInput) {
<< "EndIoStatement() for Close";
}
-TEST(ExternalIOTests, TestWriteAfterNonAvancingInput) {
- // OPEN(NEWUNIT=unit,ACCESS='SEQUENTIAL',ACTION='READWRITE',&
- // FORM='FORMATTED',STATUS='SCRATCH')
- auto *io{IONAME(BeginOpenNewUnit)(__FILE__, __LINE__)};
- ASSERT_TRUE(IONAME(SetAccess)(io, "SEQUENTIAL", 10))
- << "SetAccess(SEQUENTIAL)";
- ASSERT_TRUE(IONAME(SetAction)(io, "READWRITE", 9)) << "SetAction(READWRITE)";
- ASSERT_TRUE(IONAME(SetForm)(io, "FORMATTED", 9)) << "SetForm(FORMATTED)";
- ASSERT_TRUE(IONAME(SetStatus)(io, "SCRATCH", 7)) << "SetStatus(SCRATCH)";
-
- int unit{-1};
- ASSERT_TRUE(IONAME(GetNewUnit)(io, unit)) << "GetNewUnit()";
- ASSERT_EQ(IONAME(EndIoStatement)(io), IostatOk)
- << "EndIoStatement() for OpenNewUnit";
-
- // Write the file to be used for the input test.
- static constexpr std::string_view records[] = {"ABCDEFGHIJKLMNOPQRST"};
- static constexpr std::string_view fmt{"(A)"};
- for (const auto &record : records) {
- // WRITE(UNIT=unit,FMT=fmt) record
- io = IONAME(BeginExternalFormattedOutput)(
- fmt.data(), fmt.length(), nullptr, unit, __FILE__, __LINE__);
- ASSERT_TRUE(IONAME(OutputAscii)(io, record.data(), record.length()))
- << "OutputAscii()";
- ASSERT_EQ(IONAME(EndIoStatement)(io), IostatOk)
- << "EndIoStatement() for OutputAscii";
- }
-
- // REWIND(UNIT=unit)
- io = IONAME(BeginRewind)(unit, __FILE__, __LINE__);
- ASSERT_EQ(IONAME(EndIoStatement)(io), IostatOk)
- << "EndIoStatement() for Rewind";
-
- struct TestItems {
- std::string item;
- int expectedIoStat;
- std::string expectedItemValue;
- };
- // Actual non advancing input IO test
- TestItems inputItems[]{
- {std::string(4, '+'), IostatOk, "ABCD"},
- {std::string(4, '+'), IostatOk, "EFGH"},
- };
-
- int j{0};
- for (auto &inputItem : inputItems) {
- // READ(UNIT=unit, FMT=fmt, ADVANCE='NO', IOSTAT=iostat) inputItem
- io = IONAME(BeginExternalFormattedInput)(
- fmt.data(), fmt.length(), nullptr, unit, __FILE__, __LINE__);
- IONAME(EnableHandlers)(io, true, false, false, false, false);
- ASSERT_TRUE(IONAME(SetAdvance)(io, "NO", 2)) << "SetAdvance(NO)" << j;
- ASSERT_TRUE(
- IONAME(InputAscii)(io, inputItem.item.data(), inputItem.item.length()))
- << "InputAscii() " << j;
- ASSERT_EQ(IONAME(EndIoStatement)(io), inputItem.expectedIoStat)
- << "EndIoStatement() for Read " << j;
- ASSERT_EQ(inputItem.item, inputItem.expectedItemValue)
- << "Input-item value after non advancing read " << j;
- j++;
- }
-
- // WRITE(UNIT=unit, FMT=fmt, IOSTAT=iostat) outputItem.
- static constexpr std::string_view outputItem{"XYZ"};
- // WRITE(UNIT=unit,FMT=fmt) record
- io = IONAME(BeginExternalFormattedOutput)(
- fmt.data(), fmt.length(), nullptr, unit, __FILE__, __LINE__);
- ASSERT_TRUE(IONAME(OutputAscii)(io, outputItem.data(), outputItem.length()))
- << "OutputAscii()";
- ASSERT_EQ(IONAME(EndIoStatement)(io), IostatOk)
- << "EndIoStatement() for OutputAscii";
-
- // Verify that the output was written in the record read in non advancing
- // mode, after the read part, and that the end was truncated.
-
- // REWIND(UNIT=unit)
- io = IONAME(BeginRewind)(unit, __FILE__, __LINE__);
- ASSERT_EQ(IONAME(EndIoStatement)(io), IostatOk)
- << "EndIoStatement() for Rewind";
-
- std::string resultRecord(20, '+');
- std::string expectedRecord{"ABCDEFGHXYZ "};
- // READ(UNIT=unit, FMT=fmt, IOSTAT=iostat) result
- io = IONAME(BeginExternalFormattedInput)(
- fmt.data(), fmt.length(), nullptr, unit, __FILE__, __LINE__);
- IONAME(EnableHandlers)(io, true, false, false, false, false);
- ASSERT_TRUE(
- IONAME(InputAscii)(io, resultRecord.data(), resultRecord.length()))
- << "InputAscii() ";
- ASSERT_EQ(IONAME(EndIoStatement)(io), IostatOk)
- << "EndIoStatement() for Read ";
- ASSERT_EQ(resultRecord, expectedRecord)
- << "Record after non advancing read followed by write";
- // CLOSE(UNIT=unit)
- io = IONAME(BeginClose)(unit, __FILE__, __LINE__);
- ASSERT_EQ(IONAME(EndIoStatement)(io), IostatOk)
- << "EndIoStatement() for Close";
-}
+// TEST(ExternalIOTests, TestWriteAfterNonAvancingInput) {
+// // OPEN(NEWUNIT=unit,ACCESS='SEQUENTIAL',ACTION='READWRITE',&
+// // FORM='FORMATTED',STATUS='SCRATCH')
+// auto *io{IONAME(BeginOpenNewUnit)(__FILE__, __LINE__)};
+// ASSERT_TRUE(IONAME(SetAccess)(io, "SEQUENTIAL", 10))
+// << "SetAccess(SEQUENTIAL)";
+// ASSERT_TRUE(IONAME(SetAction)(io, "READWRITE", 9)) << "SetAction(READWRITE)";
+// ASSERT_TRUE(IONAME(SetForm)(io, "FORMATTED", 9)) << "SetForm(FORMATTED)";
+// ASSERT_TRUE(IONAME(SetStatus)(io, "SCRATCH", 7)) << "SetStatus(SCRATCH)";
+
+// int unit{-1};
+// ASSERT_TRUE(IONAME(GetNewUnit)(io, unit)) << "GetNewUnit()";
+// ASSERT_EQ(IONAME(EndIoStatement)(io), IostatOk)
+// << "EndIoStatement() for OpenNewUnit";
+
+// // Write the file to be used for the input test.
+// static constexpr std::string_view records[] = {"ABCDEFGHIJKLMNOPQRST"};
+// static constexpr std::string_view fmt{"(A)"};
+// for (const auto &record : records) {
+// // WRITE(UNIT=unit,FMT=fmt) record
+// io = IONAME(BeginExternalFormattedOutput)(
+// fmt.data(), fmt.length(), nullptr, unit, __FILE__, __LINE__);
+// ASSERT_TRUE(IONAME(OutputAscii)(io, record.data(), record.length()))
+// << "OutputAscii()";
+// ASSERT_EQ(IONAME(EndIoStatement)(io), IostatOk)
+// << "EndIoStatement() for OutputAscii";
+// }
+
+// // REWIND(UNIT=unit)
+// io = IONAME(BeginRewind)(unit, __FILE__, __LINE__);
+// ASSERT_EQ(IONAME(EndIoStatement)(io), IostatOk)
+// << "EndIoStatement() for Rewind";
+
+// struct TestItems {
+// std::string item;
+// int expectedIoStat;
+// std::string expectedItemValue;
+// };
+// // Actual non advancing input IO test
+// TestItems inputItems[]{
+// {std::string(4, '+'), IostatOk, "ABCD"},
+// {std::string(4, '+'), IostatOk, "EFGH"},
+// };
+
+// int j{0};
+// for (auto &inputItem : inputItems) {
+// // READ(UNIT=unit, FMT=fmt, ADVANCE='NO', IOSTAT=iostat) inputItem
+// io = IONAME(BeginExternalFormattedInput)(
+// fmt.data(), fmt.length(), nullptr, unit, __FILE__, __LINE__);
+// IONAME(EnableHandlers)(io, true, false, false, false, false);
+// ASSERT_TRUE(IONAME(SetAdvance)(io, "NO", 2)) << "SetAdvance(NO)" << j;
+// ASSERT_TRUE(
+// IONAME(InputAscii)(io, inputItem.item.data(), inputItem.item.length()))
+// << "InputAscii() " << j;
+// ASSERT_EQ(IONAME(EndIoStatement)(io), inputItem.expectedIoStat)
+// << "EndIoStatement() for Read " << j;
+// ASSERT_EQ(inputItem.item, inputItem.expectedItemValue)
+// << "Input-item value after non advancing read " << j;
+// j++;
+// }
+
+// // WRITE(UNIT=unit, FMT=fmt, IOSTAT=iostat) outputItem.
+// static constexpr std::string_view outputItem{"XYZ"};
+// // WRITE(UNIT=unit,FMT=fmt) record
+// io = IONAME(BeginExternalFormattedOutput)(
+// fmt.data(), fmt.length(), nullptr, unit, __FILE__, __LINE__);
+// ASSERT_TRUE(IONAME(OutputAscii)(io, outputItem.data(), outputItem.length()))
+// << "OutputAscii()";
+// ASSERT_EQ(IONAME(EndIoStatement)(io), IostatOk)
+// << "EndIoStatement() for OutputAscii";
+
+// // Verify that the output was written in the record read in non advancing
+// // mode, after the read part, and that the end was truncated.
+
+// // REWIND(UNIT=unit)
+// io = IONAME(BeginRewind)(unit, __FILE__, __LINE__);
+// ASSERT_EQ(IONAME(EndIoStatement)(io), IostatOk)
+// << "EndIoStatement() for Rewind";
+
+// std::string resultRecord(20, '+');
+// std::string expectedRecord{"ABCDEFGHXYZ "};
+// // READ(UNIT=unit, FMT=fmt, IOSTAT=iostat) result
+// io = IONAME(BeginExternalFormattedInput)(
+// fmt.data(), fmt.length(), nullptr, unit, __FILE__, __LINE__);
+// IONAME(EnableHandlers)(io, true, false, false, false, false);
+// ASSERT_TRUE(
+// IONAME(InputAscii)(io, resultRecord.data(), resultRecord.length()))
+// << "InputAscii() ";
+// ASSERT_EQ(IONAME(EndIoStatement)(io), IostatOk)
+// << "EndIoStatement() for Read ";
+// ASSERT_EQ(resultRecord, expectedRecord)
+// << "Record after non advancing read followed by write";
+// // CLOSE(UNIT=unit)
+// io = IONAME(BeginClose)(unit, __FILE__, __LINE__);
+// ASSERT_EQ(IONAME(EndIoStatement)(io), IostatOk)
+// << "EndIoStatement() for Close";
+// }
TEST(ExternalIOTests, TestWriteAfterEndfile) {
// OPEN(NEWUNIT=unit,ACCESS='SEQUENTIAL',ACTION='READWRITE',&
diff --git a/flang/unittests/Runtime/Format.cpp b/flang/unittests/Runtime/Format.cpp
index 01803c628de26..cdcdc19aff54a 100644
--- a/flang/unittests/Runtime/Format.cpp
+++ b/flang/unittests/Runtime/Format.cpp
@@ -145,18 +145,18 @@ TEST(FormatTests, FormatStringTraversal) {
struct InvalidFormatFailure : CrashHandlerFixture {};
-TEST(InvalidFormatFailure, ParenMismatch) {
- static constexpr const char *format{"("};
- static constexpr int repeat{1};
-
- TestFormatContext context;
- FormatControl<decltype(context)> control{
- context, format, std::strlen(format)};
-
- ASSERT_DEATH(
- context.Report(/*edit=*/control.GetNextDataEdit(context, repeat)),
- R"(FORMAT missing at least one '\)')");
-}
+// TEST(InvalidFormatFailure, ParenMismatch) {
+// static constexpr const char *format{"("};
+// static constexpr int repeat{1};
+
+// TestFormatContext context;
+// FormatControl<decltype(context)> control{
+// context, format, std::strlen(format)};
+
+// ASSERT_DEATH(
+// context.Report(/*edit=*/control.GetNextDataEdit(context, repeat)),
+// R"(FORMAT missing at least one '\)')");
+// }
TEST(InvalidFormatFailure, MissingPrecision) {
static constexpr const char *format{"(F9.)"};
diff --git a/flang/unittests/Runtime/ListInputTest.cpp b/flang/unittests/Runtime/ListInputTest.cpp
index a4eba5283add6..c53a10a0af640 100644
--- a/flang/unittests/Runtime/ListInputTest.cpp
+++ b/flang/unittests/Runtime/ListInputTest.cpp
@@ -155,35 +155,35 @@ using ParamTy = std::tuple<std::string, std::vector<int>>;
struct SimpleListInputTest : testing::TestWithParam<ParamTy> {};
-TEST_P(SimpleListInputTest, TestListInput) {
- auto [formatBuffer, expectedOutput] = GetParam();
- constexpr int numBuffers{1};
-
- StaticDescriptor<1> staticDescriptor;
- Descriptor &whole{staticDescriptor.descriptor()};
- SubscriptValue extent[]{numBuffers};
- whole.Establish(TypeCode{CFI_type_char}, formatBuffer.size(),
- formatBuffer.data(), 1, extent, CFI_attribute_pointer);
- whole.Check();
- auto *cookie{IONAME(BeginInternalArrayListInput)(whole)};
-
- const auto listInputLength{expectedOutput.size()};
- std::vector<std::int64_t> actualOutput(listInputLength);
- for (std::size_t j = 0; j < listInputLength; ++j) {
- IONAME(InputInteger)(cookie, actualOutput[j]);
- }
-
- const auto status{IONAME(EndIoStatement)(cookie)};
- ASSERT_EQ(status, 0) << "list-directed input failed, status "
- << static_cast<int>(status) << '\n';
-
- // Verify the calls to _InputInteger_ resulted in _expectedOutput_
- for (std::size_t j = 0; j < listInputLength; ++j) {
- ASSERT_EQ(actualOutput[j], expectedOutput[j])
- << "wanted actualOutput[" << j << "]==" << expectedOutput[j] << ", got "
- << actualOutput[j] << '\n';
- }
-}
+// TEST_P(SimpleListInputTest, TestListInput) {
+// auto [formatBuffer, expectedOutput] = GetParam();
+// constexpr int numBuffers{1};
+
+// StaticDescriptor<1> staticDescriptor;
+// Descriptor &whole{staticDescriptor.descriptor()};
+// SubscriptValue extent[]{numBuffers};
+// whole.Establish(TypeCode{CFI_type_char}, formatBuffer.size(),
+// formatBuffer.data(), 1, extent, CFI_attribute_pointer);
+// whole.Check();
+// auto *cookie{IONAME(BeginInternalArrayListInput)(whole)};
+
+// const auto listInputLength{expectedOutput.size()};
+// std::vector<std::int64_t> actualOutput(listInputLength);
+// for (std::size_t j = 0; j < listInputLength; ++j) {
+// IONAME(InputInteger)(cookie, actualOutput[j]);
+// }
+
+// const auto status{IONAME(EndIoStatement)(cookie)};
+// ASSERT_EQ(status, 0) << "list-directed input failed, status "
+// << static_cast<int>(status) << '\n';
+
+// // Verify the calls to _InputInteger_ resulted in _expectedOutput_
+// for (std::size_t j = 0; j < listInputLength; ++j) {
+// ASSERT_EQ(actualOutput[j], expectedOutput[j])
+// << "wanted actualOutput[" << j << "]==" << expectedOutput[j] << ", got "
+// << actualOutput[j] << '\n';
+// }
+// }
INSTANTIATE_TEST_SUITE_P(SimpleListInputTestInstantiation, SimpleListInputTest,
testing::Values(std::make_tuple("", std::vector<int>{}),
diff --git a/flang/unittests/Runtime/MiscIntrinsic.cpp b/flang/unittests/Runtime/MiscIntrinsic.cpp
index 7e19ed250bdc0..6dff30a5c1efc 100644
--- a/flang/unittests/Runtime/MiscIntrinsic.cpp
+++ b/flang/unittests/Runtime/MiscIntrinsic.cpp
@@ -68,21 +68,21 @@ TEST(MiscIntrinsic, TransferSize) {
EXPECT_EQ(result.OffsetElement<float>()[1], 2.2F);
result.Destroy();
}
-TEST(MiscIntrinsic, TransferSizeScalarMold) {
- StaticDescriptor<2, true, 2> staticDesc[2];
- auto &result{staticDesc[0].descriptor()};
- std::complex<float> sourecStorage{1.1F, -2.2F};
- auto source{Descriptor::Create(TypeCategory::Complex, 4,
- reinterpret_cast<void *>(&sourecStorage), 0, nullptr,
- CFI_attribute_pointer)};
- auto &mold{staticDesc[1].descriptor()};
- mold.Establish(TypeCategory::Real, 4, nullptr, 0, nullptr);
- RTNAME(TransferSize)(result, *source, mold, __FILE__, __LINE__, 2);
- EXPECT_EQ(result.rank(), 1);
- EXPECT_EQ(result.GetDimension(0).LowerBound(), 1);
- EXPECT_EQ(result.GetDimension(0).Extent(), 2);
- EXPECT_EQ(result.type().raw(), (TypeCode{TypeCategory::Real, 4}.raw()));
- EXPECT_EQ(result.OffsetElement<float>()[0], 1.1F);
- EXPECT_EQ(result.OffsetElement<float>()[1], -2.2F);
- result.Destroy();
-}
+// TEST(MiscIntrinsic, TransferSizeScalarMold) {
+// StaticDescriptor<2, true, 2> staticDesc[2];
+// auto &result{staticDesc[0].descriptor()};
+// std::complex<float> sourecStorage{1.1F, -2.2F};
+// auto source{Descriptor::Create(TypeCategory::Complex, 4,
+// reinterpret_cast<void *>(&sourecStorage), 0, nullptr,
+// CFI_attribute_pointer)};
+// auto &mold{staticDesc[1].descriptor()};
+// mold.Establish(TypeCategory::Real, 4, nullptr, 0, nullptr);
+// RTNAME(TransferSize)(result, *source, mold, __FILE__, __LINE__, 2);
+// EXPECT_EQ(result.rank(), 1);
+// EXPECT_EQ(result.GetDimension(0).LowerBound(), 1);
+// EXPECT_EQ(result.GetDimension(0).Extent(), 2);
+// EXPECT_EQ(result.type().raw(), (TypeCode{TypeCategory::Real, 4}.raw()));
+// EXPECT_EQ(result.OffsetElement<float>()[0], 1.1F);
+// EXPECT_EQ(result.OffsetElement<float>()[1], -2.2F);
+// result.Destroy();
+// }
diff --git a/flang/unittests/Runtime/Numeric.cpp b/flang/unittests/Runtime/Numeric.cpp
index b69ff21ea79fb..98ec88abf9a93 100644
--- a/flang/unittests/Runtime/Numeric.cpp
+++ b/flang/unittests/Runtime/Numeric.cpp
@@ -31,15 +31,15 @@ TEST(Numeric, Floor) {
EXPECT_EQ(RTNAME(Floor4_1)(Real<4>{0}), 0);
}
-TEST(Numeric, Exponent) {
- EXPECT_EQ(RTNAME(Exponent4_4)(Real<4>{0}), 0);
- EXPECT_EQ(RTNAME(Exponent4_8)(Real<4>{1.0}), 1);
- EXPECT_EQ(RTNAME(Exponent8_4)(Real<8>{4.1}), 3);
- EXPECT_EQ(RTNAME(Exponent8_8)(std::numeric_limits<Real<8>>::infinity()),
- std::numeric_limits<Int<8>>::max());
- EXPECT_EQ(RTNAME(Exponent8_8)(std::numeric_limits<Real<8>>::quiet_NaN()),
- std::numeric_limits<Int<8>>::max());
-}
+// TEST(Numeric, Exponent) {
+// EXPECT_EQ(RTNAME(Exponent4_4)(Real<4>{0}), 0);
+// EXPECT_EQ(RTNAME(Exponent4_8)(Real<4>{1.0}), 1);
+// EXPECT_EQ(RTNAME(Exponent8_4)(Real<8>{4.1}), 3);
+// EXPECT_EQ(RTNAME(Exponent8_8)(std::numeric_limits<Real<8>>::infinity()),
+// std::numeric_limits<Int<8>>::max());
+// EXPECT_EQ(RTNAME(Exponent8_8)(std::numeric_limits<Real<8>>::quiet_NaN()),
+// std::numeric_limits<Int<8>>::max());
+// }
TEST(Numeric, Fraction) {
EXPECT_EQ(RTNAME(Fraction4)(Real<4>{0}), 0);
@@ -192,57 +192,57 @@ TEST(Numeric, SelectedIntKind) {
EXPECT_EQ(RTNAME(SelectedIntKind)(__FILE__, __LINE__, &r5, 4), -1);
}
-TEST(Numeric, SelectedRealKind) {
- std::int8_t p_s = 1;
- std::int16_t p[11] = {-10, 1, 1, 4, 50, 1, 1, 4, 1, 1, 50};
- std::int32_t r[11] = {-1, 1, 1, 1, 2, 1, 20, 20, 100, 5000, 5000};
- std::int64_t d[11] = {2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2};
- EXPECT_EQ(RTNAME(SelectedRealKind)(
- __FILE__, __LINE__, &p[0], 2, &r[0], 4, &d[0], 8),
- 2);
- EXPECT_EQ(RTNAME(SelectedRealKind)(
- __FILE__, __LINE__, &p[1], 2, &r[1], 4, &d[1], 8),
- -5);
- EXPECT_EQ(RTNAME(SelectedRealKind)(
- __FILE__, __LINE__, &p[2], 2, &r[2], 4, &d[2], 8),
- 2);
- EXPECT_EQ(RTNAME(SelectedRealKind)(
- __FILE__, __LINE__, &p[3], 2, &r[3], 4, &d[3], 8),
- 4);
- EXPECT_EQ(RTNAME(SelectedRealKind)(
- __FILE__, __LINE__, &p[4], 2, &r[4], 4, &d[4], 8),
- -1);
- EXPECT_EQ(RTNAME(SelectedRealKind)(
- __FILE__, __LINE__, &p[5], 2, &r[5], 4, &d[5], 8),
- 2);
- EXPECT_EQ(RTNAME(SelectedRealKind)(
- __FILE__, __LINE__, &p[6], 2, &r[6], 4, &d[6], 8),
- 3);
- EXPECT_EQ(RTNAME(SelectedRealKind)(
- __FILE__, __LINE__, &p[7], 2, &r[7], 4, &d[7], 8),
- 4);
- EXPECT_EQ(RTNAME(SelectedRealKind)(
- __FILE__, __LINE__, &p[8], 2, &r[8], 4, &d[8], 8),
- 8);
- EXPECT_EQ(RTNAME(SelectedRealKind)(
- __FILE__, __LINE__, &p[9], 2, &r[9], 4, &d[9], 8),
- -2);
- EXPECT_EQ(RTNAME(SelectedRealKind)(
- __FILE__, __LINE__, &p[10], 2, &r[10], 4, &d[10], 8),
- -3);
- EXPECT_EQ(
- RTNAME(SelectedRealKind)(__FILE__, __LINE__, &p_s, 1, &r[0], 4, &d[0], 8),
- 2);
- EXPECT_EQ(RTNAME(SelectedRealKind)(
- __FILE__, __LINE__, nullptr, 0, &r[0], 4, &d[0], 8),
- 2);
- EXPECT_EQ(RTNAME(SelectedRealKind)(
- __FILE__, __LINE__, &p[0], 2, nullptr, 0, &d[0], 8),
- 2);
- EXPECT_EQ(RTNAME(SelectedRealKind)(
- __FILE__, __LINE__, &p[0], 2, &r[0], 4, nullptr, 0),
- 2);
-}
+// TEST(Numeric, SelectedRealKind) {
+// std::int8_t p_s = 1;
+// std::int16_t p[11] = {-10, 1, 1, 4, 50, 1, 1, 4, 1, 1, 50};
+// std::int32_t r[11] = {-1, 1, 1, 1, 2, 1, 20, 20, 100, 5000, 5000};
+// std::int64_t d[11] = {2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2};
+// EXPECT_EQ(RTNAME(SelectedRealKind)(
+// __FILE__, __LINE__, &p[0], 2, &r[0], 4, &d[0], 8),
+// 2);
+// EXPECT_EQ(RTNAME(SelectedRealKind)(
+// __FILE__, __LINE__, &p[1], 2, &r[1], 4, &d[1], 8),
+// -5);
+// EXPECT_EQ(RTNAME(SelectedRealKind)(
+// __FILE__, __LINE__, &p[2], 2, &r[2], 4, &d[2], 8),
+// 2);
+// EXPECT_EQ(RTNAME(SelectedRealKind)(
+// __FILE__, __LINE__, &p[3], 2, &r[3], 4, &d[3], 8),
+// 4);
+// EXPECT_EQ(RTNAME(SelectedRealKind)(
+// __FILE__, __LINE__, &p[4], 2, &r[4], 4, &d[4], 8),
+// -1);
+// EXPECT_EQ(RTNAME(SelectedRealKind)(
+// __FILE__, __LINE__, &p[5], 2, &r[5], 4, &d[5], 8),
+// 2);
+// EXPECT_EQ(RTNAME(SelectedRealKind)(
+// __FILE__, __LINE__, &p[6], 2, &r[6], 4, &d[6], 8),
+// 3);
+// EXPECT_EQ(RTNAME(SelectedRealKind)(
+// __FILE__, __LINE__, &p[7], 2, &r[7], 4, &d[7], 8),
+// 4);
+// EXPECT_EQ(RTNAME(SelectedRealKind)(
+// __FILE__, __LINE__, &p[8], 2, &r[8], 4, &d[8], 8),
+// 8);
+// EXPECT_EQ(RTNAME(SelectedRealKind)(
+// __FILE__, __LINE__, &p[9], 2, &r[9], 4, &d[9], 8),
+// -2);
+// EXPECT_EQ(RTNAME(SelectedRealKind)(
+// __FILE__, __LINE__, &p[10], 2, &r[10], 4, &d[10], 8),
+// -3);
+// EXPECT_EQ(
+// RTNAME(SelectedRealKind)(__FILE__, __LINE__, &p_s, 1, &r[0], 4, &d[0], 8),
+// 2);
+// EXPECT_EQ(RTNAME(SelectedRealKind)(
+// __FILE__, __LINE__, nullptr, 0, &r[0], 4, &d[0], 8),
+// 2);
+// EXPECT_EQ(RTNAME(SelectedRealKind)(
+// __FILE__, __LINE__, &p[0], 2, nullptr, 0, &d[0], 8),
+// 2);
+// EXPECT_EQ(RTNAME(SelectedRealKind)(
+// __FILE__, __LINE__, &p[0], 2, &r[0], 4, nullptr, 0),
+// 2);
+// }
TEST(Numeric, Spacing) {
EXPECT_EQ(RTNAME(Spacing8)(Real<8>{0}), std::numeric_limits<Real<8>>::min());
diff --git a/flang/unittests/Runtime/NumericalFormatTest.cpp b/flang/unittests/Runtime/NumericalFormatTest.cpp
index 2a9f8f8d1dc4f..d480e41268b6b 100644
--- a/flang/unittests/Runtime/NumericalFormatTest.cpp
+++ b/flang/unittests/Runtime/NumericalFormatTest.cpp
@@ -336,21 +336,21 @@ TEST(IOApiTests, FormatOnes) {
}
}
-TEST(IOApiTests, FormatNegativeOnes) {
- static constexpr std::tuple<const char *, const char *> negOnes[]{
- {"(E32.17,';')", " -0.10000000000000000E+01;"},
- {"(F32.17,';')", " -1.00000000000000000;"},
- {"(G32.17,';')", " -1.0000000000000000 ;"},
- {"(EX32.17,';')", " -0X8.00000000000000000P-3;"},
- {"(G0,';')", "-1.;"},
- };
- for (auto const &[format, expect] : negOnes) {
- std::string got;
- ASSERT_TRUE(CompareFormatReal(format, -1.0, expect, got))
- << "Failed to format " << format << ", expected '" << expect
- << "', got '" << got << "'";
- }
-}
+// TEST(IOApiTests, FormatNegativeOnes) {
+// static constexpr std::tuple<const char *, const char *> negOnes[]{
+// {"(E32.17,';')", " -0.10000000000000000E+01;"},
+// {"(F32.17,';')", " -1.00000000000000000;"},
+// {"(G32.17,';')", " -1.0000000000000000 ;"},
+// {"(EX32.17,';')", " -0X8.00000000000000000P-3;"},
+// {"(G0,';')", "-1.;"},
+// };
+// for (auto const &[format, expect] : negOnes) {
+// std::string got;
+// ASSERT_TRUE(CompareFormatReal(format, -1.0, expect, got))
+// << "Failed to format " << format << ", expected '" << expect
+// << "', got '" << got << "'";
+// }
+// }
// Each test case contains a raw uint64, a format string for a real value, and
// the expected resulting string from formatting the raw uint64. The double
diff --git a/flang/unittests/Runtime/Pointer.cpp b/flang/unittests/Runtime/Pointer.cpp
index 4ce13ebc50a56..30edf82fbcf13 100644
--- a/flang/unittests/Runtime/Pointer.cpp
+++ b/flang/unittests/Runtime/Pointer.cpp
@@ -64,25 +64,25 @@ TEST(Pointer, DeallocatePolymorphic) {
(*p, nullptr, /*hasStat=*/false, /*errMsg=*/nullptr, __FILE__, __LINE__);
}
-TEST(Pointer, AllocateFromScalarSource) {
- // REAL(4), POINTER :: p(:)
- auto p{Descriptor::Create(TypeCode{Fortran::common::TypeCategory::Real, 4}, 4,
- nullptr, 1, nullptr, CFI_attribute_pointer)};
- // ALLOCATE(p(2:11), SOURCE=3.4)
- float sourecStorage{3.4F};
- auto s{Descriptor::Create(Fortran::common::TypeCategory::Real, 4,
- reinterpret_cast<void *>(&sourecStorage), 0, nullptr,
- CFI_attribute_pointer)};
- RTNAME(PointerSetBounds)(*p, 0, 2, 11);
- RTNAME(PointerAllocateSource)
- (*p, *s, /*hasStat=*/false, /*errMsg=*/nullptr, __FILE__, __LINE__);
- EXPECT_TRUE(RTNAME(PointerIsAssociated)(*p));
- EXPECT_EQ(p->Elements(), 10u);
- EXPECT_EQ(p->GetDimension(0).LowerBound(), 2);
- EXPECT_EQ(p->GetDimension(0).UpperBound(), 11);
- EXPECT_EQ(*p->OffsetElement<float>(), 3.4F);
- p->Destroy();
-}
+// TEST(Pointer, AllocateFromScalarSource) {
+// // REAL(4), POINTER :: p(:)
+// auto p{Descriptor::Create(TypeCode{Fortran::common::TypeCategory::Real, 4}, 4,
+// nullptr, 1, nullptr, CFI_attribute_pointer)};
+// // ALLOCATE(p(2:11), SOURCE=3.4)
+// float sourecStorage{3.4F};
+// auto s{Descriptor::Create(Fortran::common::TypeCategory::Real, 4,
+// reinterpret_cast<void *>(&sourecStorage), 0, nullptr,
+// CFI_attribute_pointer)};
+// RTNAME(PointerSetBounds)(*p, 0, 2, 11);
+// RTNAME(PointerAllocateSource)
+// (*p, *s, /*hasStat=*/false, /*errMsg=*/nullptr, __FILE__, __LINE__);
+// EXPECT_TRUE(RTNAME(PointerIsAssociated)(*p));
+// EXPECT_EQ(p->Elements(), 10u);
+// EXPECT_EQ(p->GetDimension(0).LowerBound(), 2);
+// EXPECT_EQ(p->GetDimension(0).UpperBound(), 11);
+// EXPECT_EQ(*p->OffsetElement<float>(), 3.4F);
+// p->Destroy();
+// }
TEST(Pointer, AllocateSourceZeroSize) {
using Fortran::common::TypeCategory;
diff --git a/flang/unittests/Runtime/RuntimeCrashTest.cpp b/flang/unittests/Runtime/RuntimeCrashTest.cpp
index a649051fdca0c..0753f76f23cc3 100644
--- a/flang/unittests/Runtime/RuntimeCrashTest.cpp
+++ b/flang/unittests/Runtime/RuntimeCrashTest.cpp
@@ -53,15 +53,15 @@ TEST(TestTerminator, CheckFailedTest) {
//------------------------------------------------------------------------------
struct TestIOCrash : CrashHandlerFixture {};
-TEST(TestIOCrash, InvalidFormatCharacterTest) {
- static constexpr int bufferSize{1};
- static char buffer[bufferSize];
- static const char *format{"(C1)"};
- auto *cookie{IONAME(BeginInternalFormattedOutput)(
- buffer, bufferSize, format, std::strlen(format))};
- ASSERT_DEATH(IONAME(OutputInteger64)(cookie, 0xfeedface),
- "Unknown 'C' edit descriptor in FORMAT");
-}
+// TEST(TestIOCrash, InvalidFormatCharacterTest) {
+// static constexpr int bufferSize{1};
+// static char buffer[bufferSize];
+// static const char *format{"(C1)"};
+// auto *cookie{IONAME(BeginInternalFormattedOutput)(
+// buffer, bufferSize, format, std::strlen(format))};
+// ASSERT_DEATH(IONAME(OutputInteger64)(cookie, 0xfeedface),
+// "Unknown 'C' edit descriptor in FORMAT");
+// }
//------------------------------------------------------------------------------
/// Test buffer overwrites with Output* functions
diff --git a/flang/unittests/Runtime/Stop.cpp b/flang/unittests/Runtime/Stop.cpp
index b13602eaee5ea..24c78251ea697 100644
--- a/flang/unittests/Runtime/Stop.cpp
+++ b/flang/unittests/Runtime/Stop.cpp
@@ -32,24 +32,24 @@ TEST(TestProgramEnd, StopTestNoStopMessage) {
RTNAME(StopStatement)(), testing::ExitedWithCode(EXIT_SUCCESS), "");
}
-TEST(TestProgramEnd, StopMessageTest) {
- static const char *message{"bye bye"};
- EXPECT_EXIT(RTNAME(StopStatementText)(message, std::strlen(message),
- /*isErrorStop=*/false, /*quiet=*/false),
- testing::ExitedWithCode(EXIT_SUCCESS), "Fortran STOP: bye bye");
-
- EXPECT_EXIT(RTNAME(StopStatementText)(message, std::strlen(message),
- /*isErrorStop=*/false, /*quiet=*/true),
- testing::ExitedWithCode(EXIT_SUCCESS), "");
-
- EXPECT_EXIT(RTNAME(StopStatementText)(message, std::strlen(message),
- /*isErrorStop=*/true, /*quiet=*/false),
- testing::ExitedWithCode(EXIT_FAILURE), "Fortran ERROR STOP: bye bye");
-
- EXPECT_EXIT(RTNAME(StopStatementText)(message, std::strlen(message),
- /*isErrorStop=*/true, /*quiet=*/true),
- testing::ExitedWithCode(EXIT_FAILURE), "");
-}
+// TEST(TestProgramEnd, StopMessageTest) {
+// static const char *message{"bye bye"};
+// EXPECT_EXIT(RTNAME(StopStatementText)(message, std::strlen(message),
+// /*isErrorStop=*/false, /*quiet=*/false),
+// testing::ExitedWithCode(EXIT_SUCCESS), "Fortran STOP: bye bye");
+
+// EXPECT_EXIT(RTNAME(StopStatementText)(message, std::strlen(message),
+// /*isErrorStop=*/false, /*quiet=*/true),
+// testing::ExitedWithCode(EXIT_SUCCESS), "");
+
+// EXPECT_EXIT(RTNAME(StopStatementText)(message, std::strlen(message),
+// /*isErrorStop=*/true, /*quiet=*/false),
+// testing::ExitedWithCode(EXIT_FAILURE), "Fortran ERROR STOP: bye bye");
+
+// EXPECT_EXIT(RTNAME(StopStatementText)(message, std::strlen(message),
+// /*isErrorStop=*/true, /*quiet=*/true),
+// testing::ExitedWithCode(EXIT_FAILURE), "");
+// }
TEST(TestProgramEnd, NoStopMessageTest) {
putenv(const_cast<char *>("NO_STOP_MESSAGE=1"));
diff --git a/flang/unittests/Runtime/TemporaryStack.cpp b/flang/unittests/Runtime/TemporaryStack.cpp
index 0a9344969ca6b..8b9aac99309ad 100644
--- a/flang/unittests/Runtime/TemporaryStack.cpp
+++ b/flang/unittests/Runtime/TemporaryStack.cpp
@@ -87,86 +87,86 @@ static unsigned max(unsigned x, unsigned y) {
return y;
}
-TEST(TemporaryStack, ValueStackMultiSize) {
- constexpr unsigned numToTest = 42;
- const TypeCode code{CFI_type_int32_t};
- constexpr size_t elementBytes = 4;
- SubscriptValue extent[CFI_MAX_RANK];
-
- std::vector<OwningPtr<Descriptor>> inputDescriptors;
- inputDescriptors.reserve(numToTest);
-
- void *storage = RTNAME(CreateValueStack)(__FILE__, __LINE__);
- ASSERT_NE(storage, nullptr);
-
- // create descriptors with and without adendums
- auto getAdendum = [](unsigned i) { return i % 2; };
- // create descriptors with varying ranks
- auto getRank = [](unsigned i) { return max(i % 8, 1); };
-
- // push descriptors of varying sizes and contents
- for (unsigned i = 0; i < numToTest; ++i) {
- const bool adendum = getAdendum(i);
- const size_t rank = getRank(i);
- for (unsigned dim = 0; dim < rank; ++dim) {
- extent[dim] = ((i + dim) % 8) + 1;
- }
-
- const OwningPtr<Descriptor> &desc =
- inputDescriptors.emplace_back(Descriptor::Create(code, elementBytes,
- nullptr, rank, extent, CFI_attribute_allocatable, adendum));
-
- // Descriptor::Establish doesn't initialise the extents if baseaddr is null
- for (unsigned dim = 0; dim < rank; ++dim) {
- Fortran::ISO::CFI_dim_t &boxDims = desc->raw().dim[dim];
- boxDims.lower_bound = 1;
- boxDims.extent = extent[dim];
- boxDims.sm = elementBytes;
- }
- desc->Allocate();
-
- // fill the array with some data to test
- for (uint32_t i = 0; i < desc->Elements(); ++i) {
- uint32_t *data = static_cast<uint32_t *>(desc->raw().base_addr);
- ASSERT_NE(data, nullptr);
- data[i] = i;
- }
-
- RTNAME(PushValue)(storage, *desc.get());
- }
-
- const TypeCode boolCode{CFI_type_Bool};
- // peek and test each descriptor
- for (unsigned i = 0; i < numToTest; ++i) {
- const OwningPtr<Descriptor> &input = inputDescriptors[i];
- const bool adendum = getAdendum(i);
- const size_t rank = getRank(i);
-
- // buffer to return the descriptor into
- OwningPtr<Descriptor> out = Descriptor::Create(
- boolCode, 1, nullptr, rank, extent, CFI_attribute_other, adendum);
-
- (void)input;
- RTNAME(ValueAt)(storage, i, *out.get());
- descriptorAlmostEqual(*input, *out);
- }
-
- // pop and test each descriptor
- for (unsigned i = numToTest; i > 0; --i) {
- const OwningPtr<Descriptor> &input = inputDescriptors[i - 1];
- const bool adendum = getAdendum(i - 1);
- const size_t rank = getRank(i - 1);
-
- // buffer to return the descriptor into
- OwningPtr<Descriptor> out = Descriptor::Create(
- boolCode, 1, nullptr, rank, extent, CFI_attribute_other, adendum);
-
- RTNAME(PopValue)(storage, *out.get());
- descriptorAlmostEqual(*input, *out);
- }
-
- RTNAME(DestroyValueStack)(storage);
-}
+// TEST(TemporaryStack, ValueStackMultiSize) {
+// constexpr unsigned numToTest = 42;
+// const TypeCode code{CFI_type_int32_t};
+// constexpr size_t elementBytes = 4;
+// SubscriptValue extent[CFI_MAX_RANK];
+
+// std::vector<OwningPtr<Descriptor>> inputDescriptors;
+// inputDescriptors.reserve(numToTest);
+
+// void *storage = RTNAME(CreateValueStack)(__FILE__, __LINE__);
+// ASSERT_NE(storage, nullptr);
+
+// // create descriptors with and without adendums
+// auto getAdendum = [](unsigned i) { return i % 2; };
+// // create descriptors with varying ranks
+// auto getRank = [](unsigned i) { return max(i % 8, 1); };
+
+// // push descriptors of varying sizes and contents
+// for (unsigned i = 0; i < numToTest; ++i) {
+// const bool adendum = getAdendum(i);
+// const size_t rank = getRank(i);
+// for (unsigned dim = 0; dim < rank; ++dim) {
+// extent[dim] = ((i + dim) % 8) + 1;
+// }
+
+// const OwningPtr<Descriptor> &desc =
+// inputDescriptors.emplace_back(Descriptor::Create(code, elementBytes,
+// nullptr, rank, extent, CFI_attribute_allocatable, adendum));
+
+// // Descriptor::Establish doesn't initialise the extents if baseaddr is null
+// for (unsigned dim = 0; dim < rank; ++dim) {
+// Fortran::ISO::CFI_dim_t &boxDims = desc->raw().dim[dim];
+// boxDims.lower_bound = 1;
+// boxDims.extent = extent[dim];
+// boxDims.sm = elementBytes;
+// }
+// desc->Allocate();
+
+// // fill the array with some data to test
+// for (uint32_t i = 0; i < desc->Elements(); ++i) {
+// uint32_t *data = static_cast<uint32_t *>(desc->raw().base_addr);
+// ASSERT_NE(data, nullptr);
+// data[i] = i;
+// }
+
+// RTNAME(PushValue)(storage, *desc.get());
+// }
+
+// const TypeCode boolCode{CFI_type_Bool};
+// // peek and test each descriptor
+// for (unsigned i = 0; i < numToTest; ++i) {
+// const OwningPtr<Descriptor> &input = inputDescriptors[i];
+// const bool adendum = getAdendum(i);
+// const size_t rank = getRank(i);
+
+// // buffer to return the descriptor into
+// OwningPtr<Descriptor> out = Descriptor::Create(
+// boolCode, 1, nullptr, rank, extent, CFI_attribute_other, adendum);
+
+// (void)input;
+// RTNAME(ValueAt)(storage, i, *out.get());
+// descriptorAlmostEqual(*input, *out);
+// }
+
+// // pop and test each descriptor
+// for (unsigned i = numToTest; i > 0; --i) {
+// const OwningPtr<Descriptor> &input = inputDescriptors[i - 1];
+// const bool adendum = getAdendum(i - 1);
+// const size_t rank = getRank(i - 1);
+
+// // buffer to return the descriptor into
+// OwningPtr<Descriptor> out = Descriptor::Create(
+// boolCode, 1, nullptr, rank, extent, CFI_attribute_other, adendum);
+
+// RTNAME(PopValue)(storage, *out.get());
+// descriptorAlmostEqual(*input, *out);
+// }
+
+// RTNAME(DestroyValueStack)(storage);
+// }
TEST(TemporaryStack, DescriptorStackBasic) {
const TypeCode code{CFI_type_Bool};
>From f2f96df7d753138c47c34096603f7e10d9484cb4 Mon Sep 17 00:00:00 2001
From: Vlad Serebrennikov <serebrennikov.vladislav at gmail.com>
Date: Sun, 19 May 2024 22:24:32 +0300
Subject: [PATCH 09/13] Limit CI down to flang
---
.ci/generate-buildkite-pipeline-premerge | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/.ci/generate-buildkite-pipeline-premerge b/.ci/generate-buildkite-pipeline-premerge
index 78a9cb77ff7d9..e36b91e6bf066 100755
--- a/.ci/generate-buildkite-pipeline-premerge
+++ b/.ci/generate-buildkite-pipeline-premerge
@@ -147,6 +147,11 @@ function exclude-windows() {
libc) ;; # no Windows support
lldb) ;; # tests failing
bolt) ;; # tests are not supported yet
+ clang) ;;
+ llvm) ;;
+ clang-tools-extra) ;;
+ lld) ;;
+ polly) ;;
*)
echo "${project}"
;;
@@ -187,6 +192,9 @@ function check-targets() {
libclc)
echo "check-all"
;;
+ mlir);;
+ clang);;
+ llvm);;
*)
echo "check-${project}"
;;
>From 3110b74e1c8237a079139f6edb3038ac113889a3 Mon Sep 17 00:00:00 2001
From: Vlad Serebrennikov <serebrennikov.vladislav at gmail.com>
Date: Sun, 19 May 2024 22:36:48 +0300
Subject: [PATCH 10/13] Revert "Disable a bunch of flang tests"
This reverts commit 1c785a63d029dc55fc06ec236e55983729767e2f.
---
.../Optimizer/Builder/ComplexTest.cpp | 44 ++--
.../Optimizer/Builder/DoLoopHelperTest.cpp | 30 +--
.../Optimizer/Builder/FIRBuilderTest.cpp | 12 +-
.../Optimizer/Builder/HLFIRToolsTest.cpp | 64 +++---
.../Builder/Runtime/CharacterTest.cpp | 22 +-
.../Optimizer/Builder/Runtime/CommandTest.cpp | 12 +-
.../Builder/Runtime/ReductionTest.cpp | 42 ++--
flang/unittests/Optimizer/FIRTypesTest.cpp | 54 ++---
.../Optimizer/FortranVariableTest.cpp | 44 ++--
.../unittests/Optimizer/InternalNamesTest.cpp | 64 +++---
flang/unittests/Runtime/CharacterTest.cpp | 96 ++++-----
flang/unittests/Runtime/CommandTest.cpp | 74 +++----
flang/unittests/Runtime/Complex.cpp | 34 +--
flang/unittests/Runtime/ExternalIOTest.cpp | 194 +++++++++---------
flang/unittests/Runtime/Format.cpp | 24 +--
flang/unittests/Runtime/ListInputTest.cpp | 58 +++---
flang/unittests/Runtime/MiscIntrinsic.cpp | 36 ++--
flang/unittests/Runtime/Numeric.cpp | 120 +++++------
.../unittests/Runtime/NumericalFormatTest.cpp | 30 +--
flang/unittests/Runtime/Pointer.cpp | 38 ++--
flang/unittests/Runtime/RuntimeCrashTest.cpp | 18 +-
flang/unittests/Runtime/Stop.cpp | 36 ++--
flang/unittests/Runtime/TemporaryStack.cpp | 160 +++++++--------
23 files changed, 653 insertions(+), 653 deletions(-)
diff --git a/flang/unittests/Optimizer/Builder/ComplexTest.cpp b/flang/unittests/Optimizer/Builder/ComplexTest.cpp
index b17ef9ef2f348..17171512470ac 100644
--- a/flang/unittests/Optimizer/Builder/ComplexTest.cpp
+++ b/flang/unittests/Optimizer/Builder/ComplexTest.cpp
@@ -62,30 +62,30 @@ struct ComplexTest : public testing::Test {
mlir::Value rFour;
};
-// TEST_F(ComplexTest, verifyTypes) {
-// mlir::Value cVal1 = helper->createComplex(complexTy1, rOne, rTwo);
-// mlir::Value cVal2 = helper->createComplex(4, rOne, rTwo);
-// EXPECT_TRUE(fir::isa_complex(cVal1.getType()));
-// EXPECT_TRUE(fir::isa_complex(cVal2.getType()));
-// EXPECT_TRUE(fir::isa_real(helper->getComplexPartType(cVal1)));
-// EXPECT_TRUE(fir::isa_real(helper->getComplexPartType(cVal2)));
+TEST_F(ComplexTest, verifyTypes) {
+ mlir::Value cVal1 = helper->createComplex(complexTy1, rOne, rTwo);
+ mlir::Value cVal2 = helper->createComplex(4, rOne, rTwo);
+ EXPECT_TRUE(fir::isa_complex(cVal1.getType()));
+ EXPECT_TRUE(fir::isa_complex(cVal2.getType()));
+ EXPECT_TRUE(fir::isa_real(helper->getComplexPartType(cVal1)));
+ EXPECT_TRUE(fir::isa_real(helper->getComplexPartType(cVal2)));
-// mlir::Value real1 = helper->extractComplexPart(cVal1, /*isImagPart=*/false);
-// mlir::Value imag1 = helper->extractComplexPart(cVal1, /*isImagPart=*/true);
-// mlir::Value real2 = helper->extractComplexPart(cVal2, /*isImagPart=*/false);
-// mlir::Value imag2 = helper->extractComplexPart(cVal2, /*isImagPart=*/true);
-// EXPECT_EQ(realTy1, real1.getType());
-// EXPECT_EQ(realTy1, imag1.getType());
-// EXPECT_EQ(realTy1, real2.getType());
-// EXPECT_EQ(realTy1, imag2.getType());
+ mlir::Value real1 = helper->extractComplexPart(cVal1, /*isImagPart=*/false);
+ mlir::Value imag1 = helper->extractComplexPart(cVal1, /*isImagPart=*/true);
+ mlir::Value real2 = helper->extractComplexPart(cVal2, /*isImagPart=*/false);
+ mlir::Value imag2 = helper->extractComplexPart(cVal2, /*isImagPart=*/true);
+ EXPECT_EQ(realTy1, real1.getType());
+ EXPECT_EQ(realTy1, imag1.getType());
+ EXPECT_EQ(realTy1, real2.getType());
+ EXPECT_EQ(realTy1, imag2.getType());
-// mlir::Value cVal3 =
-// helper->insertComplexPart(cVal1, rThree, /*isImagPart=*/false);
-// mlir::Value cVal4 =
-// helper->insertComplexPart(cVal3, rFour, /*isImagPart=*/true);
-// EXPECT_TRUE(fir::isa_complex(cVal4.getType()));
-// EXPECT_TRUE(fir::isa_real(helper->getComplexPartType(cVal4)));
-// }
+ mlir::Value cVal3 =
+ helper->insertComplexPart(cVal1, rThree, /*isImagPart=*/false);
+ mlir::Value cVal4 =
+ helper->insertComplexPart(cVal3, rFour, /*isImagPart=*/true);
+ EXPECT_TRUE(fir::isa_complex(cVal4.getType()));
+ EXPECT_TRUE(fir::isa_real(helper->getComplexPartType(cVal4)));
+}
TEST_F(ComplexTest, verifyConvertWithSemantics) {
auto loc = firBuilder->getUnknownLoc();
diff --git a/flang/unittests/Optimizer/Builder/DoLoopHelperTest.cpp b/flang/unittests/Optimizer/Builder/DoLoopHelperTest.cpp
index 9da6cde3e1d1e..d0a9342914a39 100644
--- a/flang/unittests/Optimizer/Builder/DoLoopHelperTest.cpp
+++ b/flang/unittests/Optimizer/Builder/DoLoopHelperTest.cpp
@@ -69,19 +69,19 @@ TEST_F(DoLoopHelperTest, createLoopWithLowerAndUpperBound) {
checkConstantValue(loop.getStep(), 1);
}
-// TEST_F(DoLoopHelperTest, createLoopWithStep) {
-// auto firBuilder = getBuilder();
-// fir::factory::DoLoopHelper helper(firBuilder, firBuilder.getUnknownLoc());
+TEST_F(DoLoopHelperTest, createLoopWithStep) {
+ auto firBuilder = getBuilder();
+ fir::factory::DoLoopHelper helper(firBuilder, firBuilder.getUnknownLoc());
-// auto lb = firBuilder.createIntegerConstant(
-// firBuilder.getUnknownLoc(), firBuilder.getIndexType(), 1);
-// auto ub = firBuilder.createIntegerConstant(
-// firBuilder.getUnknownLoc(), firBuilder.getIndexType(), 20);
-// auto step = firBuilder.createIntegerConstant(
-// firBuilder.getUnknownLoc(), firBuilder.getIndexType(), 2);
-// auto loop = helper.createLoop(
-// lb, ub, step, [&](fir::FirOpBuilder &, mlir::Value index) {});
-// checkConstantValue(loop.getLowerBound(), 1);
-// checkConstantValue(loop.getUpperBound(), 20);
-// checkConstantValue(loop.getStep(), 2);
-// }
+ auto lb = firBuilder.createIntegerConstant(
+ firBuilder.getUnknownLoc(), firBuilder.getIndexType(), 1);
+ auto ub = firBuilder.createIntegerConstant(
+ firBuilder.getUnknownLoc(), firBuilder.getIndexType(), 20);
+ auto step = firBuilder.createIntegerConstant(
+ firBuilder.getUnknownLoc(), firBuilder.getIndexType(), 2);
+ auto loop = helper.createLoop(
+ lb, ub, step, [&](fir::FirOpBuilder &, mlir::Value index) {});
+ checkConstantValue(loop.getLowerBound(), 1);
+ checkConstantValue(loop.getUpperBound(), 20);
+ checkConstantValue(loop.getStep(), 2);
+}
diff --git a/flang/unittests/Optimizer/Builder/FIRBuilderTest.cpp b/flang/unittests/Optimizer/Builder/FIRBuilderTest.cpp
index 3f18ea073711f..e5e5454ee88ad 100644
--- a/flang/unittests/Optimizer/Builder/FIRBuilderTest.cpp
+++ b/flang/unittests/Optimizer/Builder/FIRBuilderTest.cpp
@@ -154,12 +154,12 @@ TEST_F(FIRBuilderTest, createRealZeroConstant) {
0u, mlir::cast<FloatAttr>(cstOp.getValue()).getValue().convertToDouble());
}
-// TEST_F(FIRBuilderTest, createBool) {
-// auto builder = getBuilder();
-// auto loc = builder.getUnknownLoc();
-// auto b = builder.createBool(loc, false);
-// checkIntegerConstant(b, builder.getIntegerType(1), 0);
-// }
+TEST_F(FIRBuilderTest, createBool) {
+ auto builder = getBuilder();
+ auto loc = builder.getUnknownLoc();
+ auto b = builder.createBool(loc, false);
+ checkIntegerConstant(b, builder.getIntegerType(1), 0);
+}
TEST_F(FIRBuilderTest, getVarLenSeqTy) {
auto builder = getBuilder();
diff --git a/flang/unittests/Optimizer/Builder/HLFIRToolsTest.cpp b/flang/unittests/Optimizer/Builder/HLFIRToolsTest.cpp
index 616045f275e16..1858b276f1fc3 100644
--- a/flang/unittests/Optimizer/Builder/HLFIRToolsTest.cpp
+++ b/flang/unittests/Optimizer/Builder/HLFIRToolsTest.cpp
@@ -126,38 +126,38 @@ TEST_F(HLFIRToolsTest, testScalarCharRoundTrip) {
EXPECT_FALSE(scalarCharEntity.isValue());
}
-// TEST_F(HLFIRToolsTest, testArrayCharRoundTrip) {
-// auto &builder = getBuilder();
-// mlir::Location loc = getLoc();
-// llvm::SmallVector<mlir::Value> extents{
-// createConstant(20), createConstant(30)};
-// llvm::SmallVector<mlir::Value> lbounds{
-// createConstant(-1), createConstant(-2)};
-// mlir::Value len = createConstant(42);
-// mlir::Type charType = fir::CharacterType::getUnknownLen(&context, 1);
-// mlir::Type seqCharType = builder.getVarLenSeqTy(charType, 2);
-// mlir::Type arrayCharType = builder.getRefType(seqCharType);
-// mlir::Value arrayCharAddr = builder.create<fir::UndefOp>(loc, arrayCharType);
-// fir::CharArrayBoxValue arrayChar{arrayCharAddr, len, extents, lbounds};
-// hlfir::EntityWithAttributes arrayCharEntity(createDeclare(arrayChar));
-// auto [arrayCharResult, cleanup] =
-// hlfir::translateToExtendedValue(loc, builder, arrayCharEntity);
-// auto *res = arrayCharResult.getBoxOf<fir::CharArrayBoxValue>();
-// EXPECT_FALSE(cleanup.has_value());
-// ASSERT_NE(res, nullptr);
-// // gtest has a terrible time printing mlir::Value in case of failing
-// // EXPECT_EQ(mlir::Value, mlir::Value). So use EXPECT_TRUE instead.
-// EXPECT_TRUE(fir::getBase(*res) == arrayCharEntity.getFirBase());
-// EXPECT_TRUE(res->getLen() == arrayChar.getLen());
-// ASSERT_EQ(res->getExtents().size(), arrayChar.getExtents().size());
-// for (unsigned i = 0; i < arrayChar.getExtents().size(); ++i)
-// EXPECT_TRUE(res->getExtents()[i] == arrayChar.getExtents()[i]);
-// ASSERT_EQ(res->getLBounds().size(), arrayChar.getLBounds().size());
-// for (unsigned i = 0; i < arrayChar.getLBounds().size(); ++i)
-// EXPECT_TRUE(res->getLBounds()[i] == arrayChar.getLBounds()[i]);
-// EXPECT_TRUE(arrayCharEntity.isVariable());
-// EXPECT_FALSE(arrayCharEntity.isValue());
-// }
+TEST_F(HLFIRToolsTest, testArrayCharRoundTrip) {
+ auto &builder = getBuilder();
+ mlir::Location loc = getLoc();
+ llvm::SmallVector<mlir::Value> extents{
+ createConstant(20), createConstant(30)};
+ llvm::SmallVector<mlir::Value> lbounds{
+ createConstant(-1), createConstant(-2)};
+ mlir::Value len = createConstant(42);
+ mlir::Type charType = fir::CharacterType::getUnknownLen(&context, 1);
+ mlir::Type seqCharType = builder.getVarLenSeqTy(charType, 2);
+ mlir::Type arrayCharType = builder.getRefType(seqCharType);
+ mlir::Value arrayCharAddr = builder.create<fir::UndefOp>(loc, arrayCharType);
+ fir::CharArrayBoxValue arrayChar{arrayCharAddr, len, extents, lbounds};
+ hlfir::EntityWithAttributes arrayCharEntity(createDeclare(arrayChar));
+ auto [arrayCharResult, cleanup] =
+ hlfir::translateToExtendedValue(loc, builder, arrayCharEntity);
+ auto *res = arrayCharResult.getBoxOf<fir::CharArrayBoxValue>();
+ EXPECT_FALSE(cleanup.has_value());
+ ASSERT_NE(res, nullptr);
+ // gtest has a terrible time printing mlir::Value in case of failing
+ // EXPECT_EQ(mlir::Value, mlir::Value). So use EXPECT_TRUE instead.
+ EXPECT_TRUE(fir::getBase(*res) == arrayCharEntity.getFirBase());
+ EXPECT_TRUE(res->getLen() == arrayChar.getLen());
+ ASSERT_EQ(res->getExtents().size(), arrayChar.getExtents().size());
+ for (unsigned i = 0; i < arrayChar.getExtents().size(); ++i)
+ EXPECT_TRUE(res->getExtents()[i] == arrayChar.getExtents()[i]);
+ ASSERT_EQ(res->getLBounds().size(), arrayChar.getLBounds().size());
+ for (unsigned i = 0; i < arrayChar.getLBounds().size(); ++i)
+ EXPECT_TRUE(res->getLBounds()[i] == arrayChar.getLBounds()[i]);
+ EXPECT_TRUE(arrayCharEntity.isVariable());
+ EXPECT_FALSE(arrayCharEntity.isValue());
+}
TEST_F(HLFIRToolsTest, testArrayCharBoxRoundTrip) {
auto &builder = getBuilder();
diff --git a/flang/unittests/Optimizer/Builder/Runtime/CharacterTest.cpp b/flang/unittests/Optimizer/Builder/Runtime/CharacterTest.cpp
index 18f7dd0743a73..315f8c80dc33f 100644
--- a/flang/unittests/Optimizer/Builder/Runtime/CharacterTest.cpp
+++ b/flang/unittests/Optimizer/Builder/Runtime/CharacterTest.cpp
@@ -113,17 +113,17 @@ TEST_F(RuntimeCallTest, genIndexTest) {
checkGenIndex(*firBuilder, "_FortranAIndex4", 4);
}
-// TEST_F(RuntimeCallTest, genIndexDescriptorTest) {
-// auto loc = firBuilder->getUnknownLoc();
-// mlir::Value resultBox = firBuilder->create<fir::UndefOp>(loc, boxTy);
-// mlir::Value stringBox = firBuilder->create<fir::UndefOp>(loc, boxTy);
-// mlir::Value substringBox = firBuilder->create<fir::UndefOp>(loc, boxTy);
-// mlir::Value backOpt = firBuilder->create<fir::UndefOp>(loc, boxTy);
-// mlir::Value kind = firBuilder->create<fir::UndefOp>(loc, i32Ty);
-// fir::runtime::genIndexDescriptor(
-// *firBuilder, loc, resultBox, stringBox, substringBox, backOpt, kind);
-// checkCallOpFromResultBox(resultBox, "_FortranAIndex", 5);
-// }
+TEST_F(RuntimeCallTest, genIndexDescriptorTest) {
+ auto loc = firBuilder->getUnknownLoc();
+ mlir::Value resultBox = firBuilder->create<fir::UndefOp>(loc, boxTy);
+ mlir::Value stringBox = firBuilder->create<fir::UndefOp>(loc, boxTy);
+ mlir::Value substringBox = firBuilder->create<fir::UndefOp>(loc, boxTy);
+ mlir::Value backOpt = firBuilder->create<fir::UndefOp>(loc, boxTy);
+ mlir::Value kind = firBuilder->create<fir::UndefOp>(loc, i32Ty);
+ fir::runtime::genIndexDescriptor(
+ *firBuilder, loc, resultBox, stringBox, substringBox, backOpt, kind);
+ checkCallOpFromResultBox(resultBox, "_FortranAIndex", 5);
+}
TEST_F(RuntimeCallTest, genRepeatTest) {
auto loc = firBuilder->getUnknownLoc();
diff --git a/flang/unittests/Optimizer/Builder/Runtime/CommandTest.cpp b/flang/unittests/Optimizer/Builder/Runtime/CommandTest.cpp
index 57347e56b4c61..58a151447d5b4 100644
--- a/flang/unittests/Optimizer/Builder/Runtime/CommandTest.cpp
+++ b/flang/unittests/Optimizer/Builder/Runtime/CommandTest.cpp
@@ -10,12 +10,12 @@
#include "RuntimeCallTestBase.h"
#include "gtest/gtest.h"
-// TEST_F(RuntimeCallTest, genCommandArgumentCountTest) {
-// mlir::Location loc = firBuilder->getUnknownLoc();
-// mlir::Value result = fir::runtime::genCommandArgumentCount(*firBuilder, loc);
-// checkCallOp(result.getDefiningOp(), "_FortranAArgumentCount", /*nbArgs=*/0,
-// /*addLocArgs=*/false);
-// }
+TEST_F(RuntimeCallTest, genCommandArgumentCountTest) {
+ mlir::Location loc = firBuilder->getUnknownLoc();
+ mlir::Value result = fir::runtime::genCommandArgumentCount(*firBuilder, loc);
+ checkCallOp(result.getDefiningOp(), "_FortranAArgumentCount", /*nbArgs=*/0,
+ /*addLocArgs=*/false);
+}
TEST_F(RuntimeCallTest, genGetCommandArgument) {
mlir::Location loc = firBuilder->getUnknownLoc();
diff --git a/flang/unittests/Optimizer/Builder/Runtime/ReductionTest.cpp b/flang/unittests/Optimizer/Builder/Runtime/ReductionTest.cpp
index 994e113da70e4..a4006c6b59c12 100644
--- a/flang/unittests/Optimizer/Builder/Runtime/ReductionTest.cpp
+++ b/flang/unittests/Optimizer/Builder/Runtime/ReductionTest.cpp
@@ -52,15 +52,15 @@ TEST_F(RuntimeCallTest, genCountTest) {
checkCallOp(count.getDefiningOp(), "_FortranACount", 2);
}
-// TEST_F(RuntimeCallTest, genCountDimTest) {
-// mlir::Location loc = firBuilder->getUnknownLoc();
-// mlir::Value result = firBuilder->create<fir::UndefOp>(loc, seqTy10);
-// mlir::Value mask = firBuilder->create<fir::UndefOp>(loc, seqTy10);
-// mlir::Value dim = firBuilder->createIntegerConstant(loc, i32Ty, 1);
-// mlir::Value kind = firBuilder->createIntegerConstant(loc, i32Ty, 1);
-// fir::runtime::genCountDim(*firBuilder, loc, result, mask, dim, kind);
-// checkCallOpFromResultBox(result, "_FortranACountDim", 4);
-// }
+TEST_F(RuntimeCallTest, genCountDimTest) {
+ mlir::Location loc = firBuilder->getUnknownLoc();
+ mlir::Value result = firBuilder->create<fir::UndefOp>(loc, seqTy10);
+ mlir::Value mask = firBuilder->create<fir::UndefOp>(loc, seqTy10);
+ mlir::Value dim = firBuilder->createIntegerConstant(loc, i32Ty, 1);
+ mlir::Value kind = firBuilder->createIntegerConstant(loc, i32Ty, 1);
+ fir::runtime::genCountDim(*firBuilder, loc, result, mask, dim, kind);
+ checkCallOpFromResultBox(result, "_FortranACountDim", 4);
+}
void testGenMaxVal(
fir::FirOpBuilder &builder, mlir::Type eleTy, llvm::StringRef fctName) {
@@ -120,14 +120,14 @@ TEST_F(RuntimeCallTest, genParityTest) {
checkCallOp(parity.getDefiningOp(), "_FortranAParity", 2);
}
-// TEST_F(RuntimeCallTest, genParityDescriptorTest) {
-// mlir::Location loc = firBuilder->getUnknownLoc();
-// mlir::Value result = firBuilder->create<fir::UndefOp>(loc, seqTy10);
-// mlir::Value mask = firBuilder->create<fir::UndefOp>(loc, seqTy10);
-// mlir::Value dim = firBuilder->createIntegerConstant(loc, i32Ty, 1);
-// fir::runtime::genParityDescriptor(*firBuilder, loc, result, mask, dim);
-// checkCallOpFromResultBox(result, "_FortranAParityDim", 3);
-// }
+TEST_F(RuntimeCallTest, genParityDescriptorTest) {
+ mlir::Location loc = firBuilder->getUnknownLoc();
+ mlir::Value result = firBuilder->create<fir::UndefOp>(loc, seqTy10);
+ mlir::Value mask = firBuilder->create<fir::UndefOp>(loc, seqTy10);
+ mlir::Value dim = firBuilder->createIntegerConstant(loc, i32Ty, 1);
+ fir::runtime::genParityDescriptor(*firBuilder, loc, result, mask, dim);
+ checkCallOpFromResultBox(result, "_FortranAParityDim", 3);
+}
void testGenSum(
fir::FirOpBuilder &builder, mlir::Type eleTy, llvm::StringRef fctName) {
@@ -349,10 +349,10 @@ TEST_F(RuntimeCallTest, genMaxvalCharTest) {
*firBuilder, fir::runtime::genMaxvalChar, "_FortranAMaxvalCharacter", 3);
}
-// TEST_F(RuntimeCallTest, genMinvalCharTest) {
-// checkGenMxxvalChar(
-// *firBuilder, fir::runtime::genMinvalChar, "_FortranAMinvalCharacter", 3);
-// }
+TEST_F(RuntimeCallTest, genMinvalCharTest) {
+ checkGenMxxvalChar(
+ *firBuilder, fir::runtime::genMinvalChar, "_FortranAMinvalCharacter", 3);
+}
void checkGen4argsDim(fir::FirOpBuilder &builder,
void (*genFct)(fir::FirOpBuilder &, mlir::Location, mlir::Value,
diff --git a/flang/unittests/Optimizer/FIRTypesTest.cpp b/flang/unittests/Optimizer/FIRTypesTest.cpp
index 5ea621eebcdd4..238aa6939d5df 100644
--- a/flang/unittests/Optimizer/FIRTypesTest.cpp
+++ b/flang/unittests/Optimizer/FIRTypesTest.cpp
@@ -125,33 +125,33 @@ TEST_F(FIRTypesTest, isUnlimitedPolymorphicTypeTest) {
}
// Test fir::isBoxedRecordType from flang/Optimizer/Dialect/FIRType.h.
-// TEST_F(FIRTypesTest, isBoxedRecordType) {
-// mlir::Type recTy = fir::RecordType::get(&context, "dt");
-// mlir::Type seqRecTy =
-// fir::SequenceType::get({fir::SequenceType::getUnknownExtent()}, recTy);
-// mlir::Type ty = fir::BoxType::get(recTy);
-// EXPECT_TRUE(fir::isBoxedRecordType(ty));
-// EXPECT_TRUE(fir::isBoxedRecordType(fir::ReferenceType::get(ty)));
-
-// // TYPE(T), ALLOCATABLE
-// ty = fir::BoxType::get(fir::HeapType::get(recTy));
-// EXPECT_TRUE(fir::isBoxedRecordType(ty));
-
-// // TYPE(T), POINTER
-// ty = fir::BoxType::get(fir::PointerType::get(recTy));
-// EXPECT_TRUE(fir::isBoxedRecordType(ty));
-
-// // TYPE(T), DIMENSION(10)
-// ty = fir::BoxType::get(fir::SequenceType::get({10}, recTy));
-// EXPECT_TRUE(fir::isBoxedRecordType(ty));
-
-// // TYPE(T), DIMENSION(:)
-// ty = fir::BoxType::get(seqRecTy);
-// EXPECT_TRUE(fir::isBoxedRecordType(ty));
-
-// EXPECT_FALSE(fir::isBoxedRecordType(fir::BoxType::get(
-// fir::ReferenceType::get(mlir::IntegerType::get(&context, 32)))));
-// }
+TEST_F(FIRTypesTest, isBoxedRecordType) {
+ mlir::Type recTy = fir::RecordType::get(&context, "dt");
+ mlir::Type seqRecTy =
+ fir::SequenceType::get({fir::SequenceType::getUnknownExtent()}, recTy);
+ mlir::Type ty = fir::BoxType::get(recTy);
+ EXPECT_TRUE(fir::isBoxedRecordType(ty));
+ EXPECT_TRUE(fir::isBoxedRecordType(fir::ReferenceType::get(ty)));
+
+ // TYPE(T), ALLOCATABLE
+ ty = fir::BoxType::get(fir::HeapType::get(recTy));
+ EXPECT_TRUE(fir::isBoxedRecordType(ty));
+
+ // TYPE(T), POINTER
+ ty = fir::BoxType::get(fir::PointerType::get(recTy));
+ EXPECT_TRUE(fir::isBoxedRecordType(ty));
+
+ // TYPE(T), DIMENSION(10)
+ ty = fir::BoxType::get(fir::SequenceType::get({10}, recTy));
+ EXPECT_TRUE(fir::isBoxedRecordType(ty));
+
+ // TYPE(T), DIMENSION(:)
+ ty = fir::BoxType::get(seqRecTy);
+ EXPECT_TRUE(fir::isBoxedRecordType(ty));
+
+ EXPECT_FALSE(fir::isBoxedRecordType(fir::BoxType::get(
+ fir::ReferenceType::get(mlir::IntegerType::get(&context, 32)))));
+}
// Test fir::isScalarBoxedRecordType from flang/Optimizer/Dialect/FIRType.h.
TEST_F(FIRTypesTest, isScalarBoxedRecordType) {
diff --git a/flang/unittests/Optimizer/FortranVariableTest.cpp b/flang/unittests/Optimizer/FortranVariableTest.cpp
index ae48cdb18533e..87efb624735cf 100644
--- a/flang/unittests/Optimizer/FortranVariableTest.cpp
+++ b/flang/unittests/Optimizer/FortranVariableTest.cpp
@@ -42,29 +42,29 @@ struct FortranVariableTest : public testing::Test {
std::unique_ptr<mlir::OpBuilder> builder;
};
-// TEST_F(FortranVariableTest, SimpleScalar) {
-// mlir::Location loc = getLoc();
-// mlir::Type eleType = mlir::FloatType::getF32(&context);
-// mlir::Value addr = builder->create<fir::AllocaOp>(loc, eleType);
-// auto name = mlir::StringAttr::get(&context, "x");
-// auto declare = builder->create<fir::DeclareOp>(loc, addr.getType(), addr,
-// /*shape=*/mlir::Value{}, /*typeParams=*/std::nullopt,
-// /*dummy_scope=*/nullptr, name,
-// /*fortran_attrs=*/fir::FortranVariableFlagsAttr{},
-// /*data_attr=*/cuf::DataAttributeAttr{});
+TEST_F(FortranVariableTest, SimpleScalar) {
+ mlir::Location loc = getLoc();
+ mlir::Type eleType = mlir::FloatType::getF32(&context);
+ mlir::Value addr = builder->create<fir::AllocaOp>(loc, eleType);
+ auto name = mlir::StringAttr::get(&context, "x");
+ auto declare = builder->create<fir::DeclareOp>(loc, addr.getType(), addr,
+ /*shape=*/mlir::Value{}, /*typeParams=*/std::nullopt,
+ /*dummy_scope=*/nullptr, name,
+ /*fortran_attrs=*/fir::FortranVariableFlagsAttr{},
+ /*data_attr=*/cuf::DataAttributeAttr{});
-// fir::FortranVariableOpInterface fortranVariable = declare;
-// EXPECT_FALSE(fortranVariable.isArray());
-// EXPECT_FALSE(fortranVariable.isCharacter());
-// EXPECT_FALSE(fortranVariable.isPointer());
-// EXPECT_FALSE(fortranVariable.isAllocatable());
-// EXPECT_FALSE(fortranVariable.hasExplicitCharLen());
-// EXPECT_EQ(fortranVariable.getElementType(), eleType);
-// EXPECT_EQ(fortranVariable.getElementOrSequenceType(),
-// fortranVariable.getElementType());
-// EXPECT_NE(fortranVariable.getBase(), addr);
-// EXPECT_EQ(fortranVariable.getBase().getType(), addr.getType());
-// }
+ fir::FortranVariableOpInterface fortranVariable = declare;
+ EXPECT_FALSE(fortranVariable.isArray());
+ EXPECT_FALSE(fortranVariable.isCharacter());
+ EXPECT_FALSE(fortranVariable.isPointer());
+ EXPECT_FALSE(fortranVariable.isAllocatable());
+ EXPECT_FALSE(fortranVariable.hasExplicitCharLen());
+ EXPECT_EQ(fortranVariable.getElementType(), eleType);
+ EXPECT_EQ(fortranVariable.getElementOrSequenceType(),
+ fortranVariable.getElementType());
+ EXPECT_NE(fortranVariable.getBase(), addr);
+ EXPECT_EQ(fortranVariable.getBase().getType(), addr.getType());
+}
TEST_F(FortranVariableTest, CharacterScalar) {
mlir::Location loc = getLoc();
diff --git a/flang/unittests/Optimizer/InternalNamesTest.cpp b/flang/unittests/Optimizer/InternalNamesTest.cpp
index 470791d41541a..058bbeef9b007 100644
--- a/flang/unittests/Optimizer/InternalNamesTest.cpp
+++ b/flang/unittests/Optimizer/InternalNamesTest.cpp
@@ -88,38 +88,38 @@ TEST(InternalNamesTest, doTypeTest) {
ASSERT_EQ(actual, expectedMangledName);
}
-// TEST(InternalNamesTest, doIntrinsicTypeDescriptorTest) {
-// using IntrinsicType = fir::NameUniquer::IntrinsicType;
-// std::string actual = NameUniquer::doIntrinsicTypeDescriptor(
-// {}, {}, 0, IntrinsicType::REAL, 42);
-// std::string expectedMangledName = "_QYIrealK42";
-// ASSERT_EQ(actual, expectedMangledName);
-
-// actual = NameUniquer::doIntrinsicTypeDescriptor(
-// {}, {}, 0, IntrinsicType::REAL, {});
-// expectedMangledName = "_QYIrealK0";
-// ASSERT_EQ(actual, expectedMangledName);
-
-// actual = NameUniquer::doIntrinsicTypeDescriptor(
-// {}, {}, 0, IntrinsicType::INTEGER, 3);
-// expectedMangledName = "_QYIintegerK3";
-// ASSERT_EQ(actual, expectedMangledName);
-
-// actual = NameUniquer::doIntrinsicTypeDescriptor(
-// {}, {}, 0, IntrinsicType::LOGICAL, 2);
-// expectedMangledName = "_QYIlogicalK2";
-// ASSERT_EQ(actual, expectedMangledName);
-
-// actual = NameUniquer::doIntrinsicTypeDescriptor(
-// {}, {}, 0, IntrinsicType::CHARACTER, 4);
-// expectedMangledName = "_QYIcharacterK4";
-// ASSERT_EQ(actual, expectedMangledName);
-
-// actual = NameUniquer::doIntrinsicTypeDescriptor(
-// {}, {}, 0, IntrinsicType::COMPLEX, 4);
-// expectedMangledName = "_QYIcomplexK4";
-// ASSERT_EQ(actual, expectedMangledName);
-// }
+TEST(InternalNamesTest, doIntrinsicTypeDescriptorTest) {
+ using IntrinsicType = fir::NameUniquer::IntrinsicType;
+ std::string actual = NameUniquer::doIntrinsicTypeDescriptor(
+ {}, {}, 0, IntrinsicType::REAL, 42);
+ std::string expectedMangledName = "_QYIrealK42";
+ ASSERT_EQ(actual, expectedMangledName);
+
+ actual = NameUniquer::doIntrinsicTypeDescriptor(
+ {}, {}, 0, IntrinsicType::REAL, {});
+ expectedMangledName = "_QYIrealK0";
+ ASSERT_EQ(actual, expectedMangledName);
+
+ actual = NameUniquer::doIntrinsicTypeDescriptor(
+ {}, {}, 0, IntrinsicType::INTEGER, 3);
+ expectedMangledName = "_QYIintegerK3";
+ ASSERT_EQ(actual, expectedMangledName);
+
+ actual = NameUniquer::doIntrinsicTypeDescriptor(
+ {}, {}, 0, IntrinsicType::LOGICAL, 2);
+ expectedMangledName = "_QYIlogicalK2";
+ ASSERT_EQ(actual, expectedMangledName);
+
+ actual = NameUniquer::doIntrinsicTypeDescriptor(
+ {}, {}, 0, IntrinsicType::CHARACTER, 4);
+ expectedMangledName = "_QYIcharacterK4";
+ ASSERT_EQ(actual, expectedMangledName);
+
+ actual = NameUniquer::doIntrinsicTypeDescriptor(
+ {}, {}, 0, IntrinsicType::COMPLEX, 4);
+ expectedMangledName = "_QYIcomplexK4";
+ ASSERT_EQ(actual, expectedMangledName);
+}
TEST(InternalNamesTest, doDispatchTableTest) {
std::string actual =
diff --git a/flang/unittests/Runtime/CharacterTest.cpp b/flang/unittests/Runtime/CharacterTest.cpp
index e9522fae9a2c8..e54fd8a5075f6 100644
--- a/flang/unittests/Runtime/CharacterTest.cpp
+++ b/flang/unittests/Runtime/CharacterTest.cpp
@@ -199,32 +199,32 @@ struct CharacterComparisonTests : public ::testing::Test {
TYPED_TEST_SUITE(CharacterComparisonTests, CharacterTypes, );
-// TYPED_TEST(CharacterComparisonTests, CompareCharacters) {
-// for (auto &[x, y, xBytes, yBytes, expect] : this->parameters) {
-// int cmp{this->characterComparisonFunc(x, y, xBytes, yBytes)};
-// TypeParam buf[2][8];
-// std::memset(buf, 0, sizeof buf);
-// std::memcpy(buf[0], x, xBytes);
-// std::memcpy(buf[1], y, yBytes);
-// ASSERT_EQ(cmp, expect) << "compare '" << x << "'(" << xBytes << ") to '"
-// << y << "'(" << yBytes << "), got " << cmp
-// << ", should be " << expect << '\n';
-
-// // Perform the same test with the parameters reversed and the difference
-// // negated
-// std::swap(x, y);
-// std::swap(xBytes, yBytes);
-// expect = -expect;
-
-// cmp = this->characterComparisonFunc(x, y, xBytes, yBytes);
-// std::memset(buf, 0, sizeof buf);
-// std::memcpy(buf[0], x, xBytes);
-// std::memcpy(buf[1], y, yBytes);
-// ASSERT_EQ(cmp, expect) << "compare '" << x << "'(" << xBytes << ") to '"
-// << y << "'(" << yBytes << "'), got " << cmp
-// << ", should be " << expect << '\n';
-// }
-// }
+TYPED_TEST(CharacterComparisonTests, CompareCharacters) {
+ for (auto &[x, y, xBytes, yBytes, expect] : this->parameters) {
+ int cmp{this->characterComparisonFunc(x, y, xBytes, yBytes)};
+ TypeParam buf[2][8];
+ std::memset(buf, 0, sizeof buf);
+ std::memcpy(buf[0], x, xBytes);
+ std::memcpy(buf[1], y, yBytes);
+ ASSERT_EQ(cmp, expect) << "compare '" << x << "'(" << xBytes << ") to '"
+ << y << "'(" << yBytes << "), got " << cmp
+ << ", should be " << expect << '\n';
+
+ // Perform the same test with the parameters reversed and the difference
+ // negated
+ std::swap(x, y);
+ std::swap(xBytes, yBytes);
+ expect = -expect;
+
+ cmp = this->characterComparisonFunc(x, y, xBytes, yBytes);
+ std::memset(buf, 0, sizeof buf);
+ std::memcpy(buf[0], x, xBytes);
+ std::memcpy(buf[1], y, yBytes);
+ ASSERT_EQ(cmp, expect) << "compare '" << x << "'(" << xBytes << ") to '"
+ << y << "'(" << yBytes << "'), got " << cmp
+ << ", should be " << expect << '\n';
+ }
+}
// Test MIN() and MAX()
struct ExtremumTestCase {
@@ -275,14 +275,14 @@ TYPED_TEST(ExtremumTests, MinTests) {
RunExtremumTests<TypeParam>("MIN", RTNAME(CharacterMin), tests);
}
-// TYPED_TEST(ExtremumTests, MaxTests) {
-// static std::vector<ExtremumTestCase> tests{
-// {{}, {"a"}, {"z"}, {"z"}},
-// {{1}, {"zaa"}, {"aaaaa"}, {"zaa "}},
-// {{1, 1, 1}, {"aaaaa"}, {"aazaa"}, {"aazaa"}},
-// };
-// RunExtremumTests<TypeParam>("MAX", RTNAME(CharacterMax), tests);
-// }
+TYPED_TEST(ExtremumTests, MaxTests) {
+ static std::vector<ExtremumTestCase> tests{
+ {{}, {"a"}, {"z"}, {"z"}},
+ {{1}, {"zaa"}, {"aaaaa"}, {"zaa "}},
+ {{1, 1, 1}, {"aaaaa"}, {"aazaa"}, {"aazaa"}},
+ };
+ RunExtremumTests<TypeParam>("MAX", RTNAME(CharacterMax), tests);
+}
template <typename CHAR>
void RunAllocationTest(const char *xRaw, const char *yRaw) {
@@ -373,20 +373,20 @@ TYPED_TEST(SearchTests, ScanTests) {
RunSearchTests("SCAN", tests, std::get<SearchFunction<TypeParam>>(functions));
}
-// TYPED_TEST(SearchTests, VerifyTests) {
-// static SearchFunctions functions{
-// RTNAME(Verify1), RTNAME(Verify2), RTNAME(Verify4)};
-// static std::vector<SearchTestCase> tests{
-// {"abc", "abc", false, 0},
-// {"abc", "abc", true, 0},
-// {"abc", "cde", false, 1},
-// {"abc", "cde", true, 2},
-// {"abc", "x", false, 1},
-// {"", "x", false, 0},
-// };
-// RunSearchTests(
-// "VERIFY", tests, std::get<SearchFunction<TypeParam>>(functions));
-// }
+TYPED_TEST(SearchTests, VerifyTests) {
+ static SearchFunctions functions{
+ RTNAME(Verify1), RTNAME(Verify2), RTNAME(Verify4)};
+ static std::vector<SearchTestCase> tests{
+ {"abc", "abc", false, 0},
+ {"abc", "abc", true, 0},
+ {"abc", "cde", false, 1},
+ {"abc", "cde", true, 2},
+ {"abc", "x", false, 1},
+ {"", "x", false, 0},
+ };
+ RunSearchTests(
+ "VERIFY", tests, std::get<SearchFunction<TypeParam>>(functions));
+}
// Test REPEAT()
template <typename CHAR> struct RepeatTests : public ::testing::Test {};
diff --git a/flang/unittests/Runtime/CommandTest.cpp b/flang/unittests/Runtime/CommandTest.cpp
index c67eb091d0b11..08daa4ba37f26 100644
--- a/flang/unittests/Runtime/CommandTest.cpp
+++ b/flang/unittests/Runtime/CommandTest.cpp
@@ -308,21 +308,21 @@ TEST_F(ZeroArguments, GetCommandArgument) {
TEST_F(ZeroArguments, GetCommand) { CheckCommandValue(commandOnlyArgv, 1); }
-// TEST_F(ZeroArguments, ECLValidCommandAndPadSync) {
-// OwningPtr<Descriptor> command{CharDescriptor("echo hi")};
-// bool wait{true};
-// OwningPtr<Descriptor> exitStat{EmptyIntDescriptor()};
-// OwningPtr<Descriptor> cmdStat{EmptyIntDescriptor()};
-// OwningPtr<Descriptor> cmdMsg{CharDescriptor("No change")};
-
-// RTNAME(ExecuteCommandLine)
-// (*command.get(), wait, exitStat.get(), cmdStat.get(), cmdMsg.get());
-
-// std::string spaces(cmdMsg->ElementBytes(), ' ');
-// CheckDescriptorEqInt<std::int64_t>(exitStat.get(), 0);
-// CheckDescriptorEqInt<std::int64_t>(cmdStat.get(), 0);
-// CheckDescriptorEqStr(cmdMsg.get(), "No change");
-// }
+TEST_F(ZeroArguments, ECLValidCommandAndPadSync) {
+ OwningPtr<Descriptor> command{CharDescriptor("echo hi")};
+ bool wait{true};
+ OwningPtr<Descriptor> exitStat{EmptyIntDescriptor()};
+ OwningPtr<Descriptor> cmdStat{EmptyIntDescriptor()};
+ OwningPtr<Descriptor> cmdMsg{CharDescriptor("No change")};
+
+ RTNAME(ExecuteCommandLine)
+ (*command.get(), wait, exitStat.get(), cmdStat.get(), cmdMsg.get());
+
+ std::string spaces(cmdMsg->ElementBytes(), ' ');
+ CheckDescriptorEqInt<std::int64_t>(exitStat.get(), 0);
+ CheckDescriptorEqInt<std::int64_t>(cmdStat.get(), 0);
+ CheckDescriptorEqStr(cmdMsg.get(), "No change");
+}
TEST_F(ZeroArguments, ECLValidCommandStatusSetSync) {
OwningPtr<Descriptor> command{CharDescriptor("echo hi")};
@@ -404,14 +404,14 @@ TEST_F(ZeroArguments, ECLInvalidCommandParentNotTerminatedAsync) {
CheckDescriptorEqStr(cmdMsg.get(), "No change");
}
-// TEST_F(ZeroArguments, ECLInvalidCommandAsyncDontAffectSync) {
-// OwningPtr<Descriptor> command{CharDescriptor("echo hi")};
+TEST_F(ZeroArguments, ECLInvalidCommandAsyncDontAffectSync) {
+ OwningPtr<Descriptor> command{CharDescriptor("echo hi")};
-// EXPECT_NO_FATAL_FAILURE(RTNAME(ExecuteCommandLine)(
-// *command.get(), false, nullptr, nullptr, nullptr));
-// EXPECT_NO_FATAL_FAILURE(RTNAME(ExecuteCommandLine)(
-// *command.get(), true, nullptr, nullptr, nullptr));
-// }
+ EXPECT_NO_FATAL_FAILURE(RTNAME(ExecuteCommandLine)(
+ *command.get(), false, nullptr, nullptr, nullptr));
+ EXPECT_NO_FATAL_FAILURE(RTNAME(ExecuteCommandLine)(
+ *command.get(), true, nullptr, nullptr, nullptr));
+}
TEST_F(ZeroArguments, ECLInvalidCommandAsyncDontAffectAsync) {
OwningPtr<Descriptor> command{CharDescriptor("echo hi")};
@@ -560,18 +560,18 @@ TEST_F(SeveralArguments, GetCommand) {
CheckMissingCommandValue("Missing argument");
}
-// TEST_F(SeveralArguments, CommandErrMsgTooShort) {
-// OwningPtr<Descriptor> value{CreateEmptyCharDescriptor()};
-// OwningPtr<Descriptor> length{EmptyIntDescriptor()};
-// OwningPtr<Descriptor> errMsg{CreateEmptyCharDescriptor<3>()};
+TEST_F(SeveralArguments, CommandErrMsgTooShort) {
+ OwningPtr<Descriptor> value{CreateEmptyCharDescriptor()};
+ OwningPtr<Descriptor> length{EmptyIntDescriptor()};
+ OwningPtr<Descriptor> errMsg{CreateEmptyCharDescriptor<3>()};
-// EXPECT_GT(RTNAME(GetCommand)(value.get(), length.get(), errMsg.get()), 0);
+ EXPECT_GT(RTNAME(GetCommand)(value.get(), length.get(), errMsg.get()), 0);
-// std::string spaces(value->ElementBytes(), ' ');
-// CheckDescriptorEqStr(value.get(), spaces);
-// CheckDescriptorEqInt<std::int64_t>(length.get(), 0);
-// CheckDescriptorEqStr(errMsg.get(), "Mis");
-// }
+ std::string spaces(value->ElementBytes(), ' ');
+ CheckDescriptorEqStr(value.get(), spaces);
+ CheckDescriptorEqInt<std::int64_t>(length.get(), 0);
+ CheckDescriptorEqStr(errMsg.get(), "Mis");
+}
TEST_F(SeveralArguments, GetCommandCanTakeNull) {
EXPECT_GT(RTNAME(GetCommand)(nullptr, nullptr, nullptr), 0);
@@ -700,11 +700,11 @@ TEST_F(EnvironmentVariables, NoTrim) {
}
}
-// TEST_F(EnvironmentVariables, Empty) {
-// if (EnableFineGrainedTests()) {
-// CheckEnvVarValue("", "EMPTY");
-// }
-// }
+TEST_F(EnvironmentVariables, Empty) {
+ if (EnableFineGrainedTests()) {
+ CheckEnvVarValue("", "EMPTY");
+ }
+}
TEST_F(EnvironmentVariables, NoValueOrErrmsg) {
ASSERT_EQ(std::getenv("DOESNT_EXIST"), nullptr)
diff --git a/flang/unittests/Runtime/Complex.cpp b/flang/unittests/Runtime/Complex.cpp
index f87b890c825d3..46f3ad2f2712b 100644
--- a/flang/unittests/Runtime/Complex.cpp
+++ b/flang/unittests/Runtime/Complex.cpp
@@ -133,23 +133,23 @@ TEST(Complex, cpowk) {
cpowk(0.f + 1if, std::numeric_limits<std::int64_t>::min()), 1.f + 0if);
}
-// TEST(Complex, zpowi) {
-// EXPECT_COMPLEX_DOUBLE_EQ(zpowi(3. + 4i, 0), 1. + 0i);
-// EXPECT_COMPLEX_DOUBLE_EQ(zpowi(3. + 4i, 1), 3. + 4i);
-// EXPECT_COMPLEX_DOUBLE_EQ(zpowi(3. + 4i, 2), -7. + 24i);
-// EXPECT_COMPLEX_DOUBLE_EQ(zpowi(3. + 4i, 3), -117. + 44i);
-// EXPECT_COMPLEX_DOUBLE_EQ(zpowi(3. + 4i, 4), -527. - 336i);
-
-// EXPECT_COMPLEX_DOUBLE_EQ(zpowi(3. + 4i, -2), -0.0112 - 0.0384i);
-// EXPECT_COMPLEX_DOUBLE_EQ(zpowi(2. + 1i, 10), -237. - 3116i);
-// EXPECT_COMPLEX_DOUBLE_EQ(zpowi(0.5 + 0.6i, -10), -9.32293628 - 7.29848564i);
-
-// EXPECT_COMPLEX_DOUBLE_EQ(zpowi(2. + 1i, 5), -38. + 41i);
-// EXPECT_COMPLEX_DOUBLE_EQ(zpowi(0.5 + 0.6i, -5), -1.12183773 + 3.25291503i);
-
-// EXPECT_COMPLEX_DOUBLE_EQ(
-// zpowi(0. + 1i, std::numeric_limits<std::int32_t>::min()), 1. + 0i);
-// }
+TEST(Complex, zpowi) {
+ EXPECT_COMPLEX_DOUBLE_EQ(zpowi(3. + 4i, 0), 1. + 0i);
+ EXPECT_COMPLEX_DOUBLE_EQ(zpowi(3. + 4i, 1), 3. + 4i);
+ EXPECT_COMPLEX_DOUBLE_EQ(zpowi(3. + 4i, 2), -7. + 24i);
+ EXPECT_COMPLEX_DOUBLE_EQ(zpowi(3. + 4i, 3), -117. + 44i);
+ EXPECT_COMPLEX_DOUBLE_EQ(zpowi(3. + 4i, 4), -527. - 336i);
+
+ EXPECT_COMPLEX_DOUBLE_EQ(zpowi(3. + 4i, -2), -0.0112 - 0.0384i);
+ EXPECT_COMPLEX_DOUBLE_EQ(zpowi(2. + 1i, 10), -237. - 3116i);
+ EXPECT_COMPLEX_DOUBLE_EQ(zpowi(0.5 + 0.6i, -10), -9.32293628 - 7.29848564i);
+
+ EXPECT_COMPLEX_DOUBLE_EQ(zpowi(2. + 1i, 5), -38. + 41i);
+ EXPECT_COMPLEX_DOUBLE_EQ(zpowi(0.5 + 0.6i, -5), -1.12183773 + 3.25291503i);
+
+ EXPECT_COMPLEX_DOUBLE_EQ(
+ zpowi(0. + 1i, std::numeric_limits<std::int32_t>::min()), 1. + 0i);
+}
TEST(Complex, zpowk) {
EXPECT_COMPLEX_DOUBLE_EQ(zpowk(3. + 4i, 0), 1. + 0i);
diff --git a/flang/unittests/Runtime/ExternalIOTest.cpp b/flang/unittests/Runtime/ExternalIOTest.cpp
index 0f3da0784f9d4..13327964e12a4 100644
--- a/flang/unittests/Runtime/ExternalIOTest.cpp
+++ b/flang/unittests/Runtime/ExternalIOTest.cpp
@@ -585,103 +585,103 @@ TEST(ExternalIOTests, TestNonAvancingInput) {
<< "EndIoStatement() for Close";
}
-// TEST(ExternalIOTests, TestWriteAfterNonAvancingInput) {
-// // OPEN(NEWUNIT=unit,ACCESS='SEQUENTIAL',ACTION='READWRITE',&
-// // FORM='FORMATTED',STATUS='SCRATCH')
-// auto *io{IONAME(BeginOpenNewUnit)(__FILE__, __LINE__)};
-// ASSERT_TRUE(IONAME(SetAccess)(io, "SEQUENTIAL", 10))
-// << "SetAccess(SEQUENTIAL)";
-// ASSERT_TRUE(IONAME(SetAction)(io, "READWRITE", 9)) << "SetAction(READWRITE)";
-// ASSERT_TRUE(IONAME(SetForm)(io, "FORMATTED", 9)) << "SetForm(FORMATTED)";
-// ASSERT_TRUE(IONAME(SetStatus)(io, "SCRATCH", 7)) << "SetStatus(SCRATCH)";
-
-// int unit{-1};
-// ASSERT_TRUE(IONAME(GetNewUnit)(io, unit)) << "GetNewUnit()";
-// ASSERT_EQ(IONAME(EndIoStatement)(io), IostatOk)
-// << "EndIoStatement() for OpenNewUnit";
-
-// // Write the file to be used for the input test.
-// static constexpr std::string_view records[] = {"ABCDEFGHIJKLMNOPQRST"};
-// static constexpr std::string_view fmt{"(A)"};
-// for (const auto &record : records) {
-// // WRITE(UNIT=unit,FMT=fmt) record
-// io = IONAME(BeginExternalFormattedOutput)(
-// fmt.data(), fmt.length(), nullptr, unit, __FILE__, __LINE__);
-// ASSERT_TRUE(IONAME(OutputAscii)(io, record.data(), record.length()))
-// << "OutputAscii()";
-// ASSERT_EQ(IONAME(EndIoStatement)(io), IostatOk)
-// << "EndIoStatement() for OutputAscii";
-// }
-
-// // REWIND(UNIT=unit)
-// io = IONAME(BeginRewind)(unit, __FILE__, __LINE__);
-// ASSERT_EQ(IONAME(EndIoStatement)(io), IostatOk)
-// << "EndIoStatement() for Rewind";
-
-// struct TestItems {
-// std::string item;
-// int expectedIoStat;
-// std::string expectedItemValue;
-// };
-// // Actual non advancing input IO test
-// TestItems inputItems[]{
-// {std::string(4, '+'), IostatOk, "ABCD"},
-// {std::string(4, '+'), IostatOk, "EFGH"},
-// };
-
-// int j{0};
-// for (auto &inputItem : inputItems) {
-// // READ(UNIT=unit, FMT=fmt, ADVANCE='NO', IOSTAT=iostat) inputItem
-// io = IONAME(BeginExternalFormattedInput)(
-// fmt.data(), fmt.length(), nullptr, unit, __FILE__, __LINE__);
-// IONAME(EnableHandlers)(io, true, false, false, false, false);
-// ASSERT_TRUE(IONAME(SetAdvance)(io, "NO", 2)) << "SetAdvance(NO)" << j;
-// ASSERT_TRUE(
-// IONAME(InputAscii)(io, inputItem.item.data(), inputItem.item.length()))
-// << "InputAscii() " << j;
-// ASSERT_EQ(IONAME(EndIoStatement)(io), inputItem.expectedIoStat)
-// << "EndIoStatement() for Read " << j;
-// ASSERT_EQ(inputItem.item, inputItem.expectedItemValue)
-// << "Input-item value after non advancing read " << j;
-// j++;
-// }
-
-// // WRITE(UNIT=unit, FMT=fmt, IOSTAT=iostat) outputItem.
-// static constexpr std::string_view outputItem{"XYZ"};
-// // WRITE(UNIT=unit,FMT=fmt) record
-// io = IONAME(BeginExternalFormattedOutput)(
-// fmt.data(), fmt.length(), nullptr, unit, __FILE__, __LINE__);
-// ASSERT_TRUE(IONAME(OutputAscii)(io, outputItem.data(), outputItem.length()))
-// << "OutputAscii()";
-// ASSERT_EQ(IONAME(EndIoStatement)(io), IostatOk)
-// << "EndIoStatement() for OutputAscii";
-
-// // Verify that the output was written in the record read in non advancing
-// // mode, after the read part, and that the end was truncated.
-
-// // REWIND(UNIT=unit)
-// io = IONAME(BeginRewind)(unit, __FILE__, __LINE__);
-// ASSERT_EQ(IONAME(EndIoStatement)(io), IostatOk)
-// << "EndIoStatement() for Rewind";
-
-// std::string resultRecord(20, '+');
-// std::string expectedRecord{"ABCDEFGHXYZ "};
-// // READ(UNIT=unit, FMT=fmt, IOSTAT=iostat) result
-// io = IONAME(BeginExternalFormattedInput)(
-// fmt.data(), fmt.length(), nullptr, unit, __FILE__, __LINE__);
-// IONAME(EnableHandlers)(io, true, false, false, false, false);
-// ASSERT_TRUE(
-// IONAME(InputAscii)(io, resultRecord.data(), resultRecord.length()))
-// << "InputAscii() ";
-// ASSERT_EQ(IONAME(EndIoStatement)(io), IostatOk)
-// << "EndIoStatement() for Read ";
-// ASSERT_EQ(resultRecord, expectedRecord)
-// << "Record after non advancing read followed by write";
-// // CLOSE(UNIT=unit)
-// io = IONAME(BeginClose)(unit, __FILE__, __LINE__);
-// ASSERT_EQ(IONAME(EndIoStatement)(io), IostatOk)
-// << "EndIoStatement() for Close";
-// }
+TEST(ExternalIOTests, TestWriteAfterNonAvancingInput) {
+ // OPEN(NEWUNIT=unit,ACCESS='SEQUENTIAL',ACTION='READWRITE',&
+ // FORM='FORMATTED',STATUS='SCRATCH')
+ auto *io{IONAME(BeginOpenNewUnit)(__FILE__, __LINE__)};
+ ASSERT_TRUE(IONAME(SetAccess)(io, "SEQUENTIAL", 10))
+ << "SetAccess(SEQUENTIAL)";
+ ASSERT_TRUE(IONAME(SetAction)(io, "READWRITE", 9)) << "SetAction(READWRITE)";
+ ASSERT_TRUE(IONAME(SetForm)(io, "FORMATTED", 9)) << "SetForm(FORMATTED)";
+ ASSERT_TRUE(IONAME(SetStatus)(io, "SCRATCH", 7)) << "SetStatus(SCRATCH)";
+
+ int unit{-1};
+ ASSERT_TRUE(IONAME(GetNewUnit)(io, unit)) << "GetNewUnit()";
+ ASSERT_EQ(IONAME(EndIoStatement)(io), IostatOk)
+ << "EndIoStatement() for OpenNewUnit";
+
+ // Write the file to be used for the input test.
+ static constexpr std::string_view records[] = {"ABCDEFGHIJKLMNOPQRST"};
+ static constexpr std::string_view fmt{"(A)"};
+ for (const auto &record : records) {
+ // WRITE(UNIT=unit,FMT=fmt) record
+ io = IONAME(BeginExternalFormattedOutput)(
+ fmt.data(), fmt.length(), nullptr, unit, __FILE__, __LINE__);
+ ASSERT_TRUE(IONAME(OutputAscii)(io, record.data(), record.length()))
+ << "OutputAscii()";
+ ASSERT_EQ(IONAME(EndIoStatement)(io), IostatOk)
+ << "EndIoStatement() for OutputAscii";
+ }
+
+ // REWIND(UNIT=unit)
+ io = IONAME(BeginRewind)(unit, __FILE__, __LINE__);
+ ASSERT_EQ(IONAME(EndIoStatement)(io), IostatOk)
+ << "EndIoStatement() for Rewind";
+
+ struct TestItems {
+ std::string item;
+ int expectedIoStat;
+ std::string expectedItemValue;
+ };
+ // Actual non advancing input IO test
+ TestItems inputItems[]{
+ {std::string(4, '+'), IostatOk, "ABCD"},
+ {std::string(4, '+'), IostatOk, "EFGH"},
+ };
+
+ int j{0};
+ for (auto &inputItem : inputItems) {
+ // READ(UNIT=unit, FMT=fmt, ADVANCE='NO', IOSTAT=iostat) inputItem
+ io = IONAME(BeginExternalFormattedInput)(
+ fmt.data(), fmt.length(), nullptr, unit, __FILE__, __LINE__);
+ IONAME(EnableHandlers)(io, true, false, false, false, false);
+ ASSERT_TRUE(IONAME(SetAdvance)(io, "NO", 2)) << "SetAdvance(NO)" << j;
+ ASSERT_TRUE(
+ IONAME(InputAscii)(io, inputItem.item.data(), inputItem.item.length()))
+ << "InputAscii() " << j;
+ ASSERT_EQ(IONAME(EndIoStatement)(io), inputItem.expectedIoStat)
+ << "EndIoStatement() for Read " << j;
+ ASSERT_EQ(inputItem.item, inputItem.expectedItemValue)
+ << "Input-item value after non advancing read " << j;
+ j++;
+ }
+
+ // WRITE(UNIT=unit, FMT=fmt, IOSTAT=iostat) outputItem.
+ static constexpr std::string_view outputItem{"XYZ"};
+ // WRITE(UNIT=unit,FMT=fmt) record
+ io = IONAME(BeginExternalFormattedOutput)(
+ fmt.data(), fmt.length(), nullptr, unit, __FILE__, __LINE__);
+ ASSERT_TRUE(IONAME(OutputAscii)(io, outputItem.data(), outputItem.length()))
+ << "OutputAscii()";
+ ASSERT_EQ(IONAME(EndIoStatement)(io), IostatOk)
+ << "EndIoStatement() for OutputAscii";
+
+ // Verify that the output was written in the record read in non advancing
+ // mode, after the read part, and that the end was truncated.
+
+ // REWIND(UNIT=unit)
+ io = IONAME(BeginRewind)(unit, __FILE__, __LINE__);
+ ASSERT_EQ(IONAME(EndIoStatement)(io), IostatOk)
+ << "EndIoStatement() for Rewind";
+
+ std::string resultRecord(20, '+');
+ std::string expectedRecord{"ABCDEFGHXYZ "};
+ // READ(UNIT=unit, FMT=fmt, IOSTAT=iostat) result
+ io = IONAME(BeginExternalFormattedInput)(
+ fmt.data(), fmt.length(), nullptr, unit, __FILE__, __LINE__);
+ IONAME(EnableHandlers)(io, true, false, false, false, false);
+ ASSERT_TRUE(
+ IONAME(InputAscii)(io, resultRecord.data(), resultRecord.length()))
+ << "InputAscii() ";
+ ASSERT_EQ(IONAME(EndIoStatement)(io), IostatOk)
+ << "EndIoStatement() for Read ";
+ ASSERT_EQ(resultRecord, expectedRecord)
+ << "Record after non advancing read followed by write";
+ // CLOSE(UNIT=unit)
+ io = IONAME(BeginClose)(unit, __FILE__, __LINE__);
+ ASSERT_EQ(IONAME(EndIoStatement)(io), IostatOk)
+ << "EndIoStatement() for Close";
+}
TEST(ExternalIOTests, TestWriteAfterEndfile) {
// OPEN(NEWUNIT=unit,ACCESS='SEQUENTIAL',ACTION='READWRITE',&
diff --git a/flang/unittests/Runtime/Format.cpp b/flang/unittests/Runtime/Format.cpp
index cdcdc19aff54a..01803c628de26 100644
--- a/flang/unittests/Runtime/Format.cpp
+++ b/flang/unittests/Runtime/Format.cpp
@@ -145,18 +145,18 @@ TEST(FormatTests, FormatStringTraversal) {
struct InvalidFormatFailure : CrashHandlerFixture {};
-// TEST(InvalidFormatFailure, ParenMismatch) {
-// static constexpr const char *format{"("};
-// static constexpr int repeat{1};
-
-// TestFormatContext context;
-// FormatControl<decltype(context)> control{
-// context, format, std::strlen(format)};
-
-// ASSERT_DEATH(
-// context.Report(/*edit=*/control.GetNextDataEdit(context, repeat)),
-// R"(FORMAT missing at least one '\)')");
-// }
+TEST(InvalidFormatFailure, ParenMismatch) {
+ static constexpr const char *format{"("};
+ static constexpr int repeat{1};
+
+ TestFormatContext context;
+ FormatControl<decltype(context)> control{
+ context, format, std::strlen(format)};
+
+ ASSERT_DEATH(
+ context.Report(/*edit=*/control.GetNextDataEdit(context, repeat)),
+ R"(FORMAT missing at least one '\)')");
+}
TEST(InvalidFormatFailure, MissingPrecision) {
static constexpr const char *format{"(F9.)"};
diff --git a/flang/unittests/Runtime/ListInputTest.cpp b/flang/unittests/Runtime/ListInputTest.cpp
index c53a10a0af640..a4eba5283add6 100644
--- a/flang/unittests/Runtime/ListInputTest.cpp
+++ b/flang/unittests/Runtime/ListInputTest.cpp
@@ -155,35 +155,35 @@ using ParamTy = std::tuple<std::string, std::vector<int>>;
struct SimpleListInputTest : testing::TestWithParam<ParamTy> {};
-// TEST_P(SimpleListInputTest, TestListInput) {
-// auto [formatBuffer, expectedOutput] = GetParam();
-// constexpr int numBuffers{1};
-
-// StaticDescriptor<1> staticDescriptor;
-// Descriptor &whole{staticDescriptor.descriptor()};
-// SubscriptValue extent[]{numBuffers};
-// whole.Establish(TypeCode{CFI_type_char}, formatBuffer.size(),
-// formatBuffer.data(), 1, extent, CFI_attribute_pointer);
-// whole.Check();
-// auto *cookie{IONAME(BeginInternalArrayListInput)(whole)};
-
-// const auto listInputLength{expectedOutput.size()};
-// std::vector<std::int64_t> actualOutput(listInputLength);
-// for (std::size_t j = 0; j < listInputLength; ++j) {
-// IONAME(InputInteger)(cookie, actualOutput[j]);
-// }
-
-// const auto status{IONAME(EndIoStatement)(cookie)};
-// ASSERT_EQ(status, 0) << "list-directed input failed, status "
-// << static_cast<int>(status) << '\n';
-
-// // Verify the calls to _InputInteger_ resulted in _expectedOutput_
-// for (std::size_t j = 0; j < listInputLength; ++j) {
-// ASSERT_EQ(actualOutput[j], expectedOutput[j])
-// << "wanted actualOutput[" << j << "]==" << expectedOutput[j] << ", got "
-// << actualOutput[j] << '\n';
-// }
-// }
+TEST_P(SimpleListInputTest, TestListInput) {
+ auto [formatBuffer, expectedOutput] = GetParam();
+ constexpr int numBuffers{1};
+
+ StaticDescriptor<1> staticDescriptor;
+ Descriptor &whole{staticDescriptor.descriptor()};
+ SubscriptValue extent[]{numBuffers};
+ whole.Establish(TypeCode{CFI_type_char}, formatBuffer.size(),
+ formatBuffer.data(), 1, extent, CFI_attribute_pointer);
+ whole.Check();
+ auto *cookie{IONAME(BeginInternalArrayListInput)(whole)};
+
+ const auto listInputLength{expectedOutput.size()};
+ std::vector<std::int64_t> actualOutput(listInputLength);
+ for (std::size_t j = 0; j < listInputLength; ++j) {
+ IONAME(InputInteger)(cookie, actualOutput[j]);
+ }
+
+ const auto status{IONAME(EndIoStatement)(cookie)};
+ ASSERT_EQ(status, 0) << "list-directed input failed, status "
+ << static_cast<int>(status) << '\n';
+
+ // Verify the calls to _InputInteger_ resulted in _expectedOutput_
+ for (std::size_t j = 0; j < listInputLength; ++j) {
+ ASSERT_EQ(actualOutput[j], expectedOutput[j])
+ << "wanted actualOutput[" << j << "]==" << expectedOutput[j] << ", got "
+ << actualOutput[j] << '\n';
+ }
+}
INSTANTIATE_TEST_SUITE_P(SimpleListInputTestInstantiation, SimpleListInputTest,
testing::Values(std::make_tuple("", std::vector<int>{}),
diff --git a/flang/unittests/Runtime/MiscIntrinsic.cpp b/flang/unittests/Runtime/MiscIntrinsic.cpp
index 6dff30a5c1efc..7e19ed250bdc0 100644
--- a/flang/unittests/Runtime/MiscIntrinsic.cpp
+++ b/flang/unittests/Runtime/MiscIntrinsic.cpp
@@ -68,21 +68,21 @@ TEST(MiscIntrinsic, TransferSize) {
EXPECT_EQ(result.OffsetElement<float>()[1], 2.2F);
result.Destroy();
}
-// TEST(MiscIntrinsic, TransferSizeScalarMold) {
-// StaticDescriptor<2, true, 2> staticDesc[2];
-// auto &result{staticDesc[0].descriptor()};
-// std::complex<float> sourecStorage{1.1F, -2.2F};
-// auto source{Descriptor::Create(TypeCategory::Complex, 4,
-// reinterpret_cast<void *>(&sourecStorage), 0, nullptr,
-// CFI_attribute_pointer)};
-// auto &mold{staticDesc[1].descriptor()};
-// mold.Establish(TypeCategory::Real, 4, nullptr, 0, nullptr);
-// RTNAME(TransferSize)(result, *source, mold, __FILE__, __LINE__, 2);
-// EXPECT_EQ(result.rank(), 1);
-// EXPECT_EQ(result.GetDimension(0).LowerBound(), 1);
-// EXPECT_EQ(result.GetDimension(0).Extent(), 2);
-// EXPECT_EQ(result.type().raw(), (TypeCode{TypeCategory::Real, 4}.raw()));
-// EXPECT_EQ(result.OffsetElement<float>()[0], 1.1F);
-// EXPECT_EQ(result.OffsetElement<float>()[1], -2.2F);
-// result.Destroy();
-// }
+TEST(MiscIntrinsic, TransferSizeScalarMold) {
+ StaticDescriptor<2, true, 2> staticDesc[2];
+ auto &result{staticDesc[0].descriptor()};
+ std::complex<float> sourecStorage{1.1F, -2.2F};
+ auto source{Descriptor::Create(TypeCategory::Complex, 4,
+ reinterpret_cast<void *>(&sourecStorage), 0, nullptr,
+ CFI_attribute_pointer)};
+ auto &mold{staticDesc[1].descriptor()};
+ mold.Establish(TypeCategory::Real, 4, nullptr, 0, nullptr);
+ RTNAME(TransferSize)(result, *source, mold, __FILE__, __LINE__, 2);
+ EXPECT_EQ(result.rank(), 1);
+ EXPECT_EQ(result.GetDimension(0).LowerBound(), 1);
+ EXPECT_EQ(result.GetDimension(0).Extent(), 2);
+ EXPECT_EQ(result.type().raw(), (TypeCode{TypeCategory::Real, 4}.raw()));
+ EXPECT_EQ(result.OffsetElement<float>()[0], 1.1F);
+ EXPECT_EQ(result.OffsetElement<float>()[1], -2.2F);
+ result.Destroy();
+}
diff --git a/flang/unittests/Runtime/Numeric.cpp b/flang/unittests/Runtime/Numeric.cpp
index 98ec88abf9a93..b69ff21ea79fb 100644
--- a/flang/unittests/Runtime/Numeric.cpp
+++ b/flang/unittests/Runtime/Numeric.cpp
@@ -31,15 +31,15 @@ TEST(Numeric, Floor) {
EXPECT_EQ(RTNAME(Floor4_1)(Real<4>{0}), 0);
}
-// TEST(Numeric, Exponent) {
-// EXPECT_EQ(RTNAME(Exponent4_4)(Real<4>{0}), 0);
-// EXPECT_EQ(RTNAME(Exponent4_8)(Real<4>{1.0}), 1);
-// EXPECT_EQ(RTNAME(Exponent8_4)(Real<8>{4.1}), 3);
-// EXPECT_EQ(RTNAME(Exponent8_8)(std::numeric_limits<Real<8>>::infinity()),
-// std::numeric_limits<Int<8>>::max());
-// EXPECT_EQ(RTNAME(Exponent8_8)(std::numeric_limits<Real<8>>::quiet_NaN()),
-// std::numeric_limits<Int<8>>::max());
-// }
+TEST(Numeric, Exponent) {
+ EXPECT_EQ(RTNAME(Exponent4_4)(Real<4>{0}), 0);
+ EXPECT_EQ(RTNAME(Exponent4_8)(Real<4>{1.0}), 1);
+ EXPECT_EQ(RTNAME(Exponent8_4)(Real<8>{4.1}), 3);
+ EXPECT_EQ(RTNAME(Exponent8_8)(std::numeric_limits<Real<8>>::infinity()),
+ std::numeric_limits<Int<8>>::max());
+ EXPECT_EQ(RTNAME(Exponent8_8)(std::numeric_limits<Real<8>>::quiet_NaN()),
+ std::numeric_limits<Int<8>>::max());
+}
TEST(Numeric, Fraction) {
EXPECT_EQ(RTNAME(Fraction4)(Real<4>{0}), 0);
@@ -192,57 +192,57 @@ TEST(Numeric, SelectedIntKind) {
EXPECT_EQ(RTNAME(SelectedIntKind)(__FILE__, __LINE__, &r5, 4), -1);
}
-// TEST(Numeric, SelectedRealKind) {
-// std::int8_t p_s = 1;
-// std::int16_t p[11] = {-10, 1, 1, 4, 50, 1, 1, 4, 1, 1, 50};
-// std::int32_t r[11] = {-1, 1, 1, 1, 2, 1, 20, 20, 100, 5000, 5000};
-// std::int64_t d[11] = {2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2};
-// EXPECT_EQ(RTNAME(SelectedRealKind)(
-// __FILE__, __LINE__, &p[0], 2, &r[0], 4, &d[0], 8),
-// 2);
-// EXPECT_EQ(RTNAME(SelectedRealKind)(
-// __FILE__, __LINE__, &p[1], 2, &r[1], 4, &d[1], 8),
-// -5);
-// EXPECT_EQ(RTNAME(SelectedRealKind)(
-// __FILE__, __LINE__, &p[2], 2, &r[2], 4, &d[2], 8),
-// 2);
-// EXPECT_EQ(RTNAME(SelectedRealKind)(
-// __FILE__, __LINE__, &p[3], 2, &r[3], 4, &d[3], 8),
-// 4);
-// EXPECT_EQ(RTNAME(SelectedRealKind)(
-// __FILE__, __LINE__, &p[4], 2, &r[4], 4, &d[4], 8),
-// -1);
-// EXPECT_EQ(RTNAME(SelectedRealKind)(
-// __FILE__, __LINE__, &p[5], 2, &r[5], 4, &d[5], 8),
-// 2);
-// EXPECT_EQ(RTNAME(SelectedRealKind)(
-// __FILE__, __LINE__, &p[6], 2, &r[6], 4, &d[6], 8),
-// 3);
-// EXPECT_EQ(RTNAME(SelectedRealKind)(
-// __FILE__, __LINE__, &p[7], 2, &r[7], 4, &d[7], 8),
-// 4);
-// EXPECT_EQ(RTNAME(SelectedRealKind)(
-// __FILE__, __LINE__, &p[8], 2, &r[8], 4, &d[8], 8),
-// 8);
-// EXPECT_EQ(RTNAME(SelectedRealKind)(
-// __FILE__, __LINE__, &p[9], 2, &r[9], 4, &d[9], 8),
-// -2);
-// EXPECT_EQ(RTNAME(SelectedRealKind)(
-// __FILE__, __LINE__, &p[10], 2, &r[10], 4, &d[10], 8),
-// -3);
-// EXPECT_EQ(
-// RTNAME(SelectedRealKind)(__FILE__, __LINE__, &p_s, 1, &r[0], 4, &d[0], 8),
-// 2);
-// EXPECT_EQ(RTNAME(SelectedRealKind)(
-// __FILE__, __LINE__, nullptr, 0, &r[0], 4, &d[0], 8),
-// 2);
-// EXPECT_EQ(RTNAME(SelectedRealKind)(
-// __FILE__, __LINE__, &p[0], 2, nullptr, 0, &d[0], 8),
-// 2);
-// EXPECT_EQ(RTNAME(SelectedRealKind)(
-// __FILE__, __LINE__, &p[0], 2, &r[0], 4, nullptr, 0),
-// 2);
-// }
+TEST(Numeric, SelectedRealKind) {
+ std::int8_t p_s = 1;
+ std::int16_t p[11] = {-10, 1, 1, 4, 50, 1, 1, 4, 1, 1, 50};
+ std::int32_t r[11] = {-1, 1, 1, 1, 2, 1, 20, 20, 100, 5000, 5000};
+ std::int64_t d[11] = {2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2};
+ EXPECT_EQ(RTNAME(SelectedRealKind)(
+ __FILE__, __LINE__, &p[0], 2, &r[0], 4, &d[0], 8),
+ 2);
+ EXPECT_EQ(RTNAME(SelectedRealKind)(
+ __FILE__, __LINE__, &p[1], 2, &r[1], 4, &d[1], 8),
+ -5);
+ EXPECT_EQ(RTNAME(SelectedRealKind)(
+ __FILE__, __LINE__, &p[2], 2, &r[2], 4, &d[2], 8),
+ 2);
+ EXPECT_EQ(RTNAME(SelectedRealKind)(
+ __FILE__, __LINE__, &p[3], 2, &r[3], 4, &d[3], 8),
+ 4);
+ EXPECT_EQ(RTNAME(SelectedRealKind)(
+ __FILE__, __LINE__, &p[4], 2, &r[4], 4, &d[4], 8),
+ -1);
+ EXPECT_EQ(RTNAME(SelectedRealKind)(
+ __FILE__, __LINE__, &p[5], 2, &r[5], 4, &d[5], 8),
+ 2);
+ EXPECT_EQ(RTNAME(SelectedRealKind)(
+ __FILE__, __LINE__, &p[6], 2, &r[6], 4, &d[6], 8),
+ 3);
+ EXPECT_EQ(RTNAME(SelectedRealKind)(
+ __FILE__, __LINE__, &p[7], 2, &r[7], 4, &d[7], 8),
+ 4);
+ EXPECT_EQ(RTNAME(SelectedRealKind)(
+ __FILE__, __LINE__, &p[8], 2, &r[8], 4, &d[8], 8),
+ 8);
+ EXPECT_EQ(RTNAME(SelectedRealKind)(
+ __FILE__, __LINE__, &p[9], 2, &r[9], 4, &d[9], 8),
+ -2);
+ EXPECT_EQ(RTNAME(SelectedRealKind)(
+ __FILE__, __LINE__, &p[10], 2, &r[10], 4, &d[10], 8),
+ -3);
+ EXPECT_EQ(
+ RTNAME(SelectedRealKind)(__FILE__, __LINE__, &p_s, 1, &r[0], 4, &d[0], 8),
+ 2);
+ EXPECT_EQ(RTNAME(SelectedRealKind)(
+ __FILE__, __LINE__, nullptr, 0, &r[0], 4, &d[0], 8),
+ 2);
+ EXPECT_EQ(RTNAME(SelectedRealKind)(
+ __FILE__, __LINE__, &p[0], 2, nullptr, 0, &d[0], 8),
+ 2);
+ EXPECT_EQ(RTNAME(SelectedRealKind)(
+ __FILE__, __LINE__, &p[0], 2, &r[0], 4, nullptr, 0),
+ 2);
+}
TEST(Numeric, Spacing) {
EXPECT_EQ(RTNAME(Spacing8)(Real<8>{0}), std::numeric_limits<Real<8>>::min());
diff --git a/flang/unittests/Runtime/NumericalFormatTest.cpp b/flang/unittests/Runtime/NumericalFormatTest.cpp
index d480e41268b6b..2a9f8f8d1dc4f 100644
--- a/flang/unittests/Runtime/NumericalFormatTest.cpp
+++ b/flang/unittests/Runtime/NumericalFormatTest.cpp
@@ -336,21 +336,21 @@ TEST(IOApiTests, FormatOnes) {
}
}
-// TEST(IOApiTests, FormatNegativeOnes) {
-// static constexpr std::tuple<const char *, const char *> negOnes[]{
-// {"(E32.17,';')", " -0.10000000000000000E+01;"},
-// {"(F32.17,';')", " -1.00000000000000000;"},
-// {"(G32.17,';')", " -1.0000000000000000 ;"},
-// {"(EX32.17,';')", " -0X8.00000000000000000P-3;"},
-// {"(G0,';')", "-1.;"},
-// };
-// for (auto const &[format, expect] : negOnes) {
-// std::string got;
-// ASSERT_TRUE(CompareFormatReal(format, -1.0, expect, got))
-// << "Failed to format " << format << ", expected '" << expect
-// << "', got '" << got << "'";
-// }
-// }
+TEST(IOApiTests, FormatNegativeOnes) {
+ static constexpr std::tuple<const char *, const char *> negOnes[]{
+ {"(E32.17,';')", " -0.10000000000000000E+01;"},
+ {"(F32.17,';')", " -1.00000000000000000;"},
+ {"(G32.17,';')", " -1.0000000000000000 ;"},
+ {"(EX32.17,';')", " -0X8.00000000000000000P-3;"},
+ {"(G0,';')", "-1.;"},
+ };
+ for (auto const &[format, expect] : negOnes) {
+ std::string got;
+ ASSERT_TRUE(CompareFormatReal(format, -1.0, expect, got))
+ << "Failed to format " << format << ", expected '" << expect
+ << "', got '" << got << "'";
+ }
+}
// Each test case contains a raw uint64, a format string for a real value, and
// the expected resulting string from formatting the raw uint64. The double
diff --git a/flang/unittests/Runtime/Pointer.cpp b/flang/unittests/Runtime/Pointer.cpp
index 30edf82fbcf13..4ce13ebc50a56 100644
--- a/flang/unittests/Runtime/Pointer.cpp
+++ b/flang/unittests/Runtime/Pointer.cpp
@@ -64,25 +64,25 @@ TEST(Pointer, DeallocatePolymorphic) {
(*p, nullptr, /*hasStat=*/false, /*errMsg=*/nullptr, __FILE__, __LINE__);
}
-// TEST(Pointer, AllocateFromScalarSource) {
-// // REAL(4), POINTER :: p(:)
-// auto p{Descriptor::Create(TypeCode{Fortran::common::TypeCategory::Real, 4}, 4,
-// nullptr, 1, nullptr, CFI_attribute_pointer)};
-// // ALLOCATE(p(2:11), SOURCE=3.4)
-// float sourecStorage{3.4F};
-// auto s{Descriptor::Create(Fortran::common::TypeCategory::Real, 4,
-// reinterpret_cast<void *>(&sourecStorage), 0, nullptr,
-// CFI_attribute_pointer)};
-// RTNAME(PointerSetBounds)(*p, 0, 2, 11);
-// RTNAME(PointerAllocateSource)
-// (*p, *s, /*hasStat=*/false, /*errMsg=*/nullptr, __FILE__, __LINE__);
-// EXPECT_TRUE(RTNAME(PointerIsAssociated)(*p));
-// EXPECT_EQ(p->Elements(), 10u);
-// EXPECT_EQ(p->GetDimension(0).LowerBound(), 2);
-// EXPECT_EQ(p->GetDimension(0).UpperBound(), 11);
-// EXPECT_EQ(*p->OffsetElement<float>(), 3.4F);
-// p->Destroy();
-// }
+TEST(Pointer, AllocateFromScalarSource) {
+ // REAL(4), POINTER :: p(:)
+ auto p{Descriptor::Create(TypeCode{Fortran::common::TypeCategory::Real, 4}, 4,
+ nullptr, 1, nullptr, CFI_attribute_pointer)};
+ // ALLOCATE(p(2:11), SOURCE=3.4)
+ float sourecStorage{3.4F};
+ auto s{Descriptor::Create(Fortran::common::TypeCategory::Real, 4,
+ reinterpret_cast<void *>(&sourecStorage), 0, nullptr,
+ CFI_attribute_pointer)};
+ RTNAME(PointerSetBounds)(*p, 0, 2, 11);
+ RTNAME(PointerAllocateSource)
+ (*p, *s, /*hasStat=*/false, /*errMsg=*/nullptr, __FILE__, __LINE__);
+ EXPECT_TRUE(RTNAME(PointerIsAssociated)(*p));
+ EXPECT_EQ(p->Elements(), 10u);
+ EXPECT_EQ(p->GetDimension(0).LowerBound(), 2);
+ EXPECT_EQ(p->GetDimension(0).UpperBound(), 11);
+ EXPECT_EQ(*p->OffsetElement<float>(), 3.4F);
+ p->Destroy();
+}
TEST(Pointer, AllocateSourceZeroSize) {
using Fortran::common::TypeCategory;
diff --git a/flang/unittests/Runtime/RuntimeCrashTest.cpp b/flang/unittests/Runtime/RuntimeCrashTest.cpp
index 0753f76f23cc3..a649051fdca0c 100644
--- a/flang/unittests/Runtime/RuntimeCrashTest.cpp
+++ b/flang/unittests/Runtime/RuntimeCrashTest.cpp
@@ -53,15 +53,15 @@ TEST(TestTerminator, CheckFailedTest) {
//------------------------------------------------------------------------------
struct TestIOCrash : CrashHandlerFixture {};
-// TEST(TestIOCrash, InvalidFormatCharacterTest) {
-// static constexpr int bufferSize{1};
-// static char buffer[bufferSize];
-// static const char *format{"(C1)"};
-// auto *cookie{IONAME(BeginInternalFormattedOutput)(
-// buffer, bufferSize, format, std::strlen(format))};
-// ASSERT_DEATH(IONAME(OutputInteger64)(cookie, 0xfeedface),
-// "Unknown 'C' edit descriptor in FORMAT");
-// }
+TEST(TestIOCrash, InvalidFormatCharacterTest) {
+ static constexpr int bufferSize{1};
+ static char buffer[bufferSize];
+ static const char *format{"(C1)"};
+ auto *cookie{IONAME(BeginInternalFormattedOutput)(
+ buffer, bufferSize, format, std::strlen(format))};
+ ASSERT_DEATH(IONAME(OutputInteger64)(cookie, 0xfeedface),
+ "Unknown 'C' edit descriptor in FORMAT");
+}
//------------------------------------------------------------------------------
/// Test buffer overwrites with Output* functions
diff --git a/flang/unittests/Runtime/Stop.cpp b/flang/unittests/Runtime/Stop.cpp
index 24c78251ea697..b13602eaee5ea 100644
--- a/flang/unittests/Runtime/Stop.cpp
+++ b/flang/unittests/Runtime/Stop.cpp
@@ -32,24 +32,24 @@ TEST(TestProgramEnd, StopTestNoStopMessage) {
RTNAME(StopStatement)(), testing::ExitedWithCode(EXIT_SUCCESS), "");
}
-// TEST(TestProgramEnd, StopMessageTest) {
-// static const char *message{"bye bye"};
-// EXPECT_EXIT(RTNAME(StopStatementText)(message, std::strlen(message),
-// /*isErrorStop=*/false, /*quiet=*/false),
-// testing::ExitedWithCode(EXIT_SUCCESS), "Fortran STOP: bye bye");
-
-// EXPECT_EXIT(RTNAME(StopStatementText)(message, std::strlen(message),
-// /*isErrorStop=*/false, /*quiet=*/true),
-// testing::ExitedWithCode(EXIT_SUCCESS), "");
-
-// EXPECT_EXIT(RTNAME(StopStatementText)(message, std::strlen(message),
-// /*isErrorStop=*/true, /*quiet=*/false),
-// testing::ExitedWithCode(EXIT_FAILURE), "Fortran ERROR STOP: bye bye");
-
-// EXPECT_EXIT(RTNAME(StopStatementText)(message, std::strlen(message),
-// /*isErrorStop=*/true, /*quiet=*/true),
-// testing::ExitedWithCode(EXIT_FAILURE), "");
-// }
+TEST(TestProgramEnd, StopMessageTest) {
+ static const char *message{"bye bye"};
+ EXPECT_EXIT(RTNAME(StopStatementText)(message, std::strlen(message),
+ /*isErrorStop=*/false, /*quiet=*/false),
+ testing::ExitedWithCode(EXIT_SUCCESS), "Fortran STOP: bye bye");
+
+ EXPECT_EXIT(RTNAME(StopStatementText)(message, std::strlen(message),
+ /*isErrorStop=*/false, /*quiet=*/true),
+ testing::ExitedWithCode(EXIT_SUCCESS), "");
+
+ EXPECT_EXIT(RTNAME(StopStatementText)(message, std::strlen(message),
+ /*isErrorStop=*/true, /*quiet=*/false),
+ testing::ExitedWithCode(EXIT_FAILURE), "Fortran ERROR STOP: bye bye");
+
+ EXPECT_EXIT(RTNAME(StopStatementText)(message, std::strlen(message),
+ /*isErrorStop=*/true, /*quiet=*/true),
+ testing::ExitedWithCode(EXIT_FAILURE), "");
+}
TEST(TestProgramEnd, NoStopMessageTest) {
putenv(const_cast<char *>("NO_STOP_MESSAGE=1"));
diff --git a/flang/unittests/Runtime/TemporaryStack.cpp b/flang/unittests/Runtime/TemporaryStack.cpp
index 8b9aac99309ad..0a9344969ca6b 100644
--- a/flang/unittests/Runtime/TemporaryStack.cpp
+++ b/flang/unittests/Runtime/TemporaryStack.cpp
@@ -87,86 +87,86 @@ static unsigned max(unsigned x, unsigned y) {
return y;
}
-// TEST(TemporaryStack, ValueStackMultiSize) {
-// constexpr unsigned numToTest = 42;
-// const TypeCode code{CFI_type_int32_t};
-// constexpr size_t elementBytes = 4;
-// SubscriptValue extent[CFI_MAX_RANK];
-
-// std::vector<OwningPtr<Descriptor>> inputDescriptors;
-// inputDescriptors.reserve(numToTest);
-
-// void *storage = RTNAME(CreateValueStack)(__FILE__, __LINE__);
-// ASSERT_NE(storage, nullptr);
-
-// // create descriptors with and without adendums
-// auto getAdendum = [](unsigned i) { return i % 2; };
-// // create descriptors with varying ranks
-// auto getRank = [](unsigned i) { return max(i % 8, 1); };
-
-// // push descriptors of varying sizes and contents
-// for (unsigned i = 0; i < numToTest; ++i) {
-// const bool adendum = getAdendum(i);
-// const size_t rank = getRank(i);
-// for (unsigned dim = 0; dim < rank; ++dim) {
-// extent[dim] = ((i + dim) % 8) + 1;
-// }
-
-// const OwningPtr<Descriptor> &desc =
-// inputDescriptors.emplace_back(Descriptor::Create(code, elementBytes,
-// nullptr, rank, extent, CFI_attribute_allocatable, adendum));
-
-// // Descriptor::Establish doesn't initialise the extents if baseaddr is null
-// for (unsigned dim = 0; dim < rank; ++dim) {
-// Fortran::ISO::CFI_dim_t &boxDims = desc->raw().dim[dim];
-// boxDims.lower_bound = 1;
-// boxDims.extent = extent[dim];
-// boxDims.sm = elementBytes;
-// }
-// desc->Allocate();
-
-// // fill the array with some data to test
-// for (uint32_t i = 0; i < desc->Elements(); ++i) {
-// uint32_t *data = static_cast<uint32_t *>(desc->raw().base_addr);
-// ASSERT_NE(data, nullptr);
-// data[i] = i;
-// }
-
-// RTNAME(PushValue)(storage, *desc.get());
-// }
-
-// const TypeCode boolCode{CFI_type_Bool};
-// // peek and test each descriptor
-// for (unsigned i = 0; i < numToTest; ++i) {
-// const OwningPtr<Descriptor> &input = inputDescriptors[i];
-// const bool adendum = getAdendum(i);
-// const size_t rank = getRank(i);
-
-// // buffer to return the descriptor into
-// OwningPtr<Descriptor> out = Descriptor::Create(
-// boolCode, 1, nullptr, rank, extent, CFI_attribute_other, adendum);
-
-// (void)input;
-// RTNAME(ValueAt)(storage, i, *out.get());
-// descriptorAlmostEqual(*input, *out);
-// }
-
-// // pop and test each descriptor
-// for (unsigned i = numToTest; i > 0; --i) {
-// const OwningPtr<Descriptor> &input = inputDescriptors[i - 1];
-// const bool adendum = getAdendum(i - 1);
-// const size_t rank = getRank(i - 1);
-
-// // buffer to return the descriptor into
-// OwningPtr<Descriptor> out = Descriptor::Create(
-// boolCode, 1, nullptr, rank, extent, CFI_attribute_other, adendum);
-
-// RTNAME(PopValue)(storage, *out.get());
-// descriptorAlmostEqual(*input, *out);
-// }
-
-// RTNAME(DestroyValueStack)(storage);
-// }
+TEST(TemporaryStack, ValueStackMultiSize) {
+ constexpr unsigned numToTest = 42;
+ const TypeCode code{CFI_type_int32_t};
+ constexpr size_t elementBytes = 4;
+ SubscriptValue extent[CFI_MAX_RANK];
+
+ std::vector<OwningPtr<Descriptor>> inputDescriptors;
+ inputDescriptors.reserve(numToTest);
+
+ void *storage = RTNAME(CreateValueStack)(__FILE__, __LINE__);
+ ASSERT_NE(storage, nullptr);
+
+ // create descriptors with and without adendums
+ auto getAdendum = [](unsigned i) { return i % 2; };
+ // create descriptors with varying ranks
+ auto getRank = [](unsigned i) { return max(i % 8, 1); };
+
+ // push descriptors of varying sizes and contents
+ for (unsigned i = 0; i < numToTest; ++i) {
+ const bool adendum = getAdendum(i);
+ const size_t rank = getRank(i);
+ for (unsigned dim = 0; dim < rank; ++dim) {
+ extent[dim] = ((i + dim) % 8) + 1;
+ }
+
+ const OwningPtr<Descriptor> &desc =
+ inputDescriptors.emplace_back(Descriptor::Create(code, elementBytes,
+ nullptr, rank, extent, CFI_attribute_allocatable, adendum));
+
+ // Descriptor::Establish doesn't initialise the extents if baseaddr is null
+ for (unsigned dim = 0; dim < rank; ++dim) {
+ Fortran::ISO::CFI_dim_t &boxDims = desc->raw().dim[dim];
+ boxDims.lower_bound = 1;
+ boxDims.extent = extent[dim];
+ boxDims.sm = elementBytes;
+ }
+ desc->Allocate();
+
+ // fill the array with some data to test
+ for (uint32_t i = 0; i < desc->Elements(); ++i) {
+ uint32_t *data = static_cast<uint32_t *>(desc->raw().base_addr);
+ ASSERT_NE(data, nullptr);
+ data[i] = i;
+ }
+
+ RTNAME(PushValue)(storage, *desc.get());
+ }
+
+ const TypeCode boolCode{CFI_type_Bool};
+ // peek and test each descriptor
+ for (unsigned i = 0; i < numToTest; ++i) {
+ const OwningPtr<Descriptor> &input = inputDescriptors[i];
+ const bool adendum = getAdendum(i);
+ const size_t rank = getRank(i);
+
+ // buffer to return the descriptor into
+ OwningPtr<Descriptor> out = Descriptor::Create(
+ boolCode, 1, nullptr, rank, extent, CFI_attribute_other, adendum);
+
+ (void)input;
+ RTNAME(ValueAt)(storage, i, *out.get());
+ descriptorAlmostEqual(*input, *out);
+ }
+
+ // pop and test each descriptor
+ for (unsigned i = numToTest; i > 0; --i) {
+ const OwningPtr<Descriptor> &input = inputDescriptors[i - 1];
+ const bool adendum = getAdendum(i - 1);
+ const size_t rank = getRank(i - 1);
+
+ // buffer to return the descriptor into
+ OwningPtr<Descriptor> out = Descriptor::Create(
+ boolCode, 1, nullptr, rank, extent, CFI_attribute_other, adendum);
+
+ RTNAME(PopValue)(storage, *out.get());
+ descriptorAlmostEqual(*input, *out);
+ }
+
+ RTNAME(DestroyValueStack)(storage);
+}
TEST(TemporaryStack, DescriptorStackBasic) {
const TypeCode code{CFI_type_Bool};
>From e278a9d5100149068754a20abb931b79bb78e923 Mon Sep 17 00:00:00 2001
From: Vlad Serebrennikov <serebrennikov.vladislav at gmail.com>
Date: Sun, 19 May 2024 22:40:05 +0300
Subject: [PATCH 11/13] Comment out all flang tests
---
flang/unittests/CMakeLists.txt | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/flang/unittests/CMakeLists.txt b/flang/unittests/CMakeLists.txt
index 72d37ebeb853c..f04b91497b172 100644
--- a/flang/unittests/CMakeLists.txt
+++ b/flang/unittests/CMakeLists.txt
@@ -70,9 +70,9 @@ function(add_flang_nongtest_unittest test_name)
add_flang_unittest_offload_properties(${test_name}${suffix})
endfunction()
-add_subdirectory(Optimizer)
-add_subdirectory(Common)
-add_subdirectory(Decimal)
-add_subdirectory(Evaluate)
-add_subdirectory(Runtime)
-add_subdirectory(Frontend)
+# add_subdirectory(Optimizer)
+# add_subdirectory(Common)
+# add_subdirectory(Decimal)
+# add_subdirectory(Evaluate)
+# add_subdirectory(Runtime)
+# add_subdirectory(Frontend)
>From 2d65aef22fb869b9e3b8c0fd9f7e685029f4537b Mon Sep 17 00:00:00 2001
From: Vlad Serebrennikov <serebrennikov.vladislav at gmail.com>
Date: Sun, 19 May 2024 23:11:27 +0300
Subject: [PATCH 12/13] Disable stack-arrays.f90 test
---
.../Transforms/{stack-arrays.f90 => stack-arrays.f90.disabled} | 0
1 file changed, 0 insertions(+), 0 deletions(-)
rename flang/test/Transforms/{stack-arrays.f90 => stack-arrays.f90.disabled} (100%)
diff --git a/flang/test/Transforms/stack-arrays.f90 b/flang/test/Transforms/stack-arrays.f90.disabled
similarity index 100%
rename from flang/test/Transforms/stack-arrays.f90
rename to flang/test/Transforms/stack-arrays.f90.disabled
>From 7a42c1108843f1ec6a620db676a8fc95baf8494d Mon Sep 17 00:00:00 2001
From: Vlad Serebrennikov <serebrennikov.vladislav at gmail.com>
Date: Sun, 19 May 2024 23:32:26 +0300
Subject: [PATCH 13/13] More debug printing
---
llvm/utils/lit/lit/main.py | 1 +
llvm/utils/lit/lit/run.py | 8 ++++++++
2 files changed, 9 insertions(+)
diff --git a/llvm/utils/lit/lit/main.py b/llvm/utils/lit/lit/main.py
index 09354b3092d8a..9c9c1aae304af 100755
--- a/llvm/utils/lit/lit/main.py
+++ b/llvm/utils/lit/lit/main.py
@@ -271,6 +271,7 @@ def run_tests(tests, lit_config, opts, discovered_tests):
print("Endill 320")
display = lit.display.create_display(opts, tests, discovered_tests, workers)
print("Endill 330")
+ print("Endill opts.timeout: {}".format(opts.timeout))
run = lit.run.Run(
tests, lit_config, workers, display.update, opts.max_failures, opts.timeout
)
diff --git a/llvm/utils/lit/lit/run.py b/llvm/utils/lit/lit/run.py
index 54482071a67b2..e1354d54fc346 100644
--- a/llvm/utils/lit/lit/run.py
+++ b/llvm/utils/lit/lit/run.py
@@ -86,6 +86,11 @@ def _execute(self, deadline):
)
print("Endill 365130")
+ def debug_callback(arg):
+ print("Endill: debug_callback test.file_path: {}".format(arg.file_path))
+ print("Endill: debug_callback test.path_in_suite: {}".format(arg.path_in_suite))
+ self.progress_callback(arg)
+
async_results = [
pool.apply_async(
lit.worker.execute, args=[test], callback=self.progress_callback
@@ -117,6 +122,9 @@ def _wait_for(self, async_results, deadline):
print("Endill 3651610")
try:
print("Endill 3651620")
+ print("Endill: idx: {}".format(idx))
+ print("Endill: tests[idx].file_path: {}".format(self.tests[idx].file_path))
+ print("Endill: tests[idx].path_in_suite: {}".format(self.tests[idx].path_in_suite))
test = ar.get(timeout)
print("Endill 3651630")
print("Endill: test.file_path: {}".format(test.file_path))
More information about the flang-commits
mailing list