Flutter Engine
The Flutter Engine
Functions | Variables
update_spreadsheet Namespace Reference

Functions

def authenticate ()
 
def get_next_run_id (sheet)
 
def add_new_fuzzing_entry (sheet, run, tests, success, rerun, skipped, timeout, divergences)
 
def get_run_statistic_summary (run)
 
def main ()
 

Variables

list SCOPES = ['https://www.googleapis.com/auth/spreadsheets']
 
string SPREADSHEET_ID = '1nDoK-dCuEmf6yo55a303UClRd7AwjbzPkRr37ijWcC8'
 
string RANGE_NAME = 'Sheet1!A3:H'
 
string VERIFY_CURRENT_ROW_FORMULA = '=B:B-C:C-D:D-E:E-F:F'
 

Function Documentation

◆ add_new_fuzzing_entry()

def update_spreadsheet.add_new_fuzzing_entry (   sheet,
  run,
  tests,
  success,
  rerun,
  skipped,
  timeout,
  divergences 
)

Definition at line 65 of file update_spreadsheet.py.

66 divergences):
67
68 entry = [run, tests, success, skipped, timeout, divergences, rerun]
69 print(
70 'Adding entry for run %d. Tests: %d Successes: %d Skipped: %d Timeouts: %d, Divergences: %d Re-runs: %d'
71 % tuple(entry))
72
73 values = {'values': [entry + [VERIFY_CURRENT_ROW_FORMULA]]}
74 sheet.values().append(
75 spreadsheetId=SPREADSHEET_ID,
76 range=RANGE_NAME,
77 body=values,
78 valueInputOption='USER_ENTERED').execute()
79
80
81# Scrapes the fuzzing shards for fuzzing run statistics.
82#
83# Returns a list of statistics in the following order:
84#
85# - # of tests
86# - # of successes
87# - # of re-runs
88# - # of skipped runs
89# - # of timeouts
90# - # of divergences
91#
static void append(char **dst, size_t *count, const char *src, size_t n)
Definition: editor.cpp:211
def execute(*command)
Definition: buildapp.py:25
def print(*args, **kwargs)
Definition: run_tests.py:49

◆ authenticate()

def update_spreadsheet.authenticate ( )

Definition at line 31 of file update_spreadsheet.py.

31def authenticate():
32 dir_path = os.path.dirname(os.path.realpath(__file__))
33 creds = None
34 # The file token.pickle stores the user's access and refresh tokens, and is
35 # created automatically when the authorization flow completes for the first
36 # time.
37 pickle_path = os.path.join(dir_path, 'token.pickle')
38 if os.path.exists(pickle_path):
39 with open(pickle_path, 'rb') as token:
40 creds = pickle.load(token)
41 # If there are no (valid) credentials available, let the user log in.
42 if not creds or not creds.valid:
43 if creds and creds.expired and creds.refresh_token:
44 creds.refresh(Request())
45 else:
46 flow = InstalledAppFlow.from_client_secrets_file(
47 os.path.join(dir_path, 'credentials.json'), SCOPES)
48 creds = flow.run_local_server(port=0)
49 # Save the credentials for the next run
50 with open(pickle_path, 'wb') as token:
51 pickle.dump(creds, token)
52 return build('sheets', 'v4', credentials=creds)
53
54
55# Returns the next run ID based on the last run ID found in the fuzzing
56# spreadsheet.
Definition: build.py:1

◆ get_next_run_id()

def update_spreadsheet.get_next_run_id (   sheet)

Definition at line 57 of file update_spreadsheet.py.

57def get_next_run_id(sheet):
58 result = sheet.values().get(
59 spreadsheetId=SPREADSHEET_ID, range=RANGE_NAME).execute()
60 values = result.get('values', [])
61 return int(values[-1][0]) + 1
62
63
64# Inserts a new entry into the fuzzing spreadsheet.
const myers::Point & get(const myers::Segment &)

◆ get_run_statistic_summary()

def update_spreadsheet.get_run_statistic_summary (   run)

Definition at line 92 of file update_spreadsheet.py.

93 dir_path = os.path.dirname(os.path.realpath(__file__))
94 output = subprocess.check_output([
95 'python3',
96 os.path.join(dir_path, 'collect_data.py'), '--output-csv', '--type=sum',
97 'https://ci.chromium.org/p/dart/builders/ci.sandbox/fuzz-linux/%d' % run
98 ])
99 return list(map(int, output.decode('UTF-8').rstrip().split(',')))
100
101
SI auto map(std::index_sequence< I... >, Fn &&fn, const Args &... args) -> skvx::Vec< sizeof...(I), decltype(fn(args[0]...))>
Definition: SkVx.h:680
def get_run_statistic_summary(run)

◆ main()

def update_spreadsheet.main ( )

Definition at line 102 of file update_spreadsheet.py.

102def main():
103 service = authenticate()
104 # Call the Sheets API
105 sheet = service.spreadsheets()
106 while True:
107 try:
108 next_id = get_next_run_id(sheet)
109 summary = get_run_statistic_summary(next_id)
110 add_new_fuzzing_entry(sheet, next_id, *summary)
111 except:
112 # get_run_statistic_summary exits with non-zero exit code if we're out
113 # of runs to check.
114 print('No more runs to process. Exiting.')
115 break
116
117
def add_new_fuzzing_entry(sheet, run, tests, success, rerun, skipped, timeout, divergences)

Variable Documentation

◆ RANGE_NAME

string update_spreadsheet.RANGE_NAME = 'Sheet1!A3:H'

Definition at line 26 of file update_spreadsheet.py.

◆ SCOPES

list update_spreadsheet.SCOPES = ['https://www.googleapis.com/auth/spreadsheets']

Definition at line 22 of file update_spreadsheet.py.

◆ SPREADSHEET_ID

string update_spreadsheet.SPREADSHEET_ID = '1nDoK-dCuEmf6yo55a303UClRd7AwjbzPkRr37ijWcC8'

Definition at line 25 of file update_spreadsheet.py.

◆ VERIFY_CURRENT_ROW_FORMULA

string update_spreadsheet.VERIFY_CURRENT_ROW_FORMULA = '=B:B-C:C-D:D-E:E-F:F'

Definition at line 28 of file update_spreadsheet.py.