How to use expectNE method of main Package

Best Syzkaller code snippet using main.expectNE

jobs_test.go

Source:jobs_test.go Github

copy

Full Screen

...75 c.expectNoEmail()76 pollResp = c.client2.pollJobs("foobar")77 c.expectEQ(pollResp.ID, "")78 pollResp = c.client2.pollJobs(build.Manager)79 c.expectNE(pollResp.ID, "")80 c.expectEQ(pollResp.Type, dashapi.JobTestPatch)81 c.expectEQ(pollResp.Manager, build.Manager)82 c.expectEQ(pollResp.KernelRepo, "git://git.git/git.git")83 c.expectEQ(pollResp.KernelBranch, "kernel-branch")84 c.expectEQ(pollResp.KernelConfig, build.KernelConfig)85 c.expectEQ(pollResp.SyzkallerCommit, build.SyzkallerCommit)86 c.expectEQ(pollResp.Patch, []byte(patch))87 c.expectEQ(pollResp.ReproOpts, []byte("repro opts"))88 c.expectEQ(pollResp.ReproSyz, []byte("repro syz"))89 c.expectEQ(pollResp.ReproC, []byte("repro C"))90 pollResp2 := c.client2.pollJobs(build.Manager)91 c.expectEQ(pollResp2, pollResp)92 jobDoneReq := &dashapi.JobDoneReq{93 ID: pollResp.ID,94 Build: *build,95 CrashTitle: "test crash title",96 CrashLog: []byte("test crash log"),97 CrashReport: []byte("test crash report"),98 }99 c.client2.JobDone(jobDoneReq)100 {101 dbJob, dbBuild, _ := c.loadJob(pollResp.ID)102 patchLink := externalLink(c.ctx, textPatch, dbJob.Patch)103 kernelConfigLink := externalLink(c.ctx, textKernelConfig, dbBuild.KernelConfig)104 logLink := externalLink(c.ctx, textCrashLog, dbJob.CrashLog)105 msg := c.pollEmailBug()106 to := email.MergeEmailLists([]string{"test@requester.com", "somebody@else.com", mailingList})107 c.expectEQ(msg.To, to)108 c.expectEQ(msg.Subject, "Re: "+crash.Title)109 c.expectEQ(len(msg.Attachments), 0)110 c.expectEQ(msg.Body, fmt.Sprintf(`Hello,111syzbot has tested the proposed patch but the reproducer still triggered crash:112test crash title113test crash report114Tested on:115commit: 11111111 kernel_commit_title1116git tree: repo1 branch1117console output: %[3]v118kernel config: %[2]v119dashboard link: https://testapp.appspot.com/bug?extid=%[4]v120compiler: compiler1121patch: %[1]v122`, patchLink, kernelConfigLink, logLink, extBugID))123 c.checkURLContents(patchLink, []byte(patch))124 c.checkURLContents(kernelConfigLink, build.KernelConfig)125 c.checkURLContents(logLink, jobDoneReq.CrashLog)126 }127 // Testing fails with an error.128 c.incomingEmail(sender, "#syz test: git://git.git/git.git kernel-branch\n"+patch, EmailOptMessageID(2))129 pollResp = c.client2.pollJobs(build.Manager)130 c.expectEQ(pollResp.Type, dashapi.JobTestPatch)131 jobDoneReq = &dashapi.JobDoneReq{132 ID: pollResp.ID,133 Build: *build,134 Error: []byte("failed to apply patch"),135 }136 c.client2.JobDone(jobDoneReq)137 {138 dbJob, dbBuild, _ := c.loadJob(pollResp.ID)139 patchLink := externalLink(c.ctx, textPatch, dbJob.Patch)140 kernelConfigLink := externalLink(c.ctx, textKernelConfig, dbBuild.KernelConfig)141 msg := c.pollEmailBug()142 c.expectEQ(len(msg.Attachments), 0)143 c.expectEQ(msg.Body, fmt.Sprintf(`Hello,144syzbot tried to test the proposed patch but build/boot failed:145failed to apply patch146Tested on:147commit: 11111111 kernel_commit_title1148git tree: repo1 branch1149kernel config: %[2]v150dashboard link: https://testapp.appspot.com/bug?extid=%[3]v151compiler: compiler1152patch: %[1]v153`, patchLink, kernelConfigLink, extBugID))154 c.checkURLContents(patchLink, []byte(patch))155 c.checkURLContents(kernelConfigLink, build.KernelConfig)156 }157 // Testing fails with a huge error that can't be inlined in email.158 c.incomingEmail(sender, "#syz test: git://git.git/git.git kernel-branch\n"+patch, EmailOptMessageID(3))159 pollResp = c.client2.pollJobs(build.Manager)160 c.expectEQ(pollResp.Type, dashapi.JobTestPatch)161 jobDoneReq = &dashapi.JobDoneReq{162 ID: pollResp.ID,163 Build: *build,164 Error: bytes.Repeat([]byte{'a', 'b', 'c'}, (maxInlineError+100)/3),165 }166 c.client2.JobDone(jobDoneReq)167 {168 dbJob, dbBuild, _ := c.loadJob(pollResp.ID)169 patchLink := externalLink(c.ctx, textPatch, dbJob.Patch)170 errorLink := externalLink(c.ctx, textError, dbJob.Error)171 kernelConfigLink := externalLink(c.ctx, textKernelConfig, dbBuild.KernelConfig)172 msg := c.pollEmailBug()173 c.expectEQ(len(msg.Attachments), 0)174 truncatedError := string(jobDoneReq.Error[len(jobDoneReq.Error)-maxInlineError:])175 c.expectEQ(msg.Body, fmt.Sprintf(`Hello,176syzbot tried to test the proposed patch but build/boot failed:177%[1]v178Error text is too large and was truncated, full error text is at:179%[2]v180Tested on:181commit: 11111111 kernel_commit_title1182git tree: repo1 branch1183kernel config: %[4]v184dashboard link: https://testapp.appspot.com/bug?extid=%[5]v185compiler: compiler1186patch: %[3]v187`, truncatedError, errorLink, patchLink, kernelConfigLink, extBugID))188 c.checkURLContents(patchLink, []byte(patch))189 c.checkURLContents(errorLink, jobDoneReq.Error)190 c.checkURLContents(kernelConfigLink, build.KernelConfig)191 }192 c.incomingEmail(sender, "#syz test: git://git.git/git.git kernel-branch\n"+patch, EmailOptMessageID(4))193 pollResp = c.client2.pollJobs(build.Manager)194 c.expectEQ(pollResp.Type, dashapi.JobTestPatch)195 jobDoneReq = &dashapi.JobDoneReq{196 ID: pollResp.ID,197 Build: *build,198 }199 c.client2.JobDone(jobDoneReq)200 {201 dbJob, dbBuild, _ := c.loadJob(pollResp.ID)202 patchLink := externalLink(c.ctx, textPatch, dbJob.Patch)203 kernelConfigLink := externalLink(c.ctx, textKernelConfig, dbBuild.KernelConfig)204 msg := c.pollEmailBug()205 c.expectEQ(len(msg.Attachments), 0)206 c.expectEQ(msg.Body, fmt.Sprintf(`Hello,207syzbot has tested the proposed patch and the reproducer did not trigger crash:208Reported-and-tested-by: syzbot+%v@testapp.appspotmail.com209Tested on:210commit: 11111111 kernel_commit_title1211git tree: repo1 branch1212kernel config: %[3]v213dashboard link: https://testapp.appspot.com/bug?extid=%[1]v214compiler: compiler1215patch: %[2]v216Note: testing is done by a robot and is best-effort only.217`, extBugID, patchLink, kernelConfigLink))218 c.checkURLContents(patchLink, []byte(patch))219 c.checkURLContents(kernelConfigLink, build.KernelConfig)220 }221 pollResp = c.client2.pollJobs(build.Manager)222 c.expectEQ(pollResp.ID, "")223}224// Test on particular commit and without a patch.225func TestJobWithoutPatch(t *testing.T) {226 c := NewCtx(t)227 defer c.Close()228 build := testBuild(1)229 c.client2.UploadBuild(build)230 crash := testCrash(build, 1)231 crash.ReproOpts = []byte("repro opts")232 crash.ReproSyz = []byte("repro syz")233 c.client2.ReportCrash(crash)234 c.client2.pollAndFailBisectJob(build.Manager)235 sender := c.pollEmailBug().Sender236 _, extBugID, err := email.RemoveAddrContext(sender)237 c.expectOK(err)238 // Patch testing should happen for bugs with fix commits too.239 c.incomingEmail(sender, "#syz fix: some commit title\n")240 c.incomingEmail(sender, "#syz test git://mygit.com/git.git 5e6a2eea\n", EmailOptMessageID(1))241 c.expectNoEmail()242 pollResp := c.client2.pollJobs(build.Manager)243 c.expectEQ(pollResp.Type, dashapi.JobTestPatch)244 testBuild := testBuild(2)245 testBuild.KernelRepo = "git://mygit.com/git.git"246 testBuild.KernelBranch = ""247 testBuild.KernelCommit = "5e6a2eea5e6a2eea5e6a2eea5e6a2eea5e6a2eea"248 jobDoneReq := &dashapi.JobDoneReq{249 ID: pollResp.ID,250 Build: *testBuild,251 }252 c.client2.JobDone(jobDoneReq)253 {254 _, dbBuild, _ := c.loadJob(pollResp.ID)255 kernelConfigLink := externalLink(c.ctx, textKernelConfig, dbBuild.KernelConfig)256 msg := c.pollEmailBug()257 c.expectEQ(len(msg.Attachments), 0)258 c.expectEQ(msg.Body, fmt.Sprintf(`Hello,259syzbot has tested the proposed patch and the reproducer did not trigger crash:260Reported-and-tested-by: syzbot+%v@testapp.appspotmail.com261Tested on:262commit: 5e6a2eea kernel_commit_title2263git tree: git://mygit.com/git.git264kernel config: %[2]v265dashboard link: https://testapp.appspot.com/bug?extid=%[1]v266compiler: compiler2267Note: testing is done by a robot and is best-effort only.268`, extBugID, kernelConfigLink))269 c.checkURLContents(kernelConfigLink, testBuild.KernelConfig)270 }271 pollResp = c.client2.pollJobs(build.Manager)272 c.expectEQ(pollResp.ID, "")273}274// Test on a restricted manager.275func TestJobRestrictedManager(t *testing.T) {276 c := NewCtx(t)277 defer c.Close()278 build := testBuild(1)279 build.Manager = "restricted-manager"280 c.client2.UploadBuild(build)281 crash := testCrash(build, 1)282 crash.ReproSyz = []byte("repro syz")283 c.client2.ReportCrash(crash)284 c.client2.pollAndFailBisectJob(build.Manager)285 sender := c.pollEmailBug().Sender286 // Testing on a wrong repo must fail and no test jobs passed to manager.287 c.incomingEmail(sender, "#syz test: git://mygit.com/git.git master\n", EmailOptMessageID(1))288 c.expectEQ(strings.Contains((<-c.emailSink).Body, "you should test only on restricted.git"), true)289 pollResp := c.client2.pollJobs(build.Manager)290 c.expectEQ(pollResp.ID, "")291 // Testing on the right repo must succeed.292 c.incomingEmail(sender, "#syz test: git://restricted.git/restricted.git master\n", EmailOptMessageID(2))293 pollResp = c.client2.pollJobs(build.Manager)294 c.expectNE(pollResp.ID, "")295 c.expectEQ(pollResp.Type, dashapi.JobTestPatch)296 c.expectEQ(pollResp.Manager, build.Manager)297 c.expectEQ(pollResp.KernelRepo, "git://restricted.git/restricted.git")298}299// Test that JobBisectFix is returned only after 30 days.300func TestBisectFixJob(t *testing.T) {301 c := NewCtx(t)302 defer c.Close()303 // Upload a crash report304 build := testBuild(1)305 c.client2.UploadBuild(build)306 crash := testCrashWithRepro(build, 1)307 c.client2.ReportCrash(crash)308 c.client2.pollEmailBug()309 // Receive the JobBisectCause310 resp := c.client2.pollJobs(build.Manager)311 c.client2.expectNE(resp.ID, "")312 c.client2.expectEQ(resp.Type, dashapi.JobBisectCause)313 done := &dashapi.JobDoneReq{314 ID: resp.ID,315 Error: []byte("testBisectFixJob:JobBisectCause"),316 }317 c.client2.expectOK(c.client2.JobDone(done))318 // Ensure no more jobs319 resp = c.client2.pollJobs(build.Manager)320 c.client2.expectEQ(resp.ID, "")321 // Advance time by 30 days and read out any notification emails322 {323 c.advanceTime(30 * 24 * time.Hour)324 msg := c.client2.pollEmailBug()325 c.expectEQ(msg.Subject, "title1")326 c.expectTrue(strings.Contains(msg.Body, "Sending this report upstream."))327 msg = c.client2.pollEmailBug()328 c.expectEQ(msg.Subject, "title1")329 c.expectTrue(strings.Contains(msg.Body, "syzbot found the following crash"))330 }331 // Ensure that we get a JobBisectFix332 resp = c.client2.pollJobs(build.Manager)333 c.client2.expectNE(resp.ID, "")334 c.client2.expectEQ(resp.Type, dashapi.JobBisectFix)335 done = &dashapi.JobDoneReq{336 ID: resp.ID,337 Error: []byte("testBisectFixJob:JobBisectFix"),338 }339 c.client2.expectOK(c.client2.JobDone(done))340}341// Test that JobBisectFix jobs are re-tried if crash occurs on ToT.342func TestBisectFixRetry(t *testing.T) {343 c := NewCtx(t)344 defer c.Close()345 // Upload a crash report346 build := testBuild(1)347 c.client2.UploadBuild(build)348 crash := testCrashWithRepro(build, 1)349 c.client2.ReportCrash(crash)350 c.client2.pollEmailBug()351 // Receive the JobBisectCause352 resp := c.client2.pollJobs(build.Manager)353 c.client2.expectNE(resp.ID, "")354 c.client2.expectEQ(resp.Type, dashapi.JobBisectCause)355 done := &dashapi.JobDoneReq{356 ID: resp.ID,357 Error: []byte("testBisectFixRetry:JobBisectCause"),358 }359 c.client2.expectOK(c.client2.JobDone(done))360 // Advance time by 30 days and read out any notification emails361 {362 c.advanceTime(30 * 24 * time.Hour)363 msg := c.client2.pollEmailBug()364 c.expectEQ(msg.Subject, "title1")365 c.expectTrue(strings.Contains(msg.Body, "Sending this report upstream."))366 msg = c.client2.pollEmailBug()367 c.expectEQ(msg.Subject, "title1")368 c.expectTrue(strings.Contains(msg.Body, "syzbot found the following crash"))369 }370 // Ensure that we get a JobBisectFix. We send back a crashlog, no error, no commits371 resp = c.client2.pollJobs(build.Manager)372 c.client2.expectNE(resp.ID, "")373 c.client2.expectEQ(resp.Type, dashapi.JobBisectFix)374 done = &dashapi.JobDoneReq{375 Build: dashapi.Build{376 ID: "build1",377 },378 ID: resp.ID,379 CrashLog: []byte("this is a crashlog"),380 CrashReport: []byte("this is a crashreport"),381 }382 c.client2.expectOK(c.client2.JobDone(done))383 // Advance time by 30 days. No notification emails384 {385 c.advanceTime(30 * 24 * time.Hour)386 }387 // Ensure that we get a JobBisectFix retry388 resp = c.client2.pollJobs(build.Manager)389 c.client2.expectNE(resp.ID, "")390 c.client2.expectEQ(resp.Type, dashapi.JobBisectFix)391 done = &dashapi.JobDoneReq{392 ID: resp.ID,393 Error: []byte("testBisectFixRetry:JobBisectFix"),394 }395 c.client2.expectOK(c.client2.JobDone(done))396}397// Test that bisection results are not reported for bugs that are already marked as fixed.398func TestNotReportingAlreadyFixed(t *testing.T) {399 c := NewCtx(t)400 defer c.Close()401 // Upload a crash report.402 build := testBuild(1)403 c.client2.UploadBuild(build)404 crash := testCrashWithRepro(build, 1)405 c.client2.ReportCrash(crash)406 c.client2.pollEmailBug()407 // Receive the JobBisectCause.408 resp := c.client2.pollJobs(build.Manager)409 c.client2.expectNE(resp.ID, "")410 c.client2.expectEQ(resp.Type, dashapi.JobBisectCause)411 done := &dashapi.JobDoneReq{412 ID: resp.ID,413 Error: []byte("testBisectFixRetry:JobBisectCause"),414 }415 c.client2.expectOK(c.client2.JobDone(done))416 sender := ""417 // Advance time by 30 days and read out any notification emails.418 {419 c.advanceTime(30 * 24 * time.Hour)420 msg := c.client2.pollEmailBug()421 c.expectEQ(msg.Subject, "title1")422 c.expectTrue(strings.Contains(msg.Body, "Sending this report upstream."))423 msg = c.client2.pollEmailBug()424 c.expectEQ(msg.Subject, "title1")425 c.expectTrue(strings.Contains(msg.Body, "syzbot found the following crash"))426 sender = msg.Sender427 }428 // Poll for a BisectFix job.429 resp = c.client2.pollJobs(build.Manager)430 c.client2.expectNE(resp.ID, "")431 c.client2.expectEQ(resp.Type, dashapi.JobBisectFix)432 // Meanwhile, the bug is marked as fixed separately.433 c.incomingEmail(sender, "#syz fix: kernel: add a fix", EmailOptCC(nil))434 {435 // Email notification of "Your 'fix:' command is accepted, but please keep436 // bugs@syzkaller.com mailing list in CC next time."437 c.client2.pollEmailBug()438 }439 // At this point, send back the results for the BisectFix job also.440 done = &dashapi.JobDoneReq{441 ID: resp.ID,442 Build: *build,443 Log: []byte("bisectfix log 4"),444 CrashTitle: "bisectfix crash title 4",445 CrashLog: []byte("bisectfix crash log 4"),446 CrashReport: []byte("bisectfix crash report 4"),447 Commits: []dashapi.Commit{448 {449 Hash: "46e65cb4a0448942ec316b24d60446bbd5cc7827",450 Title: "kernel: add a fix",451 Author: "author@kernel.org",452 AuthorName: "Author Kernelov",453 CC: []string{454 "reviewer1@kernel.org", "\"Reviewer2\" <reviewer2@kernel.org>",455 // These must be filtered out:456 "syzbot@testapp.appspotmail.com",457 "syzbot+1234@testapp.appspotmail.com",458 "\"syzbot\" <syzbot+1234@testapp.appspotmail.com>",459 },460 Date: time.Date(2000, 2, 9, 4, 5, 6, 7, time.UTC),461 },462 },463 }464 c.expectOK(c.client2.JobDone(done))465 // No reporting should come in at this point. If there is reporting, c.Close()466 // will fail.467}468// Test that fix bisections are listed on the bug page if the bug.BisectFix469// is not BisectYes.470func TestFixBisectionsListed(t *testing.T) {471 c := NewCtx(t)472 defer c.Close()473 // Upload a crash report474 build := testBuild(1)475 c.client2.UploadBuild(build)476 crash := testCrashWithRepro(build, 1)477 c.client2.ReportCrash(crash)478 c.client2.pollEmailBug()479 // Receive the JobBisectCause.480 resp := c.client2.pollJobs(build.Manager)481 c.client2.expectNE(resp.ID, "")482 c.client2.expectEQ(resp.Type, dashapi.JobBisectCause)483 done := &dashapi.JobDoneReq{484 ID: resp.ID,485 Error: []byte("testBisectFixRetry:JobBisectCause"),486 }487 c.client2.expectOK(c.client2.JobDone(done))488 // At this point, no fix bisections should be listed out.489 var bugs []*Bug490 keys, err := db.NewQuery("Bug").GetAll(c.ctx, &bugs)491 c.expectEQ(err, nil)492 c.expectEQ(len(bugs), 1)493 url := fmt.Sprintf("/bug?id=%v", keys[0].StringID())494 content, err := c.httpRequest("GET", url, "", AccessAdmin)495 c.expectEQ(err, nil)496 c.expectTrue(!bytes.Contains(content, []byte("All fix bisections")))497 // Advance time by 30 days and read out any notification emails.498 {499 c.advanceTime(30 * 24 * time.Hour)500 msg := c.client2.pollEmailBug()501 c.expectEQ(msg.Subject, "title1")502 c.expectTrue(strings.Contains(msg.Body, "Sending this report upstream."))503 msg = c.client2.pollEmailBug()504 c.expectEQ(msg.Subject, "title1")505 c.expectTrue(strings.Contains(msg.Body, "syzbot found the following crash"))506 }507 // Ensure that we get a JobBisectFix. We send back a crashlog, no error,508 // no commits.509 resp = c.client2.pollJobs(build.Manager)510 c.client2.expectNE(resp.ID, "")511 c.client2.expectEQ(resp.Type, dashapi.JobBisectFix)512 done = &dashapi.JobDoneReq{513 Build: dashapi.Build{514 ID: "build1",515 },516 ID: resp.ID,517 CrashTitle: "this is a crashtitle",518 CrashLog: []byte("this is a crashlog"),519 CrashReport: []byte("this is a crashreport"),520 Log: []byte("this is a log"),521 }522 c.client2.expectOK(c.client2.JobDone(done))523 // Check the bug page and ensure that a bisection is listed out.524 content, err = c.httpRequest("GET", url, "", AccessAdmin)525 c.expectEQ(err, nil)526 c.expectTrue(bytes.Contains(content, []byte("Fix bisection attempts")))527 // Advance time by 30 days. No notification emails.528 {529 c.advanceTime(30 * 24 * time.Hour)530 }531 // Ensure that we get a JobBisectFix retry.532 resp = c.client2.pollJobs(build.Manager)533 c.client2.expectNE(resp.ID, "")534 c.client2.expectEQ(resp.Type, dashapi.JobBisectFix)535 done = &dashapi.JobDoneReq{536 ID: resp.ID,537 Error: []byte("testBisectFixRetry:JobBisectFix"),538 }539 c.client2.expectOK(c.client2.JobDone(done))540 // Check the bug page and ensure that no bisections are listed out.541 content, err = c.httpRequest("GET", url, "", AccessAdmin)542 c.expectEQ(err, nil)543 c.expectTrue(!bytes.Contains(content, []byte("All fix bisections")))544}545// Test that fix bisections do not occur if Repo has NoFixBisections set.546func TestFixBisectionsDisabled(t *testing.T) {547 c := NewCtx(t)548 defer c.Close()549 // Upload a crash report550 build := testBuild(1)551 build.Manager = "no-fix-bisection-manager"552 c.client2.UploadBuild(build)553 crash := testCrashWithRepro(build, 20)554 c.client2.ReportCrash(crash)555 c.client2.pollEmailBug()556 // Receive the JobBisectCause.557 resp := c.client2.pollJobs(build.Manager)558 c.client2.expectNE(resp.ID, "")559 c.client2.expectEQ(resp.Type, dashapi.JobBisectCause)560 done := &dashapi.JobDoneReq{561 ID: resp.ID,562 Error: []byte("testBisectFixRetry:JobBisectCause"),563 }564 c.client2.expectOK(c.client2.JobDone(done))565 // Advance time by 30 days and read out any notification emails.566 {567 c.advanceTime(30 * 24 * time.Hour)568 msg := c.client2.pollEmailBug()569 c.expectEQ(msg.Subject, "title20")570 c.expectTrue(strings.Contains(msg.Body, "Sending this report upstream."))571 msg = c.client2.pollEmailBug()572 c.expectEQ(msg.Subject, "title20")...

Full Screen

Full Screen

reporting_test.go

Source:reporting_test.go Github

copy

Full Screen

...26 // Must get a proper report for "test" type.27 resp, _ = c.client.ReportingPollBugs("test")28 c.expectEQ(len(resp.Reports), 1)29 rep := resp.Reports[0]30 c.expectNE(rep.ID, "")31 _, dbCrash, dbBuild := c.loadBug(rep.ID)32 want := &dashapi.BugReport{33 Type: dashapi.ReportNew,34 Namespace: "test1",35 Config: []byte(`{"Index":1}`),36 ID: rep.ID,37 OS: "linux",38 Arch: "amd64",39 VMArch: "amd64",40 First: true,41 Moderation: true,42 Title: "title1",43 Link: fmt.Sprintf("https://testapp.appspot.com/bug?extid=%v", rep.ID),44 CreditEmail: fmt.Sprintf("syzbot+%v@testapp.appspotmail.com", rep.ID),45 Maintainers: []string{"bar@foo.com", "foo@bar.com"},46 CompilerID: "compiler1",47 KernelRepo: "repo1",48 KernelRepoAlias: "repo1 branch1",49 KernelBranch: "branch1",50 KernelCommit: "1111111111111111111111111111111111111111",51 KernelCommitTitle: build.KernelCommitTitle,52 KernelCommitDate: buildCommitDate,53 KernelConfig: []byte("config1"),54 KernelConfigLink: externalLink(c.ctx, textKernelConfig, dbBuild.KernelConfig),55 Log: []byte("log1"),56 LogLink: externalLink(c.ctx, textCrashLog, dbCrash.Log),57 Report: []byte("report1"),58 ReportLink: externalLink(c.ctx, textCrashReport, dbCrash.Report),59 CrashID: rep.CrashID,60 NumCrashes: 1,61 HappenedOn: []string{"repo1 branch1"},62 }63 c.expectEQ(want, rep)64 // Since we did not update bug status yet, should get the same report again.65 c.expectEQ(c.client.pollBug(), want)66 // Now add syz repro and check that we get another bug report.67 crash1.ReproOpts = []byte("some opts")68 crash1.ReproSyz = []byte("getpid()")69 want.Type = dashapi.ReportRepro70 want.First = false71 want.ReproSyz = []byte(syzReproPrefix + "#some opts\ngetpid()")72 c.client.ReportCrash(crash1)73 rep1 := c.client.pollBug()74 c.expectNE(want.CrashID, rep1.CrashID)75 _, dbCrash, _ = c.loadBug(rep.ID)76 want.CrashID = rep1.CrashID77 want.NumCrashes = 278 want.ReproSyzLink = externalLink(c.ctx, textReproSyz, dbCrash.ReproSyz)79 want.LogLink = externalLink(c.ctx, textCrashLog, dbCrash.Log)80 want.ReportLink = externalLink(c.ctx, textCrashReport, dbCrash.Report)81 c.expectEQ(want, rep1)82 reply, _ := c.client.ReportingUpdate(&dashapi.BugUpdate{83 ID: rep.ID,84 Status: dashapi.BugStatusOpen,85 ReproLevel: dashapi.ReproLevelSyz,86 })87 c.expectEQ(reply.OK, true)88 // After bug update should not get the report again.89 c.client.pollBugs(0)90 // Now close the bug in the first reporting.91 c.client.updateBug(rep.ID, dashapi.BugStatusUpstream, "")92 // Check that bug updates for the first reporting fail now.93 reply, _ = c.client.ReportingUpdate(&dashapi.BugUpdate{ID: rep.ID, Status: dashapi.BugStatusOpen})94 c.expectEQ(reply.OK, false)95 // Report another crash with syz repro for this bug,96 // ensure that we report the new crash in the next reporting.97 crash1.Report = []byte("report2")98 c.client.ReportCrash(crash1)99 // Check that we get the report in the second reporting.100 rep2 := c.client.pollBug()101 c.expectNE(rep2.ID, "")102 c.expectNE(rep2.ID, rep.ID)103 want.Type = dashapi.ReportNew104 want.ID = rep2.ID105 want.Report = []byte("report2")106 want.LogLink = rep2.LogLink107 want.ReportLink = rep2.ReportLink108 want.CrashID = rep2.CrashID109 want.ReproSyzLink = rep2.ReproSyzLink110 want.Link = fmt.Sprintf("https://testapp.appspot.com/bug?extid=%v", rep2.ID)111 want.CreditEmail = fmt.Sprintf("syzbot+%v@testapp.appspotmail.com", rep2.ID)112 want.First = true113 want.Moderation = false114 want.Config = []byte(`{"Index":2}`)115 want.NumCrashes = 3116 c.expectEQ(want, rep2)117 // Check that that we can't upstream the bug in the final reporting.118 reply, _ = c.client.ReportingUpdate(&dashapi.BugUpdate{119 ID: rep2.ID,120 Status: dashapi.BugStatusUpstream,121 })122 c.expectEQ(reply.OK, false)123}124func TestInvalidBug(t *testing.T) {125 c := NewCtx(t)126 defer c.Close()127 build := testBuild(1)128 c.client.UploadBuild(build)129 crash1 := testCrashWithRepro(build, 1)130 c.client.ReportCrash(crash1)131 rep := c.client.pollBug()132 c.expectEQ(rep.Title, "title1")133 reply, _ := c.client.ReportingUpdate(&dashapi.BugUpdate{134 ID: rep.ID,135 Status: dashapi.BugStatusOpen,136 ReproLevel: dashapi.ReproLevelC,137 })138 c.expectEQ(reply.OK, true)139 {140 closed, _ := c.client.ReportingPollClosed([]string{rep.ID, "foobar"})141 c.expectEQ(len(closed), 0)142 }143 // Mark the bug as invalid.144 c.client.updateBug(rep.ID, dashapi.BugStatusInvalid, "")145 {146 closed, _ := c.client.ReportingPollClosed([]string{rep.ID, "foobar"})147 c.expectEQ(len(closed), 1)148 c.expectEQ(closed[0], rep.ID)149 }150 // Now it should not be reported in either reporting.151 c.client.pollBugs(0)152 // Now a similar crash happens again.153 crash2 := &dashapi.Crash{154 BuildID: "build1",155 Title: "title1",156 Log: []byte("log2"),157 Report: []byte("report2"),158 ReproC: []byte("int main() { return 1; }"),159 }160 c.client.ReportCrash(crash2)161 // Now it should be reported again.162 rep = c.client.pollBug()163 c.expectNE(rep.ID, "")164 _, dbCrash, dbBuild := c.loadBug(rep.ID)165 want := &dashapi.BugReport{166 Type: dashapi.ReportNew,167 Namespace: "test1",168 Config: []byte(`{"Index":1}`),169 ID: rep.ID,170 OS: "linux",171 Arch: "amd64",172 VMArch: "amd64",173 First: true,174 Moderation: true,175 Title: "title1 (2)",176 Link: fmt.Sprintf("https://testapp.appspot.com/bug?extid=%v", rep.ID),177 CreditEmail: fmt.Sprintf("syzbot+%v@testapp.appspotmail.com", rep.ID),...

Full Screen

Full Screen

expectNE

Using AI Code Generation

copy

Full Screen

1import "fmt"2func main() {3 fmt.Printf("value of c is %d4 fmt.Printf("value of c is %d5 fmt.Printf("value of c is %d6 fmt.Printf("value of c is %d7 fmt.Printf("value of c is %d8 fmt.Printf("value of a is %d9 fmt.Printf("value of a is %d10}11import "fmt"12func main() {13 fmt.Printf("Line 1 - Value of c is %d14 fmt.Printf("Line 2 - Value of c is %d15 fmt.Printf("Line 3 - Value of c is %d16 fmt.Printf("Line 4 - Value of c is %d17 fmt.Printf("Line 5 - Value of c is %d18 fmt.Printf("Line 6 - Value of a is %d19 fmt.Printf("Line 7 - Value of a is %d20}21import "fmt"22func main() {23 fmt.Printf("第 1 行 - a 变量类型为 = %T24 fmt.Printf("第 2 行 - b

Full Screen

Full Screen

expectNE

Using AI Code Generation

copy

Full Screen

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

Full Screen

Full Screen

expectNE

Using AI Code Generation

copy

Full Screen

1import "testing"2func TestExpectNE(t *testing.T) {3 if a == b {4 t.Errorf("a is not equal to b")5 }6}7import "testing"8func TestExpectNE(t *testing.T) {9 if a != b {10 t.Errorf("a is not equal to b")11 }12}13import "testing"14func TestExpectNE(t *testing.T) {15 if a != b {16 t.Errorf("a is not equal to b")17 }18}19import "testing"20func TestExpectNE(t *testing.T) {21 if a == b {22 t.Errorf("a is not equal to b")23 }24}25import "testing"26func TestExpectNE(t *testing.T) {27 if a != b {28 t.Errorf("a is not equal to b")29 }30}31import "testing"32func TestExpectNE(t *testing.T) {33 if a != b {34 t.Errorf("a is not equal to b")35 }36}

Full Screen

Full Screen

expectNE

Using AI Code Generation

copy

Full Screen

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

Full Screen

Full Screen

expectNE

Using AI Code Generation

copy

Full Screen

1func main() {2 expectNE("Hello", "World")3 expectNE("Hello", "Hello")4}5func main() {6 expectNE("Hello", "World")7 expectNE("Hello", "Hello")8}9func main() {10 expectNE("Hello", "World")11 expectNE("Hello", "Hello")12}13func main() {14 expectNE("Hello", "World")15 expectNE("Hello", "Hello")16}17func main() {18 expectNE("Hello", "World")19 expectNE("Hello", "Hello")20}21func main() {22 expectNE("Hello", "World")23 expectNE("Hello", "Hello")24}25func main() {26 expectNE("Hello", "World")27 expectNE("Hello", "Hello")28}29func main() {30 expectNE("Hello", "World")31 expectNE("Hello", "Hello")32}33func main() {34 expectNE("Hello", "World")35 expectNE("Hello", "Hello")36}37func main() {38 expectNE("Hello", "World")39 expectNE("Hello",

Full Screen

Full Screen

expectNE

Using AI Code Generation

copy

Full Screen

1import "fmt"2func main() {3 fmt.Println("Testing 1 != 2")4 main.expectNE(1, 2)5 fmt.Println("Testing 1 != 1")6 main.expectNE(1, 1)7}8import "testing"9func TestMain(t *testing.T) {10 t.Log("Testing 1 != 2")11 main.expectNE(1, 2)12 t.Log("Testing 1 != 1")13 main.expectNE(1, 1)14}15import "fmt"16func main() {17 fmt.Println("Testing 1 != 2")18 main.expectNE(1, 2)19 fmt.Println("Testing 1 != 1")20 main.expectNE(1, 1)21}22import "testing"23func TestMain(t *testing.T) {24 t.Log("Testing 1 != 2")25 main.expectNE(1, 2)26 t.Log("Testing 1 != 1")27 main.expectNE(1, 1)28}29import "fmt"30func main() {31 fmt.Println("Testing 1 != 2")32 main.expectNE(1, 2)33 fmt.Println("Testing 1 != 1")34 main.expectNE(1, 1)35}

Full Screen

Full Screen

expectNE

Using AI Code Generation

copy

Full Screen

1import (2func TestExpectNE(t *testing.T) {3 main.expectNE(t, 2, 2, "2 should not be equal to 2")4}5import (6func TestExpectNE(t *testing.T) {7 main.expectNE(t, 2, 3, "2 should not be equal to 3")8}

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.

Run Syzkaller automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Most used method in

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful