func TestParseDumpFilesCase5(t *testing.T) { // Case 5, both debug and release crashed, but no stacktrace debugDump := testutils.MustReadFile(stacktrace("case5_debug.dump")) debugErr := testutils.MustReadFile(stacktrace("case5_debug.err")) releaseDump := testutils.MustReadFile(stacktrace("case5_release.dump")) releaseErr := testutils.MustReadFile(stacktrace("case5_release.err")) result := ParseFuzzResult(debugDump, debugErr, releaseDump, releaseErr) expectedFlags := DebugCrashed | ReleaseCrashed | DebugNoStackTrace | ReleaseNoStackTrace if result.Flags != expectedFlags { t.Errorf("parsed Flags were wrong. Expected %s, but was %s", expectedFlags.String(), result.Flags.String()) } }
func TestParseDumpFilesCase4(t *testing.T) { // Case 4, both debug and release failed gracefully debugDump := testutils.MustReadFile(stacktrace("case4_debug.dump")) debugErr := testutils.MustReadFile(stacktrace("case4_debug.err")) releaseDump := testutils.MustReadFile(stacktrace("case4_release.dump")) releaseErr := testutils.MustReadFile(stacktrace("case4_release.err")) result := ParseFuzzResult(debugDump, debugErr, releaseDump, releaseErr) expectedFlags := DebugFailedGracefully | ReleaseFailedGracefully if result.Flags != expectedFlags { t.Errorf("parsed Flags were wrong. Expected %s, but was %s", expectedFlags.String(), result.Flags.String()) } }
func TestParseDumpFilesCase3(t *testing.T) { // Case 3, both debug and release ran a bad malloc debugDump := testutils.MustReadFile(stacktrace("case3_debug.dump")) debugErr := testutils.MustReadFile(stacktrace("case3_debug.err")) releaseDump := testutils.MustReadFile(stacktrace("case3_release.dump")) releaseErr := testutils.MustReadFile(stacktrace("case3_release.err")) result := ParseFuzzResult(debugDump, debugErr, releaseDump, releaseErr) expectedFlags := DebugCrashed | DebugBadAlloc | ReleaseCrashed | ReleaseBadAlloc if result.Flags != expectedFlags { t.Errorf("parsed Flags were wrong. Expected %s, but was %s", expectedFlags.String(), result.Flags.String()) } }
func TestParseDumpFilesCase2(t *testing.T) { // Case 2, debug dumped and hit an assertion, release timed out debugDump := testutils.MustReadFile(stacktrace("case2_debug.dump")) debugErr := testutils.MustReadFile(stacktrace("case2_debug.err")) releaseDump := "" releaseErr := "" result := ParseFuzzResult(debugDump, debugErr, releaseDump, releaseErr) expectedFlags := DebugCrashed | DebugAssertionViolated | ReleaseTimedOut if result.Flags != expectedFlags { t.Errorf("parsed Flags were wrong. Expected %s, but was %s", expectedFlags.String(), result.Flags.String()) } }
func TestParseDumpFilesCase0(t *testing.T) { // Case 0, both debug and release dumped, due to an assertion error debugDump := testutils.MustReadFile(stacktrace("case0_debug.dump")) debugErr := testutils.MustReadFile(stacktrace("case0_debug.err")) releaseDump := testutils.MustReadFile(stacktrace("case0_release.dump")) releaseErr := testutils.MustReadFile(stacktrace("case0_release.err")) result := ParseFuzzResult(debugDump, debugErr, releaseDump, releaseErr) expectedFlags := DebugCrashed | ReleaseCrashed | DebugAssertionViolated | ReleaseOther if result.Flags != expectedFlags { t.Errorf("parsed Flags were wrong. Expected %s, but was %s", expectedFlags.String(), result.Flags.String()) } }
func TestParseDebugDump(t *testing.T) { testInput := testutils.MustReadFile("parse-debug.dump") trace := ParseStackTrace(testInput) expected := StackTrace{ Frames: []StackTraceFrame{ BasicStackFrame("src/core/", "SkReadBuffer.h", 130), BasicStackFrame("src/core/", "SkReadBuffer.h", 136), BasicStackFrame("src/core/", "SkPaint.cpp", 1971), BasicStackFrame("src/core/", "SkReadBuffer.h", 126), BasicStackFrame("src/core/", "SkPictureData.cpp", 498), BasicStackFrame("src/core/", "SkPictureData.cpp", 424), BasicStackFrame("src/core/", "SkPictureData.cpp", 580), BasicStackFrame("src/core/", "SkPictureData.cpp", 553), BasicStackFrame("src/core/", "SkPicture.cpp", 153), BasicStackFrame("src/core/", "SkPictureData.cpp", 392), BasicStackFrame("src/core/", "SkPictureData.cpp", 580), BasicStackFrame("src/core/", "SkPictureData.cpp", 553), BasicStackFrame("src/core/", "SkPicture.cpp", 153), BasicStackFrame("src/core/", "SkPicture.cpp", 142), BasicStackFrame("fuzzer_cache/src/", "parseskp.cpp", 41), BasicStackFrame("fuzzer_cache/src/", "parseskp.cpp", 71), }, } if !reflect.DeepEqual(expected, trace) { t.Errorf("Expected %#v\nbut was %#v", expected, trace) } }
"testing" "time" "github.com/jmoiron/sqlx" assert "github.com/stretchr/testify/require" "go.skia.org/infra/go/database/testutil" "go.skia.org/infra/go/gitinfo" "go.skia.org/infra/go/mockhttpclient" "go.skia.org/infra/go/testutils" "go.skia.org/infra/go/util" ) var ( // testJsonInput is raw JSON data as returned from the build master. defaultBuild = testutils.MustReadFile("default_build.json") testJsonInput = strings.Replace(strings.Replace(defaultBuild, "%(buildnumber)d", "721", -1), "%(gotRevision)s", "051955c355eb742550ddde4eccc3e90b6dc5b887", -1) ubuntu0 = strings.Replace(strings.Replace(defaultBuild, "%(buildnumber)d", "0", -1), "%(gotRevision)s", "4b822ebb7cedd90acbac6a45b897438746973a87", -1) ubuntu1 = strings.Replace(strings.Replace(defaultBuild, "%(buildnumber)d", "1", -1), "%(gotRevision)s", "6d4811eddfa637fac0852c3a0801b773be1f260d", -1) ubuntu2 = strings.Replace(strings.Replace(defaultBuild, "%(buildnumber)d", "2", -1), "%(gotRevision)s", "8d2d1247ef5d2b8a8d3394543df6c12a85881296", -1) ubuntu3 = strings.Replace(strings.Replace(defaultBuild, "%(buildnumber)d", "3", -1), "%(gotRevision)s", "ecb424466a4f3b040586a062c15ed58356f6590e", -1) ubuntu4 = strings.Replace(strings.Replace(defaultBuild, "%(buildnumber)d", "4", -1), "%(gotRevision)s", "06eb2a58139d3ff764f10232d5c8f9362d55e20f", -1) ubuntu5 = strings.Replace(strings.Replace(defaultBuild, "%(buildnumber)d", "5", -1), "%(gotRevision)s", "", -1) ubuntu6 = strings.Replace(strings.Replace(defaultBuild, "%(buildnumber)d", "6", -1), "%(gotRevision)s", "d74dfd42a48325ab2f3d4a97278fc283036e0ea4", -1) // testIncompleteBuild is JSON data for a not-yet-finished build. testIncompleteBuild = testutils.MustReadFile("unfinished_build.json") // Results for /json/builders on various masters. buildersAndroid = testutils.MustReadFile("builders_android.json") buildersCompile = "{}"