6"""Tool to automatically update the DartFuzzStats spreadsheet
8Requires a one-time authentication step with a @google account.
10from __future__
import print_function
14from googleapiclient.discovery
import build
15from google_auth_oauthlib.flow
import InstalledAppFlow
16from google.auth.transport.requests
import Request
22SCOPES = [
'https://www.googleapis.com/auth/spreadsheets']
25SPREADSHEET_ID =
'1nDoK-dCuEmf6yo55a303UClRd7AwjbzPkRr37ijWcC8'
26RANGE_NAME =
'Sheet1!A3:H'
28VERIFY_CURRENT_ROW_FORMULA =
'=B:B-C:C-D:D-E:E-F:F'
32 dir_path = os.path.dirname(os.path.realpath(__file__))
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)
42 if not creds
or not creds.valid:
43 if creds
and creds.expired
and creds.refresh_token:
44 creds.refresh(Request())
46 flow = InstalledAppFlow.from_client_secrets_file(
47 os.path.join(dir_path,
'credentials.json'), SCOPES)
48 creds = flow.run_local_server(port=0)
50 with open(pickle_path,
'wb')
as token:
51 pickle.dump(creds, token)
52 return build(
'sheets',
'v4', credentials=creds)
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
68 entry = [run, tests, success, skipped, timeout, divergences, rerun]
70 'Adding entry for run %d. Tests: %d Successes: %d Skipped: %d Timeouts: %d, Divergences: %d Re-runs: %d'
73 values = {
'values': [entry + [VERIFY_CURRENT_ROW_FORMULA]]}
75 spreadsheetId=SPREADSHEET_ID,
78 valueInputOption=
'USER_ENTERED').
execute()
93 dir_path = os.path.dirname(os.path.realpath(__file__))
94 output = subprocess.check_output([
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
99 return list(
map(int, output.decode(
'UTF-8').rstrip().split(
',')))
105 sheet = service.spreadsheets()
114 print(
'No more runs to process. Exiting.')
118if __name__ ==
'__main__':
static void append(char **dst, size_t *count, const char *src, size_t n)
const myers::Point & get(const myers::Segment &)
def print(*args, **kwargs)
SI auto map(std::index_sequence< I... >, Fn &&fn, const Args &... args) -> skvx::Vec< sizeof...(I), decltype(fn(args[0]...))>
def add_new_fuzzing_entry(sheet, run, tests, success, rerun, skipped, timeout, divergences)
def get_run_statistic_summary(run)
def get_next_run_id(sheet)