22startDir = os.path.dirname(os.path.abspath(__file__))
26with tempfile.NamedTemporaryFile(suffix=
'primary.zip', delete=
False, mode=
'w')
as pathToZip:
27 with zipfile.ZipFile(pathToZip.name,
'w', zipfile.ZIP_DEFLATED)
as archive:
29 for root, dirs, files
in os.walk(startDir):
32 if (
not file.startswith(
'.')
33 and not file.endswith(
'.py')
34 and not file.endswith(
'.test')
35 and not file.endswith(
'.txt')):
37 pathInZip =
'%d_%s' % (fileNum, file)
39 with open(
'%s/%s' % (root, file),
'rb')
as skslFile:
41 inputSkSL = skslFile.read()
43 archive.writestr(pathInZip, inputSkSL)
47 output = subprocess.check_output(
48 [
'gsutil',
'cp', pathToZip.name,
49 'gs://skia-fuzzer/oss-fuzz/sksl_seed_corpus.zip'],
50 stderr=subprocess.STDOUT)
53 output = subprocess.check_output(
54 [
'gsutil',
'acl',
'ch',
'-u',
'AllUsers:R',
55 'gs://skia-fuzzer/oss-fuzz/sksl_seed_corpus.zip'],
56 stderr=subprocess.STDOUT)
58 except subprocess.CalledProcessError
as err:
60 print(
"### Unable to upload fuzzer corpus to Google Cloud:")
61 print(
" " +
"\n ".
join(err.output.splitlines()))
62 print(
"\nPlease read the notes at the top of update_fuzzer.py for next steps.\n")
63 sys.exit(err.returncode)
def print(*args, **kwargs)
static SkString join(const CommandLineFlags::StringArray &)