Home | History | Annotate | Download | only in video_VDAStress
      1 #!/usr/bin/env python
      2 
      3 """
      4 This file generates all video_VDAStress control files from a master list.
      5 """
      6 
      7 import collections
      8 
      9 Testdata = collections.namedtuple('Testdata', 'gs, decoder, access')
     10 
     11 TESTS = [
     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 
     20 CONTROLFILE_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 
     25 AUTHOR = 'Chrome OS Team, chromeos-video (at] google.com'
     26 NAME = 'video_VDAStress.{1}.{2}.{3}'
     27 ATTRIBUTES = 'suite:video'
     28 TIME = 'LENGTHY'
     29 TEST_CATEGORY = 'Stress'
     30 TEST_CLASS = 'video'
     31 TEST_TYPE = 'server'
     32 DEPENDENCIES = 'hw_video_acc_{1}'
     33 
     34 DOC = \"\"\"
     35 VDA stress test to download and run with {1} test videos from cloud storage.
     36 \"\"\"
     37 
     38 import shutil
     39 import tempfile
     40 
     41 # Download the test videos from the gs bucket to the server.
     42 server_videos_dir = tempfile.mkdtemp(dir=job.tmpdir)
     43 videos = []
     44 job.run_test(
     45     'video_VDAStressSetup',
     46     gs_bucket='{0}{1}/',
     47     server_videos_dir=server_videos_dir,
     48     videos=videos,
     49     shard_number={3},
     50     shard_count={4})
     51 
     52 
     53 def run(machine):
     54     job.run_test('video_VDAStress',
     55                  machine=machine,
     56                  server_videos_dir=server_videos_dir,
     57                  videos=videos)
     58 
     59 
     60 job.parallel_on_machines(run, machines)
     61 shutil.rmtree(server_videos_dir)""")
     62 
     63 
     64 shard_count = 10
     65 for test in TESTS:
     66   for shard_number in xrange(0, shard_count):
     67     filename = 'control.%s.%s.%d' % (test.decoder, test.access, shard_number)
     68     with open(filename, 'w+') as f:
     69       content = (
     70           CONTROLFILE_TEMPLATE.format(
     71               test.gs, test.decoder, test.access,
     72               shard_number, shard_count))
     73       f.write(content)
     74