[flang-commits] [flang] [flang] Adjust execute_command_line intrinsic return values for AIX (NFC) (PR #106472)

Kelvin Li via flang-commits flang-commits at lists.llvm.org
Wed Aug 28 16:51:05 PDT 2024


https://github.com/kkwli created https://github.com/llvm/llvm-project/pull/106472

AIX's std::system returns different values for command failure.

>From a720731150f7894356b2f2e0f42bdea92ece1362 Mon Sep 17 00:00:00 2001
From: Kelvin Li <kli at ca.ibm.com>
Date: Wed, 28 Aug 2024 18:17:28 -0400
Subject: [PATCH] [flang] Adjust execute_command_line intrinsic return values
 for AIX (NFC)

---
 flang/unittests/Runtime/CommandTest.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/flang/unittests/Runtime/CommandTest.cpp b/flang/unittests/Runtime/CommandTest.cpp
index 20bd7a5b5ff35a..b0c43ba01d8f33 100644
--- a/flang/unittests/Runtime/CommandTest.cpp
+++ b/flang/unittests/Runtime/CommandTest.cpp
@@ -348,10 +348,14 @@ TEST_F(ZeroArguments, ECLGeneralErrorCommandErrorSync) {
 
   RTNAME(ExecuteCommandLine)
   (*command.get(), wait, exitStat.get(), cmdStat.get(), cmdMsg.get());
-#ifdef _WIN32
+#if defined(_WIN32)
   CheckDescriptorEqInt<std::int64_t>(exitStat.get(), 1);
   CheckDescriptorEqInt<std::int64_t>(cmdStat.get(), 6);
   CheckDescriptorEqStr(cmdMsg.get(), "Invalid command lineXXXXXXXXX");
+#elif defined(_AIX)
+  CheckDescriptorEqInt<std::int64_t>(exitStat.get(), 2);
+  CheckDescriptorEqInt<std::int64_t>(cmdStat.get(), 6);
+  CheckDescriptorEqStr(cmdMsg.get(), "Invalid command lineXXXXXXXXX");
 #else
   CheckDescriptorEqInt<std::int64_t>(exitStat.get(), 1);
   CheckDescriptorEqInt<std::int64_t>(cmdStat.get(), 3);



More information about the flang-commits mailing list