From 38a1ff42e53895fd78b206360999cc748a99023b Mon Sep 17 00:00:00 2001 From: Andrew Gaul Date: Thu, 27 Jul 2023 23:15:19 +0900 Subject: [PATCH] Convert test binaries to C++ (#2235) This ensures that they are compiled with a consistent compiler and set of flags as the rest of s3fs. --- test/Makefile.am | 17 +++++++++++++---- test/{cr_filename.c => cr_filename.cc} | 0 test/{junk_data.c => junk_data.cc} | 2 +- test/{mknod_test.c => mknod_test.cc} | 0 ...uncate_read_file.c => truncate_read_file.cc} | 0 5 files changed, 14 insertions(+), 5 deletions(-) rename test/{cr_filename.c => cr_filename.cc} (100%) rename test/{junk_data.c => junk_data.cc} (95%) rename test/{mknod_test.c => mknod_test.cc} (100%) rename test/{truncate_read_file.c => truncate_read_file.cc} (100%) diff --git a/test/Makefile.am b/test/Makefile.am index 11f7667..5bb7210 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -36,11 +36,20 @@ noinst_PROGRAMS = \ truncate_read_file \ cr_filename -junk_data_SOURCES = junk_data.c +junk_data_SOURCES = junk_data.cc write_multiblock_SOURCES = write_multiblock.cc -mknod_test_SOURCES = mknod_test.c -truncate_read_file_SOURCES = truncate_read_file.c -cr_filename_SOURCES = cr_filename.c +mknod_test_SOURCES = mknod_test.cc +truncate_read_file_SOURCES = truncate_read_file.cc +cr_filename_SOURCES = cr_filename.cc + +clang-tidy: + clang-tidy \ + $(junk_data_SOURCES) \ + $(write_multiblock_SOURCES) \ + $(mknod_test_SOURCES) \ + $(truncate_read_file_SOURCES) \ + $(cr_filename_SOURCES) \ + -- $(DEPS_CFLAGS) $(CPPFLAGS) # # Local variables: diff --git a/test/cr_filename.c b/test/cr_filename.cc similarity index 100% rename from test/cr_filename.c rename to test/cr_filename.cc diff --git a/test/junk_data.c b/test/junk_data.cc similarity index 95% rename from test/junk_data.c rename to test/junk_data.cc index e4ff76c..bf64c48 100644 --- a/test/junk_data.c +++ b/test/junk_data.cc @@ -34,7 +34,7 @@ int main(int argc, const char *argv[]) for (i = 0; i < count; i += sizeof(buf)) { long long j; for (j = 0; j < sizeof(buf) / sizeof(i); ++j) { - *((long long *)buf + j) = i / sizeof(i) + j; + *(reinterpret_cast(buf) + j) = i / sizeof(i) + j; } fwrite(buf, 1, sizeof(buf) > count - i ? count - i : sizeof(buf), stdout); } diff --git a/test/mknod_test.c b/test/mknod_test.cc similarity index 100% rename from test/mknod_test.c rename to test/mknod_test.cc diff --git a/test/truncate_read_file.c b/test/truncate_read_file.cc similarity index 100% rename from test/truncate_read_file.c rename to test/truncate_read_file.cc