Skip to content

Commit

Permalink
Adapt vulkan worker wrapper to new worker (#88)
Browse files Browse the repository at this point in the history
  • Loading branch information
hevrard authored Oct 29, 2018
1 parent 622e2b8 commit 6143a88
Showing 1 changed file with 34 additions and 13 deletions.
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

0 comments on commit 6143a88

Please sign in to comment.