2626#include " absl/status/status.h"
2727#include " absl/status/statusor.h"
2828#include " absl/strings/str_cat.h"
29- #include " absl/strings/str_join.h"
30- #include " absl/strings/str_split.h"
3129#include " absl/time/clock.h"
3230#include " absl/time/time.h"
3331#include " ./centipede/centipede_callbacks.h"
3432#include " ./centipede/crash_summary.h"
3533#include " ./centipede/environment.h"
3634#include " ./centipede/runner_result.h"
3735#include " ./centipede/workdir.h"
36+ #include " ./common/crashing_input_filename.h"
3837#include " ./common/defs.h"
3938#include " ./common/hash.h"
4039#include " ./common/logging.h"
@@ -102,33 +101,6 @@ absl::flat_hash_map<std::string, CrashDetails> GetCrashesFromWorkdir(
102101 return crashes;
103102}
104103
105- absl::StatusOr<InputFileComponents> GetInputFileComponents (
106- std::string_view input_file_path) {
107- const std::string file_name =
108- std::filesystem::path (std::string (input_file_path)).filename ();
109- std::vector<std::string> parts = absl::StrSplit (file_name, ' -' );
110- if (parts.size () == 1 ) {
111- // Old format where the input file name is both the bug ID and the input
112- // signature.
113- return InputFileComponents{
114- /* bug_id=*/ parts[0 ],
115- /* crash_signature=*/ " " ,
116- /* input_signature=*/ parts[0 ],
117- };
118- }
119- if (parts.size () < 3 ) {
120- return absl::InvalidArgumentError (
121- absl::StrCat (" Input file name not in the format of "
122- " <bug_id>-<crash_signature>-<input_signature>: " ,
123- file_name));
124- }
125- return InputFileComponents{
126- /* bug_id=*/ absl::StrJoin (parts.begin (), parts.end () - 2 , " -" ),
127- /* crash_signature=*/ std::move (parts[parts.size () - 2 ]),
128- /* input_signature=*/ std::move (parts[parts.size () - 1 ]),
129- };
130- }
131-
132104void OrganizeCrashingInputs (
133105 const std::filesystem::path& regression_dir,
134106 const std::filesystem::path& crashing_dir, const Environment& env,
@@ -154,7 +126,7 @@ void OrganizeCrashingInputs(
154126 const bool is_reproducible = !scoped_callbacks.callbacks ()->Execute (
155127 env.binary , {old_input}, batch_result) &&
156128 batch_result.IsInputFailure ();
157- auto input_file_components = GetInputFileComponents (old_input_file);
129+ auto input_file_components = ParseCrashingInputFilename (old_input_file);
158130 FUZZTEST_LOG_IF (WARNING, !input_file_components.ok ())
159131 << " Failed to get input file components for " << old_input_file
160132 << " . Status: " << input_file_components.status ();
0 commit comments