How to use repro method of repro Package

Best Syzkaller code snippet using repro.repro

app_test.go

Source:app_test.go Github

copy

Full Screen

...33 Config: &TestConfig{34 Index: 1,35 },36 Filter: func(bug *Bug) FilterResult {37 if strings.HasPrefix(bug.Title, "skip without repro") &&38 bug.ReproLevel != dashapi.ReproLevelNone {39 return FilterSkip40 }41 return FilterReport42 },43 },44 {45 Name: "reporting2",46 DailyLimit: 3,47 Config: &TestConfig{48 Index: 2,49 },50 },51 },52 },53 "test2": &Config{54 AccessLevel: AccessAdmin,55 Key: "test2keytest2keytest2key",56 Clients: map[string]string{57 client2: key2,58 },59 Managers: map[string]ConfigManager{60 "restricted-manager": {61 RestrictedTestingRepo: "git://restricted.git/restricted.git",62 RestrictedTestingReason: "you should test only on restricted.git",63 },64 },65 Reporting: []Reporting{66 {67 Name: "reporting1",68 DailyLimit: 5,69 Config: &EmailConfig{70 Email: "test@syzkaller.com",71 Moderation: true,72 },73 },74 {75 Name: "reporting2",76 DailyLimit: 3,77 Config: &EmailConfig{78 Email: "bugs@syzkaller.com",79 DefaultMaintainers: []string{"default@maintainers.com"},80 MailMaintainers: true,81 },82 },83 },84 },85 // Namespaces for access level testing.86 "access-admin": &Config{87 AccessLevel: AccessAdmin,88 Key: "adminkeyadminkeyadminkey",89 Clients: map[string]string{90 clientAdmin: keyAdmin,91 },92 Reporting: []Reporting{93 {94 Name: "access-admin-reporting1",95 Config: &TestConfig{Index: 1},96 },97 {98 Name: "access-admin-reporting2",99 Config: &TestConfig{Index: 2},100 },101 },102 },103 "access-user": &Config{104 AccessLevel: AccessUser,105 Key: "userkeyuserkeyuserkey",106 Clients: map[string]string{107 clientUser: keyUser,108 },109 Reporting: []Reporting{110 {111 AccessLevel: AccessAdmin,112 Name: "access-admin-reporting1",113 Config: &TestConfig{Index: 1},114 },115 {116 Name: "access-user-reporting2",117 Config: &TestConfig{Index: 2},118 },119 },120 },121 "access-public": &Config{122 Key: "publickeypublickeypublickey",123 Clients: map[string]string{124 clientPublic: keyPublic,125 },126 Reporting: []Reporting{127 {128 AccessLevel: AccessUser,129 Name: "access-user-reporting1",130 Config: &TestConfig{Index: 1},131 },132 {133 Name: "access-public-reporting2",134 Config: &TestConfig{Index: 2},135 },136 },137 },138 },139}140const (141 client1 = "client1"142 client2 = "client2"143 key1 = "client1keyclient1keyclient1key"144 key2 = "client2keyclient2keyclient2key"145 clientAdmin = "client-admin"146 keyAdmin = "clientadminkeyclientadminkey"147 clientUser = "client-user"148 keyUser = "clientuserkeyclientuserkey"149 clientPublic = "client-public"150 keyPublic = "clientpublickeyclientpublickey"151)152type TestConfig struct {153 Index int154}155func (cfg *TestConfig) Type() string {156 return "test"157}158func (cfg *TestConfig) NeedMaintainers() bool {159 return false160}161func (cfg *TestConfig) Validate() error {162 return nil163}164func testBuild(id int) *dashapi.Build {165 return &dashapi.Build{166 Manager: fmt.Sprintf("manager%v", id),167 ID: fmt.Sprintf("build%v", id),168 SyzkallerCommit: fmt.Sprintf("syzkaller_commit%v", id),169 CompilerID: fmt.Sprintf("compiler%v", id),170 KernelRepo: fmt.Sprintf("repo%v", id),171 KernelBranch: fmt.Sprintf("branch%v", id),172 KernelCommit: strings.Repeat(fmt.Sprint(id), 40)[:40],173 KernelCommitTitle: fmt.Sprintf("kernel_commit_title%v", id),174 KernelCommitDate: buildCommitDate,175 KernelConfig: []byte(fmt.Sprintf("config%v", id)),176 }177}178var buildCommitDate = time.Date(1, 2, 3, 4, 5, 6, 0, time.UTC)179func testCrash(build *dashapi.Build, id int) *dashapi.Crash {180 return &dashapi.Crash{181 BuildID: build.ID,182 Title: fmt.Sprintf("title%v", id),183 Log: []byte(fmt.Sprintf("log%v", id)),184 Report: []byte(fmt.Sprintf("report%v", id)),185 }186}187func testCrashWithRepro(build *dashapi.Build, id int) *dashapi.Crash {188 crash := testCrash(build, id)189 crash.ReproOpts = []byte(fmt.Sprintf("repro opts %v", id))190 crash.ReproSyz = []byte(fmt.Sprintf("syncfs(%v)", id))191 crash.ReproC = []byte(fmt.Sprintf("int main() { return %v; }", id))192 return crash193}194func testCrashID(crash *dashapi.Crash) *dashapi.CrashID {195 return &dashapi.CrashID{196 BuildID: crash.BuildID,197 Title: crash.Title,198 }199}200func TestApp(t *testing.T) {201 c := NewCtx(t)202 defer c.Close()203 c.expectOK(c.GET("/"))204 c.expectFail("unknown api method", c.API(client1, key1, "unsupported_method", nil, nil))205 ent := &dashapi.LogEntry{206 Name: "name",207 Text: "text",208 }209 c.expectOK(c.API(client1, key1, "log_error", ent, nil))210 build := testBuild(1)211 c.expectOK(c.API(client1, key1, "upload_build", build, nil))212 // Uploading the same build must be OK.213 c.expectOK(c.API(client1, key1, "upload_build", build, nil))214 // Some bad combinations of client/key.215 c.expectFail("unauthorized", c.API(client1, "", "upload_build", build, nil))216 c.expectFail("unauthorized", c.API("unknown", key1, "upload_build", build, nil))217 c.expectFail("unauthorized", c.API(client1, key2, "upload_build", build, nil))218 crash1 := &dashapi.Crash{219 BuildID: "build1",220 Title: "title1",221 Maintainers: []string{`"Foo Bar" <foo@bar.com>`, `bar@foo.com`},222 Log: []byte("log1"),223 Report: []byte("report1"),224 }225 c.expectOK(c.API(client1, key1, "report_crash", crash1, nil))226 // Test that namespace isolation works.227 c.expectFail("unknown build", c.API(client2, key2, "report_crash", crash1, nil))228 crash2 := &dashapi.Crash{229 BuildID: "build1",230 Title: "title2",231 Maintainers: []string{`bar@foo.com`},232 Log: []byte("log2"),233 Report: []byte("report2"),234 ReproOpts: []byte("opts"),235 ReproSyz: []byte("syz repro"),236 ReproC: []byte("c repro"),237 }238 c.expectOK(c.API(client1, key1, "report_crash", crash2, nil))239 // Provoke purgeOldCrashes.240 for i := 0; i < 30; i++ {241 crash := &dashapi.Crash{242 BuildID: "build1",243 Title: "title1",244 Maintainers: []string{`bar@foo.com`},245 Log: []byte(fmt.Sprintf("log%v", i)),246 Report: []byte(fmt.Sprintf("report%v", i)),247 }248 c.expectOK(c.API(client1, key1, "report_crash", crash, nil))249 }250 cid := &dashapi.CrashID{251 BuildID: "build1",252 Title: "title1",253 }254 c.expectOK(c.API(client1, key1, "report_failed_repro", cid, nil))255 pr := &dashapi.PollBugsRequest{256 Type: "test",257 }258 resp := new(dashapi.PollBugsResponse)259 c.expectOK(c.API(client1, key1, "reporting_poll_bugs", pr, resp))260 cmd := &dashapi.BugUpdate{261 ID: "id",262 Status: dashapi.BugStatusOpen,263 ReproLevel: dashapi.ReproLevelC,264 DupOf: "",265 }266 c.expectOK(c.API(client1, key1, "reporting_update", cmd, nil))267}268// Normal workflow:269// - upload crash -> need repro270// - upload syz repro -> still need repro271// - upload C repro -> don't need repro272func testNeedRepro1(t *testing.T, crashCtor func(c *Ctx) *dashapi.Crash) {273 c := NewCtx(t)274 defer c.Close()275 crash1 := crashCtor(c)276 resp := new(dashapi.ReportCrashResp)277 c.expectOK(c.API(client1, key1, "report_crash", crash1, resp))278 c.expectEQ(resp.NeedRepro, true)279 cid := testCrashID(crash1)280 needReproResp := new(dashapi.NeedReproResp)281 c.expectOK(c.API(client1, key1, "need_repro", cid, needReproResp))282 c.expectEQ(needReproResp.NeedRepro, true)283 // Still need repro for this crash.284 c.expectOK(c.API(client1, key1, "report_crash", crash1, resp))285 c.expectEQ(resp.NeedRepro, true)286 c.expectOK(c.API(client1, key1, "need_repro", cid, needReproResp))287 c.expectEQ(needReproResp.NeedRepro, true)288 crash2 := new(dashapi.Crash)289 *crash2 = *crash1290 crash2.ReproOpts = []byte("opts")291 crash2.ReproSyz = []byte("repro syz")292 c.expectOK(c.API(client1, key1, "report_crash", crash2, resp))293 c.expectEQ(resp.NeedRepro, true)294 c.expectOK(c.API(client1, key1, "need_repro", cid, needReproResp))295 c.expectEQ(needReproResp.NeedRepro, true)296 crash2.ReproC = []byte("repro C")297 c.expectOK(c.API(client1, key1, "report_crash", crash2, resp))298 c.expectEQ(resp.NeedRepro, false)299 c.expectOK(c.API(client1, key1, "need_repro", cid, needReproResp))300 c.expectEQ(needReproResp.NeedRepro, false)301 c.expectOK(c.API(client1, key1, "report_crash", crash1, resp))302 c.expectEQ(resp.NeedRepro, false)303}304func TestNeedRepro1_normal(t *testing.T) { testNeedRepro1(t, normalCrash) }305func TestNeedRepro1_dup(t *testing.T) { testNeedRepro1(t, dupCrash) }306func TestNeedRepro1_closed(t *testing.T) { testNeedRepro1(t, closedCrash) }307func TestNeedRepro1_closedRepro(t *testing.T) { testNeedRepro1(t, closedWithReproCrash) }308// Upload C repro with first crash -> don't need repro.309func testNeedRepro2(t *testing.T, crashCtor func(c *Ctx) *dashapi.Crash) {310 c := NewCtx(t)311 defer c.Close()312 crash1 := crashCtor(c)313 crash1.ReproOpts = []byte("opts")314 crash1.ReproSyz = []byte("repro syz")315 crash1.ReproC = []byte("repro C")316 resp := new(dashapi.ReportCrashResp)317 c.expectOK(c.API(client1, key1, "report_crash", crash1, resp))318 c.expectEQ(resp.NeedRepro, false)319 cid := testCrashID(crash1)320 needReproResp := new(dashapi.NeedReproResp)321 c.expectOK(c.API(client1, key1, "need_repro", cid, needReproResp))322 c.expectEQ(needReproResp.NeedRepro, false)323}324func TestNeedRepro2_normal(t *testing.T) { testNeedRepro2(t, normalCrash) }325func TestNeedRepro2_dup(t *testing.T) { testNeedRepro2(t, dupCrash) }326func TestNeedRepro2_closed(t *testing.T) { testNeedRepro2(t, closedCrash) }327func TestNeedRepro2_closedRepro(t *testing.T) { testNeedRepro2(t, closedWithReproCrash) }328// Test that after uploading 5 failed repros, app stops requesting repros.329func testNeedRepro3(t *testing.T, crashCtor func(c *Ctx) *dashapi.Crash) {330 c := NewCtx(t)331 defer c.Close()332 crash1 := crashCtor(c)333 resp := new(dashapi.ReportCrashResp)334 cid := testCrashID(crash1)335 needReproResp := new(dashapi.NeedReproResp)336 for i := 0; i < maxReproPerBug; i++ {337 c.expectOK(c.API(client1, key1, "report_crash", crash1, resp))338 c.expectEQ(resp.NeedRepro, true)339 c.expectOK(c.API(client1, key1, "need_repro", cid, needReproResp))340 c.expectEQ(needReproResp.NeedRepro, true)341 c.expectOK(c.API(client1, key1, "report_failed_repro", cid, nil))342 }343 c.expectOK(c.API(client1, key1, "report_crash", crash1, resp))344 c.expectEQ(resp.NeedRepro, false)345 c.expectOK(c.API(client1, key1, "need_repro", cid, needReproResp))346 c.expectEQ(needReproResp.NeedRepro, false)347}348func TestNeedRepro3_normal(t *testing.T) { testNeedRepro3(t, normalCrash) }349func TestNeedRepro3_dup(t *testing.T) { testNeedRepro3(t, dupCrash) }350func TestNeedRepro3_closed(t *testing.T) { testNeedRepro3(t, closedCrash) }351func TestNeedRepro3_closedRepro(t *testing.T) { testNeedRepro3(t, closedWithReproCrash) }352// Test that after uploading 5 syz repros, app stops requesting repros.353func testNeedRepro4(t *testing.T, crashCtor func(c *Ctx) *dashapi.Crash) {354 c := NewCtx(t)355 defer c.Close()356 crash1 := crashCtor(c)357 crash1.ReproOpts = []byte("opts")358 crash1.ReproSyz = []byte("repro syz")359 resp := new(dashapi.ReportCrashResp)360 cid := testCrashID(crash1)361 needReproResp := new(dashapi.NeedReproResp)362 for i := 0; i < maxReproPerBug-1; i++ {363 c.expectOK(c.API(client1, key1, "report_crash", crash1, resp))364 c.expectEQ(resp.NeedRepro, true)365 c.expectOK(c.API(client1, key1, "need_repro", cid, needReproResp))366 c.expectEQ(needReproResp.NeedRepro, true)367 }368 c.expectOK(c.API(client1, key1, "report_crash", crash1, resp))369 c.expectEQ(resp.NeedRepro, false)370 c.expectOK(c.API(client1, key1, "need_repro", cid, needReproResp))371 c.expectEQ(needReproResp.NeedRepro, false)372}373func TestNeedRepro4_normal(t *testing.T) { testNeedRepro4(t, normalCrash) }374func TestNeedRepro4_dup(t *testing.T) { testNeedRepro4(t, dupCrash) }375func TestNeedRepro4_closed(t *testing.T) { testNeedRepro4(t, closedCrash) }376func TestNeedRepro4_closedRepro(t *testing.T) { testNeedRepro4(t, closedWithReproCrash) }377func normalCrash(c *Ctx) *dashapi.Crash {378 build := testBuild(1)379 c.expectOK(c.API(client1, key1, "upload_build", build, nil))380 return testCrash(build, 1)381}382func dupCrash(c *Ctx) *dashapi.Crash {383 build := testBuild(1)384 c.expectOK(c.API(client1, key1, "upload_build", build, nil))385 crash1 := testCrash(build, 1)386 c.expectOK(c.API(client1, key1, "report_crash", crash1, nil))387 crash2 := testCrash(build, 2)388 c.expectOK(c.API(client1, key1, "report_crash", crash2, nil))389 pr := &dashapi.PollBugsRequest{390 Type: "test",391 }392 resp := new(dashapi.PollBugsResponse)393 c.expectOK(c.API(client1, key1, "reporting_poll_bugs", pr, resp))394 c.expectEQ(len(resp.Reports), 2)395 rep1 := resp.Reports[0]396 rep2 := resp.Reports[1]397 cmd := &dashapi.BugUpdate{398 ID: rep2.ID,399 Status: dashapi.BugStatusDup,400 DupOf: rep1.ID,401 }402 reply := new(dashapi.BugUpdateReply)403 c.expectOK(c.API(client1, key1, "reporting_update", cmd, reply))404 c.expectEQ(reply.OK, true)405 return crash2406}407func closedCrash(c *Ctx) *dashapi.Crash {408 return closedCrashImpl(c, false)409}410func closedWithReproCrash(c *Ctx) *dashapi.Crash {411 return closedCrashImpl(c, true)412}413func closedCrashImpl(c *Ctx, withRepro bool) *dashapi.Crash {414 build := testBuild(1)415 c.expectOK(c.API(client1, key1, "upload_build", build, nil))416 crash := testCrash(build, 1)417 if withRepro {418 crash.ReproC = []byte("repro C")419 }420 resp := new(dashapi.ReportCrashResp)421 c.expectOK(c.API(client1, key1, "report_crash", crash, resp))422 c.expectEQ(resp.NeedRepro, !withRepro)423 pr := &dashapi.PollBugsRequest{424 Type: "test",425 }426 pollResp := new(dashapi.PollBugsResponse)427 c.expectOK(c.API(client1, key1, "reporting_poll_bugs", pr, pollResp))428 c.expectEQ(len(pollResp.Reports), 1)429 rep := pollResp.Reports[0]430 cmd := &dashapi.BugUpdate{431 ID: rep.ID,432 Status: dashapi.BugStatusInvalid,...

Full Screen

Full Screen

repro_test.go

Source:repro_test.go Github

copy

Full Screen

...6 "time"7 "github.com/google/syzkaller/dashboard/dashapi"8)9// Normal workflow:10// - upload crash -> need repro11// - upload syz repro -> still need repro12// - upload C repro -> don't need repro13func testNeedRepro1(t *testing.T, crashCtor func(c *Ctx) *dashapi.Crash, newBug bool) {14 c := NewCtx(t)15 defer c.Close()16 crash1 := crashCtor(c)17 resp, _ := c.client.ReportCrash(crash1)18 c.expectEQ(resp.NeedRepro, true)19 cid := testCrashID(crash1)20 needRepro, _ := c.client.NeedRepro(cid)21 c.expectEQ(needRepro, true)22 // Still need repro for this crash.23 resp, _ = c.client.ReportCrash(crash1)24 c.expectEQ(resp.NeedRepro, true)25 needRepro, _ = c.client.NeedRepro(cid)26 c.expectEQ(needRepro, true)27 crash2 := new(dashapi.Crash)28 *crash2 = *crash129 crash2.ReproOpts = []byte("opts")30 crash2.ReproSyz = []byte("repro syz")31 resp, _ = c.client.ReportCrash(crash2)32 c.expectEQ(resp.NeedRepro, true)33 needRepro, _ = c.client.NeedRepro(cid)34 c.expectEQ(needRepro, true)35 crash2.ReproC = []byte("repro C")36 resp, _ = c.client.ReportCrash(crash2)37 c.expectEQ(resp.NeedRepro, false)38 needRepro, _ = c.client.NeedRepro(cid)39 c.expectEQ(needRepro, false)40 resp, _ = c.client.ReportCrash(crash2)41 c.expectEQ(resp.NeedRepro, false)42 if newBug {43 c.client.pollBug()44 }45}46func TestNeedRepro1_normal(t *testing.T) { testNeedRepro1(t, normalCrash, true) }47func TestNeedRepro1_dup(t *testing.T) { testNeedRepro1(t, dupCrash, false) }48func TestNeedRepro1_closed(t *testing.T) { testNeedRepro1(t, closedCrash, true) }49func TestNeedRepro1_closedRepro(t *testing.T) { testNeedRepro1(t, closedWithReproCrash, true) }50// Upload C repro with first crash -> don't need repro.51func testNeedRepro2(t *testing.T, crashCtor func(c *Ctx) *dashapi.Crash, newBug bool) {52 c := NewCtx(t)53 defer c.Close()54 crash1 := crashCtor(c)55 crash1.ReproOpts = []byte("opts")56 crash1.ReproSyz = []byte("repro syz")57 crash1.ReproC = []byte("repro C")58 resp, _ := c.client.ReportCrash(crash1)59 c.expectEQ(resp.NeedRepro, false)60 needRepro, _ := c.client.NeedRepro(testCrashID(crash1))61 c.expectEQ(needRepro, false)62 if newBug {63 c.client.pollBug()64 }65}66func TestNeedRepro2_normal(t *testing.T) { testNeedRepro2(t, normalCrash, true) }67func TestNeedRepro2_dup(t *testing.T) { testNeedRepro2(t, dupCrash, false) }68func TestNeedRepro2_closed(t *testing.T) { testNeedRepro2(t, closedCrash, true) }69func TestNeedRepro2_closedRepro(t *testing.T) { testNeedRepro2(t, closedWithReproCrash, true) }70// Test that after uploading 5 failed repros, app stops requesting repros.71func testNeedRepro3(t *testing.T, crashCtor func(c *Ctx) *dashapi.Crash) {72 c := NewCtx(t)73 defer c.Close()74 crash1 := crashCtor(c)75 for i := 0; i < maxReproPerBug; i++ {76 resp, _ := c.client.ReportCrash(crash1)77 c.expectEQ(resp.NeedRepro, true)78 needRepro, _ := c.client.NeedRepro(testCrashID(crash1))79 c.expectEQ(needRepro, true)80 c.client.ReportFailedRepro(testCrashID(crash1))81 }82 for i := 0; i < 3; i++ {83 // No more repros today.84 c.advanceTime(time.Hour)85 resp, _ := c.client.ReportCrash(crash1)86 c.expectEQ(resp.NeedRepro, false)87 needRepro, _ := c.client.NeedRepro(testCrashID(crash1))88 c.expectEQ(needRepro, false)89 // Then another repro after a day.90 c.advanceTime(25 * time.Hour)91 for j := 0; j < 2; j++ {92 resp, _ := c.client.ReportCrash(crash1)93 c.expectEQ(resp.NeedRepro, true)94 needRepro, _ := c.client.NeedRepro(testCrashID(crash1))95 c.expectEQ(needRepro, true)96 }97 c.client.ReportFailedRepro(testCrashID(crash1))98 }99}100func TestNeedRepro3_normal(t *testing.T) { testNeedRepro3(t, normalCrash) }101func TestNeedRepro3_dup(t *testing.T) { testNeedRepro3(t, dupCrash) }102func TestNeedRepro3_closed(t *testing.T) { testNeedRepro3(t, closedCrash) }103func TestNeedRepro3_closedRepro(t *testing.T) { testNeedRepro3(t, closedWithReproCrash) }104// Test that after uploading 5 syz repros, app stops requesting repros.105func testNeedRepro4(t *testing.T, crashCtor func(c *Ctx) *dashapi.Crash, newBug bool) {106 c := NewCtx(t)107 defer c.Close()108 crash1 := crashCtor(c)109 crash1.ReproOpts = []byte("opts")110 crash1.ReproSyz = []byte("repro syz")111 for i := 0; i < maxReproPerBug-1; i++ {112 resp, _ := c.client.ReportCrash(crash1)113 c.expectEQ(resp.NeedRepro, true)114 needRepro, _ := c.client.NeedRepro(testCrashID(crash1))115 c.expectEQ(needRepro, true)116 }117 resp, _ := c.client.ReportCrash(crash1)118 c.expectEQ(resp.NeedRepro, false)119 needRepro, _ := c.client.NeedRepro(testCrashID(crash1))120 c.expectEQ(needRepro, false)121 // No more repros even after a day.122 c.advanceTime(25 * time.Hour)123 crash1.ReproOpts = nil124 crash1.ReproSyz = nil125 resp, _ = c.client.ReportCrash(crash1)126 c.expectEQ(resp.NeedRepro, false)127 needRepro, _ = c.client.NeedRepro(testCrashID(crash1))128 c.expectEQ(needRepro, false)129 if newBug {130 c.client.pollBug()131 }132}133func TestNeedRepro4_normal(t *testing.T) { testNeedRepro4(t, normalCrash, true) }134func TestNeedRepro4_dup(t *testing.T) { testNeedRepro4(t, dupCrash, false) }135func TestNeedRepro4_closed(t *testing.T) { testNeedRepro4(t, closedCrash, true) }136func TestNeedRepro4_closedRepro(t *testing.T) { testNeedRepro4(t, closedWithReproCrash, true) }137func normalCrash(c *Ctx) *dashapi.Crash {138 build := testBuild(1)139 c.client.UploadBuild(build)140 crash := testCrash(build, 1)141 c.client.ReportCrash(crash)142 c.client.pollBug()143 return crash144}145func dupCrash(c *Ctx) *dashapi.Crash {146 build := testBuild(1)147 c.client.UploadBuild(build)148 c.client.ReportCrash(testCrash(build, 1))149 crash2 := testCrash(build, 2)150 c.client.ReportCrash(crash2)151 reports := c.client.pollBugs(2)152 c.client.updateBug(reports[1].ID, dashapi.BugStatusDup, reports[0].ID)153 return crash2154}155func closedCrash(c *Ctx) *dashapi.Crash {156 return closedCrashImpl(c, false)157}158func closedWithReproCrash(c *Ctx) *dashapi.Crash {159 return closedCrashImpl(c, true)160}161func closedCrashImpl(c *Ctx, withRepro bool) *dashapi.Crash {162 build := testBuild(1)163 c.client.UploadBuild(build)164 crash := testCrash(build, 1)165 if withRepro {166 crash.ReproC = []byte("repro C")167 }168 resp, _ := c.client.ReportCrash(crash)169 c.expectEQ(resp.NeedRepro, !withRepro)170 rep := c.client.pollBug()171 c.client.updateBug(rep.ID, dashapi.BugStatusInvalid, "")172 crash.ReproC = nil173 c.client.ReportCrash(crash)174 c.client.pollBug()175 return crash176}...

Full Screen

Full Screen

state_test.go

Source:state_test.go Github

copy

Full Screen

...55 }56 checkPendingRepro(t, st, "foo", "")57 checkPendingRepro(t, st, "bar", "open()")58 checkPendingRepro(t, st, "bar", "")59 // This repro is already present.60 if err := st.AddRepro("bar", []byte("open()")); err != nil {61 t.Fatalf("AddRepro failed: %v", err)62 }63 if err := st.AddRepro("bar", []byte("read()")); err != nil {64 t.Fatalf("AddRepro failed: %v", err)65 }66 if err := st.AddRepro("bar", []byte("open()\nread()")); err != nil {67 t.Fatalf("AddRepro failed: %v", err)68 }69 // This does not satisfy foo's call set.70 if err := st.AddRepro("bar", []byte("close()")); err != nil {71 t.Fatalf("AddRepro failed: %v", err)72 }73 checkPendingRepro(t, st, "bar", "")74 // Check how persistence works.75 st, err = Make(dir)76 if err != nil {77 t.Fatalf("failed to make state: %v", err)78 }79 if err := st.Connect("foo", false, []string{"open", "read", "write"}, nil); err != nil {80 t.Fatalf("Connect failed: %v", err)81 }82 if err := st.Connect("bar", false, []string{"open", "read", "close"}, nil); err != nil {83 t.Fatalf("Connect failed: %v", err)84 }85 checkPendingRepro(t, st, "bar", "")86 checkPendingRepro(t, st, "foo", "read()")87 checkPendingRepro(t, st, "foo", "open()\nread()")88 checkPendingRepro(t, st, "foo", "")89}90func checkPendingRepro(t *testing.T, st *State, name, result string) {91 repro, err := st.PendingRepro(name)92 if err != nil {93 t.Fatalf("\n%v: PendingRepro failed: %v", caller(1), err)94 }95 if string(repro) != result {96 t.Fatalf("\n%v: PendingRepro returned %q, want %q", caller(1), string(repro), result)97 }98}99func caller(skip int) string {100 _, file, line, _ := runtime.Caller(skip + 1)101 return fmt.Sprintf("%v:%v", filepath.Base(file), line)102}...

Full Screen

Full Screen

repro

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 fmt.Println("Hello, playground")4}5import (6func main() {7 fmt.Println("Hello, playground")8}9import (10func main() {11 fmt.Println("Hello, playground")12}

Full Screen

Full Screen

repro

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 fmt.Println("Hello World")4}5import (6func main() {7 fmt.Println("Hello World")8}9import (10func main() {11 fmt.Println("Hello World")12}13import (14func main() {15 fmt.Println("Hello World")16}17import (18func main() {19 fmt.Println("Hello World")20}21import (22func main() {23 fmt.Println("Hello World")24}25import (26func main() {27 fmt.Println("Hello World")28}29import (30func main() {31 fmt.Println("Hello World")32}33import (34func main() {35 fmt.Println("Hello World")36}37import (38func main() {39 fmt.Println("Hello World")40}41import (42func main() {43 fmt.Println("Hello World")44}45import (46func main() {47 fmt.Println("Hello World")48}49import (50func main() {51 fmt.Println("Hello World")52}53import (54func main() {55 fmt.Println("Hello

Full Screen

Full Screen

repro

Using AI Code Generation

copy

Full Screen

1import "fmt"2type Repro struct {3}4func (r Repro) repro() {5 fmt.Println("repro")6}7func main() {8 r := Repro{"repro"}9 r.repro()10}11import "fmt"12type Repro struct {13}14func (r Repro) repro() {15 fmt.Println("repro")16}17func main() {18 r := Repro{"repro"}19 Repro.repro(r)20}21import "fmt"22type Repro interface {23 repro()24}25type ReproImpl struct {26}27func (r ReproImpl) repro() {28 fmt.Println("repro")29}30func main() {31 r := ReproImpl{"repro"}32 r.repro()33}34import "fmt"35type Repro interface {36 repro()37}38type ReproImpl struct {39}40func (r ReproImpl) repro() {41 fmt.Println("repro")42}43func main() {44 r := ReproImpl{"repro"}45 Repro.repro(r)46}47import "fmt"48type Repro interface {49 repro()50}51type ReproImpl struct {52}53func (r ReproImpl) repro() {54 fmt.Println("repro")55}56func main() {57 r := ReproImpl{"repro"}58 ReproImpl.repro(r)59}60import "fmt"61type Repro interface {62 repro()63}64type ReproImpl struct {65}66func (r ReproImpl) repro() {67 fmt.Println("repro")68}69func main() {70 r := ReproImpl{"repro"}71 ReproImpl.repro(r)72}73import "fmt"74type Repro interface {75 repro()76}

Full Screen

Full Screen

repro

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 fmt.Println(repro.Repro())4}5import (6func main() {7 fmt.Println(repro.Repro())8}9import (10func main() {11 fmt.Println(repro.Repro())12}13import (14func main() {15 fmt.Println(repro.Repro())16}17import (18func main() {19 fmt.Println(repro.Repro())20}21import (22func main() {23 fmt.Println(repro.Repro())24}25import (26func main() {27 fmt.Println(repro.Repro())28}29import (30func main() {31 fmt.Println(repro.Repro())32}33import (34func main() {35 fmt.Println(repro.Repro())36}37import (38func main() {39 fmt.Println(repro.Repro())40}41import (

Full Screen

Full Screen

repro

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 fmt.Println("Hello, playground")4 r.Repro()5}6import (7func main() {8 fmt.Println("Hello, playground")9 r.Repro()10}11import (12func main() {13 fmt.Println("Hello, playground")14 r.Repro()15}16import (17func main() {18 fmt.Println("Hello, playground")19 r.Repro()20}21import (22func main() {23 fmt.Println("Hello, playground")24 r.Repro()25}26import (27func main() {28 fmt.Println("Hello, playground")29 r.Repro()30}31import (32func main() {33 fmt.Println("Hello, playground")34 r.Repro()35}36import (37func main() {38 fmt.Println("Hello, playground")39 r.Repro()40}41import (42func main() {43 fmt.Println("Hello, playground")44 r.Repro()45}46import (47func main() {48 fmt.Println("

Full Screen

Full Screen

repro

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 r := repro.NewRepro()4 r.Repro()5}6import (7type Repro struct {8}9func NewRepro() *Repro {10 return &Repro{}11}12func (r *Repro) Repro() {13 fmt.Println("hello world")14}15import (16func TestRepro(t *testing.T) {17 r := NewRepro()18 r.Repro()19}

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful