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.
This commit is contained in:
Andrew Gaul 2023-07-27 23:15:19 +09:00 committed by GitHub
parent a4a2841c05
commit 38a1ff42e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 14 additions and 5 deletions

View File

@ -36,11 +36,20 @@ noinst_PROGRAMS = \
truncate_read_file \ truncate_read_file \
cr_filename cr_filename
junk_data_SOURCES = junk_data.c junk_data_SOURCES = junk_data.cc
write_multiblock_SOURCES = write_multiblock.cc write_multiblock_SOURCES = write_multiblock.cc
mknod_test_SOURCES = mknod_test.c mknod_test_SOURCES = mknod_test.cc
truncate_read_file_SOURCES = truncate_read_file.c truncate_read_file_SOURCES = truncate_read_file.cc
cr_filename_SOURCES = cr_filename.c 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: # Local variables:

View File

@ -34,7 +34,7 @@ int main(int argc, const char *argv[])
for (i = 0; i < count; i += sizeof(buf)) { for (i = 0; i < count; i += sizeof(buf)) {
long long j; long long j;
for (j = 0; j < sizeof(buf) / sizeof(i); ++j) { for (j = 0; j < sizeof(buf) / sizeof(i); ++j) {
*((long long *)buf + j) = i / sizeof(i) + j; *(reinterpret_cast<long long *>(buf) + j) = i / sizeof(i) + j;
} }
fwrite(buf, 1, sizeof(buf) > count - i ? count - i : sizeof(buf), stdout); fwrite(buf, 1, sizeof(buf) > count - i ? count - i : sizeof(buf), stdout);
} }