1#!/usr/bin/env python 2 3""" 4This file generates all video_VDAStress control files from a master list. 5""" 6 7import collections 8 9Testdata = collections.namedtuple('Testdata', 'gs, decoder, access') 10 11TESTS = [ 12 Testdata('gs://chromeos-test-assets-private/VDA/', 'h264', 'private'), 13 Testdata('gs://chromeos-test-assets-private/VDA/', 'vp8', 'private'), 14 # TODO(ihf): Populate public bucket with test videos. 15 #Testdata('gs://chromiumos-test-assets-public/VDA/', 'h264', 'public'), 16 #Testdata('gs://chromiumos-test-assets-public/VDA/', 'vp8', 'public'), 17 #Testdata('gs://chromiumos-test-assets-public/VDA/', 'vp9', 'public'), 18] 19 20CONTROLFILE_TEMPLATE = ( 21"""# Copyright 2013 The Chromium OS Authors. All rights reserved. 22# Use of this source code is governed by a BSD-style license that can be 23# found in the LICENSE file. 24 25AUTHOR = 'Chrome OS Team, chromeos-video@google.com' 26NAME = 'video_VDAStress.{1}.{2}.{3}' 27ATTRIBUTES = 'suite:video' 28SUITE = 'video' 29TIME = 'LENGTHY' 30TEST_CATEGORY = 'Stress' 31TEST_CLASS = 'video' 32TEST_TYPE = 'server' 33DEPENDENCIES = 'hw_video_acc_{1}' 34 35DOC = \"\"\" 36VDA stress test to download and run with {1} test videos from cloud storage. 37\"\"\" 38 39import shutil 40import tempfile 41 42# Download the test videos from the gs bucket to the server. 43server_videos_dir = tempfile.mkdtemp(dir=job.tmpdir) 44videos = [] 45job.run_test( 46 'video_VDAStressSetup', 47 gs_bucket='{0}{1}/', 48 server_videos_dir=server_videos_dir, 49 videos=videos, 50 shard_number={3}, 51 shard_count={4}) 52 53 54def run(machine): 55 job.run_test('video_VDAStress', 56 machine=machine, 57 server_videos_dir=server_videos_dir, 58 videos=videos) 59 60 61job.parallel_on_machines(run, machines) 62shutil.rmtree(server_videos_dir)""") 63 64 65shard_count = 10 66for test in TESTS: 67 for shard_number in xrange(0, shard_count): 68 filename = 'control.%s.%s.%d' % (test.decoder, test.access, shard_number) 69 with open(filename, 'w+') as f: 70 content = ( 71 CONTROLFILE_TEMPLATE.format( 72 test.gs, test.decoder, test.access, 73 shard_number, shard_count)) 74 f.write(content) 75