How to use lastReportedReporting method of main Package

Best Syzkaller code snippet using main.lastReportedReporting

reporting.go

Source:reporting.go Github

copy

Full Screen

...644 dup, dupKey, err = findDupByTitle(c, bug.Namespace, cmd.DupOf)645 if err != nil {646 return "", false, "can't find the dup bug", err647 }648 dupReporting := lastReportedReporting(dup)649 if dupReporting == nil {650 return "", false, "can't find the dup bug",651 fmt.Errorf("dup does not have reporting %q", bugReporting.Name)652 }653 cmd.DupOf = dupReporting.ID654 }655 dupReporting, _ := bugReportingByID(dup, cmd.DupOf)656 if bugReporting == nil || dupReporting == nil {657 return "", false, internalError, fmt.Errorf("can't find bug reporting")658 }659 if bugKey.StringID() == dupKey.StringID() {660 if bugReporting.Name == dupReporting.Name {661 return "", false, "Can't dup bug to itself.", nil662 }663 return "", false, fmt.Sprintf("Can't dup bug to itself in different reporting (%v->%v).\n"+664 "Please dup syzbot bugs only onto syzbot bugs for the same kernel/reporting.",665 bugReporting.Name, dupReporting.Name), nil666 }667 if bug.Namespace != dup.Namespace {668 return "", false, fmt.Sprintf("Duplicate bug corresponds to a different kernel (%v->%v).\n"+669 "Please dup syzbot bugs only onto syzbot bugs for the same kernel.",670 bug.Namespace, dup.Namespace), nil671 }672 if !allowCrossReportingDup(c, bug, dup, bugReporting, dupReporting) {673 return "", false, fmt.Sprintf("Can't dup bug to a bug in different reporting (%v->%v)."+674 "Please dup syzbot bugs only onto syzbot bugs for the same kernel/reporting.",675 bugReporting.Name, dupReporting.Name), nil676 }677 dupCanon, err := canonicalBug(c, dup)678 if err != nil {679 return "", false, internalError, fmt.Errorf("failed to get canonical bug for dup: %v", err)680 }681 if !dupReporting.Closed.IsZero() && dupCanon.Status == BugStatusOpen {682 return "", false, "Dup bug is already upstreamed.", nil683 }684 dupHash := dup.keyHash()685 return dupHash, true, "", nil686}687func allowCrossReportingDup(c context.Context, bug, dup *Bug,688 bugReporting, dupReporting *BugReporting) bool {689 bugIdx := getReportingIdx(c, bug, bugReporting)690 dupIdx := getReportingIdx(c, dup, dupReporting)691 if bugIdx < 0 || dupIdx < 0 {692 return false693 }694 if bugIdx == dupIdx {695 return true696 }697 // We generally allow duping only within the same reporting.698 // But there is one exception: we also allow duping from last but one699 // reporting to the last one (which is stable, final destination)700 // provided that these two reportings have the same access level and type.701 // The rest of the combinations can lead to surprising states and702 // information hiding, so we don't allow them.703 cfg := config.Namespaces[bug.Namespace]704 bugConfig := &cfg.Reporting[bugIdx]705 dupConfig := &cfg.Reporting[dupIdx]706 lastIdx := len(cfg.Reporting) - 1707 return bugIdx == lastIdx-1 && dupIdx == lastIdx &&708 bugConfig.AccessLevel == dupConfig.AccessLevel &&709 bugConfig.Config.Type() == dupConfig.Config.Type()710}711func getReportingIdx(c context.Context, bug *Bug, bugReporting *BugReporting) int {712 for i := range bug.Reporting {713 if bug.Reporting[i].Name == bugReporting.Name {714 return i715 }716 }717 log.Errorf(c, "failed to find bug reporting by name: %q/%q", bug.Title, bugReporting.Name)718 return -1719}720func incomingCommandTx(c context.Context, now time.Time, cmd *dashapi.BugUpdate,721 bugKey *db.Key, dupHash string) (bool, string, error) {722 bug := new(Bug)723 if err := db.Get(c, bugKey, bug); err != nil {724 return false, internalError, fmt.Errorf("can't find the corresponding bug: %v", err)725 }726 bugReporting, final := bugReportingByID(bug, cmd.ID)727 if bugReporting == nil {728 return false, internalError, fmt.Errorf("can't find bug reporting")729 }730 if ok, reply, err := checkBugStatus(c, cmd, bug, bugReporting); !ok {731 return false, reply, err732 }733 state, err := loadReportingState(c)734 if err != nil {735 return false, internalError, err736 }737 stateEnt := state.getEntry(now, bug.Namespace, bugReporting.Name)738 if ok, reply, err := incomingCommandCmd(c, now, cmd, bug, bugReporting, final, dupHash, stateEnt); !ok {739 return false, reply, err740 }741 if len(cmd.FixCommits) != 0 && (bug.Status == BugStatusOpen || bug.Status == BugStatusDup) {742 sort.Strings(cmd.FixCommits)743 if !reflect.DeepEqual(bug.Commits, cmd.FixCommits) {744 bug.updateCommits(cmd.FixCommits, now)745 }746 }747 if cmd.CrashID != 0 {748 // Rememeber that we've reported this crash.749 if err := markCrashReported(c, cmd.CrashID, bugKey, now); err != nil {750 return false, internalError, err751 }752 bugReporting.CrashID = cmd.CrashID753 }754 if bugReporting.ExtID == "" {755 bugReporting.ExtID = cmd.ExtID756 }757 if bugReporting.Link == "" {758 bugReporting.Link = cmd.Link759 }760 if len(cmd.CC) != 0 && cmd.Status != dashapi.BugStatusUnCC {761 merged := email.MergeEmailLists(strings.Split(bugReporting.CC, "|"), cmd.CC)762 bugReporting.CC = strings.Join(merged, "|")763 }764 if bugReporting.ReproLevel < cmd.ReproLevel {765 bugReporting.ReproLevel = cmd.ReproLevel766 }767 if bug.Status != BugStatusDup {768 bug.DupOf = ""769 }770 if cmd.Status != dashapi.BugStatusOpen || !cmd.OnHold {771 bugReporting.OnHold = time.Time{}772 }773 bug.LastActivity = now774 if _, err := db.Put(c, bugKey, bug); err != nil {775 return false, internalError, fmt.Errorf("failed to put bug: %v", err)776 }777 if err := saveReportingState(c, state); err != nil {778 return false, internalError, err779 }780 return true, "", nil781}782func incomingCommandCmd(c context.Context, now time.Time, cmd *dashapi.BugUpdate,783 bug *Bug, bugReporting *BugReporting, final bool, dupHash string,784 stateEnt *ReportingStateEntry) (bool, string, error) {785 switch cmd.Status {786 case dashapi.BugStatusOpen:787 bug.Status = BugStatusOpen788 bug.Closed = time.Time{}789 if bugReporting.Reported.IsZero() {790 bugReporting.Reported = now791 stateEnt.Sent++ // sending repro does not count against the quota792 }793 if bugReporting.OnHold.IsZero() && cmd.OnHold {794 bugReporting.OnHold = now795 }796 // Close all previous reporting if they are not closed yet797 // (can happen due to Status == ReportingDisabled).798 for i := range bug.Reporting {799 if bugReporting == &bug.Reporting[i] {800 break801 }802 if bug.Reporting[i].Closed.IsZero() {803 bug.Reporting[i].Closed = now804 }805 }806 if bug.ReproLevel < cmd.ReproLevel {807 return false, internalError,808 fmt.Errorf("bug update with invalid repro level: %v/%v",809 bug.ReproLevel, cmd.ReproLevel)810 }811 case dashapi.BugStatusUpstream:812 if final {813 return false, "Can't upstream, this is final destination.", nil814 }815 if len(bug.Commits) != 0 {816 // We could handle this case, but how/when it will occur817 // in real life is unclear now.818 return false, "Can't upstream this bug, the bug has fixing commits.", nil819 }820 bug.Status = BugStatusOpen821 bug.Closed = time.Time{}822 bugReporting.Closed = now823 bugReporting.Auto = cmd.Notification824 case dashapi.BugStatusInvalid:825 bug.Closed = now826 bug.Status = BugStatusInvalid827 bugReporting.Closed = now828 bugReporting.Auto = cmd.Notification829 case dashapi.BugStatusDup:830 bug.Status = BugStatusDup831 bug.Closed = now832 bug.DupOf = dupHash833 case dashapi.BugStatusUpdate:834 // Just update Link, Commits, etc below.835 case dashapi.BugStatusUnCC:836 bug.UNCC = email.MergeEmailLists(bug.UNCC, cmd.CC)837 default:838 return false, internalError, fmt.Errorf("unknown bug status %v", cmd.Status)839 }840 return true, "", nil841}842func checkBugStatus(c context.Context, cmd *dashapi.BugUpdate, bug *Bug, bugReporting *BugReporting) (843 bool, string, error) {844 switch bug.Status {845 case BugStatusOpen:846 case BugStatusDup:847 canon, err := canonicalBug(c, bug)848 if err != nil {849 return false, internalError, err850 }851 if canon.Status != BugStatusOpen {852 // We used to reject updates to closed bugs,853 // but this is confusing and non-actionable for users.854 // So now we fail the update, but give empty reason,855 // which means "don't notify user".856 if cmd.Status == dashapi.BugStatusUpdate {857 // This happens when people discuss old bugs.858 log.Infof(c, "Dup bug is already closed")859 } else {860 log.Errorf(c, "Dup bug is already closed")861 }862 return false, "", nil863 }864 case BugStatusFixed, BugStatusInvalid:865 if cmd.Status != dashapi.BugStatusUpdate {866 log.Errorf(c, "This bug is already closed")867 }868 return false, "", nil869 default:870 return false, internalError, fmt.Errorf("unknown bug status %v", bug.Status)871 }872 if !bugReporting.Closed.IsZero() {873 if cmd.Status != dashapi.BugStatusUpdate {874 log.Errorf(c, "This bug reporting is already closed")875 }876 return false, "", nil877 }878 return true, "", nil879}880func findBugByReportingID(c context.Context, id string) (*Bug, *db.Key, error) {881 var bugs []*Bug882 keys, err := db.NewQuery("Bug").883 Filter("Reporting.ID=", id).884 Limit(2).885 GetAll(c, &bugs)886 if err != nil {887 return nil, nil, fmt.Errorf("failed to fetch bugs: %v", err)888 }889 if len(bugs) == 0 {890 return nil, nil, fmt.Errorf("failed to find bug by reporting id %q", id)891 }892 if len(bugs) > 1 {893 return nil, nil, fmt.Errorf("multiple bugs for reporting id %q", id)894 }895 return bugs[0], keys[0], nil896}897func findDupByTitle(c context.Context, ns, title string) (*Bug, *db.Key, error) {898 title, seq, err := splitDisplayTitle(title)899 if err != nil {900 return nil, nil, err901 }902 bugHash := bugKeyHash(ns, title, seq)903 bugKey := db.NewKey(c, "Bug", bugHash, 0, nil)904 bug := new(Bug)905 if err := db.Get(c, bugKey, bug); err != nil {906 return nil, nil, fmt.Errorf("failed to get dup: %v", err)907 }908 return bug, bugKey, nil909}910func bugReportingByID(bug *Bug, id string) (*BugReporting, bool) {911 for i := range bug.Reporting {912 if bug.Reporting[i].ID == id {913 return &bug.Reporting[i], i == len(bug.Reporting)-1914 }915 }916 return nil, false917}918func bugReportingByName(bug *Bug, name string) *BugReporting {919 for i := range bug.Reporting {920 if bug.Reporting[i].Name == name {921 return &bug.Reporting[i]922 }923 }924 return nil925}926func lastReportedReporting(bug *Bug) *BugReporting {927 for i := len(bug.Reporting) - 1; i >= 0; i-- {928 if !bug.Reporting[i].Reported.IsZero() {929 return &bug.Reporting[i]930 }931 }932 return nil933}934func queryCrashesForBug(c context.Context, bugKey *db.Key, limit int) (935 []*Crash, []*db.Key, error) {936 var crashes []*Crash937 keys, err := db.NewQuery("Crash").938 Ancestor(bugKey).939 Order("-ReportLen").940 Order("-Time")....

Full Screen

Full Screen

lastReportedReporting

Using AI Code Generation

copy

Full Screen

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

Full Screen

Full Screen

lastReportedReporting

Using AI Code Generation

copy

Full Screen

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

Full Screen

Full Screen

lastReportedReporting

Using AI Code Generation

copy

Full Screen

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

Full Screen

Full Screen

lastReportedReporting

Using AI Code Generation

copy

Full Screen

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

Full Screen

Full Screen

lastReportedReporting

Using AI Code Generation

copy

Full Screen

1import "fmt"2func main() {3 var t1 = new(Track)4 t1.lastReportedReporting()5}6import "fmt"7func main() {8 var t1 = new(Track)9 t1.lastReportedReporting()10}11import "fmt"12func main() {13 var t1 = new(Track)14 t1.lastReportedReporting()15}16import "fmt"17func main() {18 var t1 = new(Track)19 t1.lastReportedReporting()20}21import "fmt"22func main() {23 var t1 = new(Track)24 t1.lastReportedReporting()25}26import "fmt"27func main() {28 var t1 = new(Track)29 t1.lastReportedReporting()30}31import "fmt"32func main() {33 var t1 = new(Track)34 t1.lastReportedReporting()35}36import "fmt"37func main() {38 var t1 = new(Track)39 t1.lastReportedReporting()40}41import "fmt"42func main() {43 var t1 = new(Track)44 t1.lastReportedReporting()45}

Full Screen

Full Screen

lastReportedReporting

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 mainObj := main{}4 mainObj.lastReportedReporting()5}6import (7type main struct {8}9func (m *main) lastReportedReporting() {10 fmt.Println(m.lastReported)11}

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