Skip to content

Commit

Permalink
Rename RemotePathRename to RemoteFileRename to support only file rena…
Browse files Browse the repository at this point in the history
…ming.

We only need file renaming.

PiperOrigin-RevId: 722779470
  • Loading branch information
xinhaoyuan authored and copybara-github committed Feb 3, 2025
1 parent 1752ee0 commit 173bbef
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
6 changes: 3 additions & 3 deletions centipede/centipede_interface.cc
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ void DeduplicateAndStoreNewCrashes(
!crash_metadata.insert(new_crash_metadata).second;
if (is_duplicate) continue;
CHECK_OK(
RemotePathRename(crashing_input_file,
RemoteFileRename(crashing_input_file,
(crashing_dir / crashing_input_file_name).c_str()));
}
}
Expand Down Expand Up @@ -642,7 +642,7 @@ int UpdateCorpusDatabaseForFuzzTests(
if (!stats_root_path.empty()) {
const auto stats_dir = stats_root_path / fuzz_tests_to_run[i];
CHECK_OK(RemoteMkdir(stats_dir.c_str()));
CHECK_OK(RemotePathRename(
CHECK_OK(RemoteFileRename(
workdir.FuzzingStatsPath(),
(stats_dir / absl::StrCat("fuzzing_stats_", execution_stamp))
.c_str()));
Expand All @@ -667,7 +667,7 @@ int UpdateCorpusDatabaseForFuzzTests(
const std::string file_name =
std::filesystem::path(corpus_file).filename();
CHECK_OK(
RemotePathRename(corpus_file, (coverage_dir / file_name).c_str()));
RemoteFileRename(corpus_file, (coverage_dir / file_name).c_str()));
}

// Deduplicate and update the crashing inputs.
Expand Down
7 changes: 6 additions & 1 deletion common/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,9 @@ cc_library(
name = "remote_file_test_lib",
testonly = True,
srcs = ["remote_file_test.cc"],
defines = select({
"//conditions:default": [],
}),
deps = [
":logging",
":remote_file",
Expand All @@ -254,7 +257,9 @@ cc_library(
"@com_google_absl//absl/status",
"@com_google_absl//absl/time",
"@com_google_googletest//:gtest",
],
] + select({
"//conditions:default": [],
}),
alwayslink = True,
)

Expand Down
4 changes: 2 additions & 2 deletions common/remote_file.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ absl::Status RemoteGlobMatch(std::string_view glob,
absl::StatusOr<std::vector<std::string>> RemoteListFiles(std::string_view path,
bool recursively);

// Renames `from` to `to`.
absl::Status RemotePathRename(std::string_view from, std::string_view to);
// Renames a file from `from` to `to`.
absl::Status RemoteFileRename(std::string_view from, std::string_view to);

// Updates the last-modified time of `path` to the current time.
absl::Status RemotePathTouchExistingFile(std::string_view path);
Expand Down
4 changes: 2 additions & 2 deletions common/remote_file_oss.cc
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ absl::StatusOr<std::vector<std::string>> RemoteListFiles(std::string_view path,
LOG(FATAL) << "Filesystem API not supported in iOS/MacOS";
}

absl::Status RemotePathRename(std::string_view from, std::string_view to) {
absl::Status RemoteFileRename(std::string_view from, std::string_view to) {
LOG(FATAL) << "Filesystem API not supported in iOS/MacOS";
}

Expand Down Expand Up @@ -235,7 +235,7 @@ absl::StatusOr<std::vector<std::string>> RemoteListFiles(std::string_view path,
: list_files(std::filesystem::directory_iterator(path));
}

absl::Status RemotePathRename(std::string_view from, std::string_view to) {
absl::Status RemoteFileRename(std::string_view from, std::string_view to) {
std::error_code error;
std::filesystem::rename(from, to, error);
if (error) {
Expand Down

0 comments on commit 173bbef

Please sign in to comment.