mirror of
https://github.com/chromium/crashpad.git
synced 2025-03-09 14:06:33 +00:00
linux: put test attachment in temp directory
This prevents errors creating the attachment if a previous test failed to delete it for some reason. Change-Id: I2622d86e08987ad3ff201da84dc9ae210acf776d Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2302722 Reviewed-by: Mark Mentovai <mark@chromium.org> Commit-Queue: Joshua Peraza <jperaza@chromium.org>
This commit is contained in:
parent
06a688ddc1
commit
9f66d569fb
@ -313,7 +313,7 @@ CRASHPAD_CHILD_TEST_MAIN(StartHandlerForSelfTestChild) {
|
||||
test_annotation.Set(kTestAnnotationValue);
|
||||
|
||||
const std::vector<base::FilePath> attachments = {
|
||||
base::FilePath(kTestAttachmentName)};
|
||||
base::FilePath(temp_dir).Append(kTestAttachmentName)};
|
||||
|
||||
crashpad::CrashpadClient client;
|
||||
if (!InstallHandler(&client,
|
||||
@ -362,16 +362,6 @@ class StartHandlerForSelfInChildTest : public MultiprocessExec {
|
||||
|
||||
private:
|
||||
void MultiprocessParent() override {
|
||||
FileWriter writer;
|
||||
base::FilePath test_attachment_path = base::FilePath(kTestAttachmentName);
|
||||
bool is_created = writer.Open(test_attachment_path,
|
||||
FileWriteMode::kCreateOrFail,
|
||||
FilePermissions::kOwnerOnly);
|
||||
ASSERT_TRUE(is_created);
|
||||
ScopedRemoveFile attachment_remover(test_attachment_path);
|
||||
writer.Write(kTestAttachmentContent, sizeof(kTestAttachmentContent));
|
||||
writer.Close();
|
||||
|
||||
ScopedTempDir temp_dir;
|
||||
VMSize temp_dir_length = temp_dir.path().value().size();
|
||||
ASSERT_TRUE(LoggingWriteFile(
|
||||
@ -381,6 +371,16 @@ class StartHandlerForSelfInChildTest : public MultiprocessExec {
|
||||
ASSERT_TRUE(
|
||||
LoggingWriteFile(WritePipeHandle(), &options_, sizeof(options_)));
|
||||
|
||||
FileWriter writer;
|
||||
base::FilePath test_attachment_path =
|
||||
temp_dir.path().Append(kTestAttachmentName);
|
||||
bool is_created = writer.Open(test_attachment_path,
|
||||
FileWriteMode::kCreateOrFail,
|
||||
FilePermissions::kOwnerOnly);
|
||||
ASSERT_TRUE(is_created);
|
||||
writer.Write(kTestAttachmentContent, sizeof(kTestAttachmentContent));
|
||||
writer.Close();
|
||||
|
||||
if (options_.client_uses_signals && !options_.set_first_chance_handler &&
|
||||
options_.crash_type != CrashType::kSimulated) {
|
||||
// Wait for child's client signal handler.
|
||||
|
Loading…
x
Reference in New Issue
Block a user