def test_make_dir_copy(fs): """Test that make_dir_copy works as intended.""" _create_source_dir(SOURCE_DIR, fs) copy_dir = filesystem.make_dir_copy(SOURCE_DIR) _assert_has_source_dir_contents(copy_dir) new_filename = 'new-file' copied_new_file_path = os.path.join(copy_dir, new_filename) assert not os.path.exists(copied_new_file_path) with open(os.path.join(SOURCE_DIR, new_filename), 'w') as file_handle: file_handle.write('') copy_dir = filesystem.make_dir_copy(SOURCE_DIR) _assert_has_source_dir_contents(copy_dir) assert os.path.exists(copied_new_file_path)
def save_results(self): """Save the results directory to GCS.""" if not self.gcs_sync_dir: return # Copy results directory before rsyncing it so that we don't get an # exception from uploading a file that changes in size. Files can change # in size because the log file containing the fuzzer's output is in this # directory and can be written to by the fuzzer at any time. results_copy = filesystem.make_dir_copy(self.results_dir) filestore_utils.rsync( results_copy, posixpath.join(self.gcs_sync_dir, self.results_dir))
def save_results(self): """Save the results directory to GCS.""" if not self.gcs_sync_dir: return # Copy results directory before rsyncing it so that we don't get an # exception from uploading a file that changes in size. Files can change # in size because the log file containing the fuzzer's output is in this # directory and can be written to by the fuzzer at any time. results_copy = filesystem.make_dir_copy(self.results_dir) # Don't use parallel because it causes stability issues # (crbug.com/1053309). gsutil.rsync(results_copy, posixpath.join(self.gcs_sync_dir, self.results_dir), parallel=False)