Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapt vulkan worker wrapper to new worker #88

Merged
merged 1 commit into from
Oct 29, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 34 additions & 13 deletions python/src/main/python/drivers/worker_vk.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,11 @@ def prepareShaders(frag):

################################################################################

def getImageVulkanAndroid(args, frag):
def getImageVulkanAndroid(args, frag, skipRender):

app = 'vulkan.samples.vulkan_worker'
app = 'com.graphicsfuzz.vkworker'
if args.oldworker:
app = 'vulkan.samples.vulkan_worker'

print('## ' + frag)

Expand Down Expand Up @@ -169,11 +171,14 @@ def getImageVulkanAndroid(args, frag):

adb('push test.vert.spv test.frag.spv test.json /sdcard/graphicsfuzz/')

# Skip render
if skipRender:
adb('shell touch /sdcard/graphicsfuzz/SKIP_RENDER')

# clean all buffers of logcat
adb('logcat -b all -c')

runtestcmd = 'shell am start'
runtestcmd += ' -n ' + app + '/android.app.NativeActivity'
runtestcmd = 'shell am start ' + app + '/android.app.NativeActivity'

print('* Will run: ' + runtestcmd)
adb(runtestcmd)
Expand Down Expand Up @@ -224,15 +229,24 @@ def getImageVulkanAndroid(args, frag):
adb('shell am force-stop ' + app)
return 'timeout'

# Get the image and convert it to PNG
adb('pull /sdcard/graphicsfuzz/image.ppm')
if os.path.exists('image.ppm'):
subprocess.run('convert image.ppm image.png', shell=True)
return 'success'
# Get the image
if args.oldworker:
adb('pull /sdcard/graphicsfuzz/image.ppm')
if os.path.exists('image.ppm'):
subprocess.run('convert image.ppm image.png', shell=True)
return 'success'
else:
with open('log.txt', 'a') as f:
f.write('\nWEIRD ERROR: No crash detected but no image found on device ??\n')
return 'unexpected_error'
else:
with open('log.txt', 'a') as f:
f.write('\nWEIRD ERROR: No crash detected but no image found on device ??\n')
return 'unexpected_error'
adb('pull /sdcard/graphicsfuzz/image.png')
if os.path.exists('image.png'):
return 'success'
else:
with open('log.txt', 'a') as f:
f.write('\nWEIRD ERROR: No crash detected but no image found on device ??\n')
return 'unexpected_error'

################################################################################

Expand All @@ -245,6 +259,8 @@ def doImageJob(args, imageJob):

res = tt.ImageJobResult()

skipRender = imageJob.skipRender

# Set nice defaults to fields we will not update anyway
res.passSanityCheck = True
res.log = 'Start: ' + name + '\n'
Expand All @@ -255,7 +271,7 @@ def doImageJob(args, imageJob):
remove(png)
remove(log)

getimageResult = getImageVulkanAndroid(args, fragFile)
getimageResult = getImageVulkanAndroid(args, fragFile, skipRender)

# Try to get our own log file in any case
if os.path.exists('log.txt'):
Expand Down Expand Up @@ -361,6 +377,11 @@ def get_service(server, args):
'--spirvopt',
help='Enable spirv-opt with these optimisation flags (e.g. --spirvopt=-O)')

parser.add_argument(
'--oldworker',
action='store_true',
help='Use old worker')

args = parser.parse_args()

print('token: ' + args.token)
Expand Down