Remove support for sksl_with_256_padding_seed_corpus.

The SkRuntimeEffect fuzzer no longer uses the final 256 bytes of each
shader as uniform data, making this corpus obsolete.

(Fuzzer corpus change: https://github.com/google/oss-fuzz/pull/7266 )

Change-Id: I3df9213520390249f401c83c13f0bca5c7f0dde4
Bug: skia:12781
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/508036
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
This commit is contained in:
John Stiles 2022-02-11 17:13:04 -05:00 committed by Kevin Lubick
parent 14a623c869
commit 795024fa46

View File

@ -23,53 +23,38 @@ startDir = os.path.dirname(os.path.abspath(__file__))
fileNum = 1
# Prepare two scratch zip files, one for the input data as-is and another with 256-byte padding.
with tempfile.NamedTemporaryFile(suffix='primary.zip', delete=False, mode='w') as pathToPrimaryZip:
with tempfile.NamedTemporaryFile(suffix='pad.zip', delete=False, mode='w') as pathToPaddedZip:
with zipfile.ZipFile(pathToPrimaryZip.name, 'w', zipfile.ZIP_DEFLATED) as primaryArchive:
with zipfile.ZipFile(pathToPaddedZip.name, 'w', zipfile.ZIP_DEFLATED) as paddedArchive:
# Iterate over every file in this directory and use it to assemble our corpus.
for root, dirs, files in os.walk(startDir):
for file in files:
# Exclude files that won't be useful fuzzer inputs.
if (not file.startswith('.') # Hidden
and not file.endswith('.py') # Python
and not file.endswith('.test') # ES2 conformance script
and not file.endswith('.txt')): # Text
# Prepend a number to each output filename to guarantee uniqueness.
pathInZip = '%d_%s' % (fileNum, file)
fileNum += 1
with open('%s/%s' % (root, file), 'r') as skslFile:
# Read the SkSL text as input.
inputSkSL = skslFile.read()
# In the primary archive, write the input SkSL as-is.
primaryArchive.writestr(pathInZip, inputSkSL)
# In the padded archive, write the input SkSL with 256 bonus bytes.
paddedSkSL = inputSkSL + ("/" * 256)
paddedArchive.writestr(pathInZip, paddedSkSL)
with tempfile.NamedTemporaryFile(suffix='primary.zip', delete=False, mode='w') as pathToZip:
with zipfile.ZipFile(pathToZip.name, 'w', zipfile.ZIP_DEFLATED) as archive:
# Iterate over every file in this directory and use it to assemble our corpus.
for root, dirs, files in os.walk(startDir):
for file in files:
# Exclude files that won't be useful fuzzer inputs.
if (not file.startswith('.') # Hidden
and not file.endswith('.py') # Python
and not file.endswith('.test') # ES2 conformance script
and not file.endswith('.txt')): # Text
# Prepend a number to each output filename to guarantee uniqueness.
pathInZip = '%d_%s' % (fileNum, file)
fileNum += 1
with open('%s/%s' % (root, file), 'r') as skslFile:
# Read the SkSL text as input.
inputSkSL = skslFile.read()
# Copy the SkSL into our zip archive.
archive.writestr(pathInZip, inputSkSL)
try:
# Upload both zip files to cloud storage.
# Upload our zip file to cloud storage.
output = subprocess.check_output(
['gsutil', 'cp', pathToPrimaryZip.name,
['gsutil', 'cp', pathToZip.name,
'gs://skia-fuzzer/oss-fuzz/sksl_seed_corpus.zip'],
stderr=subprocess.STDOUT)
output = subprocess.check_output(
['gsutil', 'cp', pathToPaddedZip.name,
'gs://skia-fuzzer/oss-fuzz/sksl_with_256_padding_seed_corpus.zip'],
stderr=subprocess.STDOUT)
# Make the uploaded files world-readable.
# Make the uploaded file world-readable.
output = subprocess.check_output(
['gsutil', 'acl', 'ch', '-u', 'AllUsers:R',
'gs://skia-fuzzer/oss-fuzz/sksl_seed_corpus.zip'],
stderr=subprocess.STDOUT)
output = subprocess.check_output(
['gsutil', 'acl', 'ch', '-u', 'AllUsers:R',
'gs://skia-fuzzer/oss-fuzz/sksl_with_256_padding_seed_corpus.zip'],
stderr=subprocess.STDOUT)
except subprocess.CalledProcessError as err:
# Report the error.
print("### Unable to upload fuzzer corpus to Google Cloud:")