From 63cdcd33e4dd3978ab663c09fa2283b208f6bb62 Mon Sep 17 00:00:00 2001 From: borysp Date: Fri, 17 Apr 2020 17:28:35 +0200 Subject: [PATCH] [LibOS/test/fs] Remove invalid mmap on file opened write-only --- LibOS/shim/test/fs/Makefile | 9 +++++++-- LibOS/shim/test/fs/common_copy.c | 8 +++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/LibOS/shim/test/fs/Makefile b/LibOS/shim/test/fs/Makefile index 820e204c..35a71055 100644 --- a/LibOS/shim/test/fs/Makefile +++ b/LibOS/shim/test/fs/Makefile @@ -1,7 +1,10 @@ -copy_execs = \ +copy_mmap_execs = \ copy_mmap_rev \ copy_mmap_seq \ - copy_mmap_whole \ + copy_mmap_whole + +copy_execs = \ + $(copy_mmap_execs) \ copy_rev \ copy_seq \ copy_whole @@ -39,6 +42,8 @@ $(execs): common.o $(copy_execs): common_copy.o +$(copy_mmap_execs): CFLAGS += -DCOPY_MMAP + %.o: %.c $(call cmd,cc_o_c) diff --git a/LibOS/shim/test/fs/common_copy.c b/LibOS/shim/test/fs/common_copy.c index 575ed22b..0a9ad0ef 100644 --- a/LibOS/shim/test/fs/common_copy.c +++ b/LibOS/shim/test/fs/common_copy.c @@ -1,5 +1,11 @@ #include "common.h" +#ifdef COPY_MMAP +#define RDWR_OUTPUT_OPEN true +#else +#define RDWR_OUTPUT_OPEN false +#endif + void copy_file(const char* input_path, const char* output_path, size_t size) { int fi = open_input_fd(input_path); printf("open(%zu) input OK\n", size); @@ -11,7 +17,7 @@ void copy_file(const char* input_path, const char* output_path, size_t size) { fatal_error("Size mismatch: expected %zu, got %zu\n", size, st.st_size); printf("fstat(%zu) input OK\n", size); - int fo = open_output_fd(output_path, /*rdwr=*/false); + int fo = open_output_fd(output_path, /*rdwr=*/RDWR_OUTPUT_OPEN); printf("open(%zu) output OK\n", size); if (fstat(fo, &st) < 0)