crash

package
v0.0.0-...-683b059 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 23, 2022 License: BSD-3-Clause Imports: 18 Imported by: 0

Documentation

Overview

Package crash contains functionality shared by tests that exercise the crash reporter.

Index

Constants

View Source
const (
	// CrasherPath is the full path for crasher.
	CrasherPath = "/usr/local/libexec/tast/helpers/local/cros/platform.UserCrash.crasher"
)

Variables

This section is empty.

Functions

func CheckCrashingProcess

func CheckCrashingProcess(ctx context.Context, cr *chrome.Chrome, opts CrasherOptions) error

CheckCrashingProcess runs crasher process and verifies that it's processed.

func CleanCrashSpoolDirs

func CleanCrashSpoolDirs(ctx context.Context, crasherPath string) error

CleanCrashSpoolDirs removes all crash files in the crash spool directories, produced artificially but not consumed during a test.

func RunCrashTest

func RunCrashTest(ctx context.Context, cr *chrome.Chrome, s *testing.State, testFunc func(context.Context, *chrome.Chrome, *testing.State), consentType crash.ConsentType) error

RunCrashTest runs a crash test case after setting up crash reporter.

Types

type CrasherOptions

type CrasherOptions struct {
	Username                string
	CauseCrash              bool
	Consent                 bool
	CrasherPath             string
	ExpectCrashReporterFail bool
}

CrasherOptions stores configurations for running crasher process.

func DefaultCrasherOptions

func DefaultCrasherOptions() CrasherOptions

DefaultCrasherOptions creates a CrasherOptions which actually cause and catch crash. Username is not populated as it should be set explicitly by each test.

type CrasherResult

type CrasherResult struct {
	// ReturnCode is the return code of the crasher process.
	ReturnCode int

	// Crashed stores whether the crasher returned segv error code.
	Crashed bool

	// CrashReporterCaught stores whether the crash reporter caught a segv.
	CrashReporterCaught bool

	// Minidump (.dmp) crash report filename.
	Minidump string

	// Basename of the crash report files.
	Basename string

	// .meta crash report filename.
	Meta string

	// .log crash report filename.
	Log string

	// .pslog crash report filename (optional; only for crash reporter failures)
	Pslog string
}

CrasherResult stores result status and outputs from a crasher process execution.

func RunCrasherProcess

func RunCrasherProcess(ctx context.Context, cr *chrome.Chrome, opts CrasherOptions) (*CrasherResult, error)

RunCrasherProcess runs the crasher process. Will wait up to 10 seconds for crash_reporter to finish.

func RunCrasherProcessAndAnalyze

func RunCrasherProcessAndAnalyze(ctx context.Context, cr *chrome.Chrome, opts CrasherOptions) (*CrasherResult, error)

RunCrasherProcessAndAnalyze executes a crasher process and extracts result data from dumps and logs.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL