[libcxx-commits] [libcxx] Fix fs.op.copy_file/copy_file_large.pass.cpp on z/OS (PR #100382)

Zibi Sarbinowski via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jul 24 07:04:18 PDT 2024


https://github.com/zibi2 created https://github.com/llvm/llvm-project/pull/100382

This PR is required to fix copy_file_large.pass.cpp which is failing on z/OS in all ASCII variations. The problem is that a destination file is opened in binary mode and auto-conversion does not happen when this lit is compiled with -fzos-le-char-mode=ascii.

In addition opening a destination file will match a text mode of `fopen()` of a source file. 

>From 80113037ebd84b611fb903b45c19c174b3d15ce0 Mon Sep 17 00:00:00 2001
From: Zbigniew Sarbinowski <zibi at ca.ibm.com>
Date: Wed, 24 Jul 2024 14:07:21 +0000
Subject: [PATCH] Fix fs.op.copy_file/copy_file_large.pass.cpp on z/OS

---
 .../fs.op.funcs/fs.op.copy_file/copy_file_large.pass.cpp        | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.copy_file/copy_file_large.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.copy_file/copy_file_large.pass.cpp
index db15ee193ad2a..53bf828fc120b 100644
--- a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.copy_file/copy_file_large.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.copy_file/copy_file_large.pass.cpp
@@ -72,7 +72,7 @@ static void large_file() {
   // the data at the end of the source file.
   std::string out_data(additional_size, 'z');
   {
-    std::FILE* dest_file = std::fopen(dest.string().c_str(), "rb");
+    std::FILE* dest_file = std::fopen(dest.string().c_str(), "r");
     assert(dest_file != nullptr);
     assert(std::fseek(dest_file, sendfile_size_limit, SEEK_SET) == 0);
     assert(std::fread(&out_data[0], sizeof(out_data[0]), additional_size, dest_file) == additional_size);



More information about the libcxx-commits mailing list