[all-commits] [llvm/llvm-project] cbad57: [flang][msvc] Fix external-io unittest.

Michael Kruse via All-commits all-commits at lists.llvm.org
Mon Jul 26 13:34:50 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: cbad57613e769d0653e13cf877d80eae421b2314
      https://github.com/llvm/llvm-project/commit/cbad57613e769d0653e13cf877d80eae421b2314
  Author: Michael Kruse <llvm-project at meinersbur.de>
  Date:   2021-07-26 (Mon, 26 Jul 2021)

  Changed paths:
    M flang/runtime/file.cpp
    M flang/runtime/unit.cpp

  Log Message:
  -----------
  [flang][msvc] Fix external-io unittest.

Fix the external-io unittest under Windows.

In particular, fixes the following issues:

 1.  When creating a temporary file, open it with read+write permissions
     using the _O_RDWR flag. _S_IREAD and _S_IWRITE are for the file
     permissions of the created file.

 2. _chsize returns 0 on success (just like ftruncate).

 3. To set a std::optional, use its assign-operator overload instead of
    getting a reference to its value and overwrite that. The latter is
    invalid if the std::optional has no value, and is caught by
    msvc's debug STL.

The non-GTest unittest is currently not executed under Windows because
of the added .exe extension to the output file: external-io.text.exe.
llvm-lit skips the file because .exe is not in the lists of test
suffixes (.test is). D105315 is going to change that by converting it
to a GTest-test.

Reviewed By: awarzynski

Differential Revision: https://reviews.llvm.org/D106726




More information about the All-commits mailing list