Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions flang/unittests/Runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,6 @@ target_link_libraries(FlangRuntimeTests
FortranRuntime
)

target_compile_definitions(FlangRuntimeTests PRIVATE LLVM_TOOLS_BINARY_DIR="${LLVM_TOOLS_BINARY_DIR}")

add_subdirectory(CUDA)
10 changes: 6 additions & 4 deletions flang/unittests/Runtime/CommandTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "flang/Runtime/execute.h"
#include "flang/Runtime/extensions.h"
#include "flang/Runtime/main.h"
#include "llvm/Support/Path.h"
#include <cstddef>
#include <cstdlib>

Expand Down Expand Up @@ -340,24 +341,25 @@ TEST_F(ZeroArguments, ECLValidCommandStatusSetSync) {
}

TEST_F(ZeroArguments, ECLGeneralErrorCommandErrorSync) {
OwningPtr<Descriptor> command{CharDescriptor("cat GeneralErrorCommand")};
llvm::SmallString<64> cmd;
llvm::sys::path::native(LLVM_TOOLS_BINARY_DIR, cmd);
llvm::sys::path::append(cmd, "not");
OwningPtr<Descriptor> command{CharDescriptor(cmd.data())};
bool wait{true};
OwningPtr<Descriptor> exitStat{IntDescriptor(404)};
OwningPtr<Descriptor> cmdStat{IntDescriptor(202)};
OwningPtr<Descriptor> cmdMsg{CharDescriptor("cmd msg buffer XXXXXXXXXXXXXX")};

RTNAME(ExecuteCommandLine)
(*command.get(), wait, exitStat.get(), cmdStat.get(), cmdMsg.get());
#if defined(_WIN32)
CheckDescriptorEqInt<std::int64_t>(exitStat.get(), 1);
#if defined(_WIN32)
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);
CheckDescriptorEqStr(cmdMsg.get(), "Command line execution failed");
#endif
Expand Down