2014-01-24 18:34:11 +00:00
|
|
|
#!/usr/bin/python
|
|
|
|
|
|
|
|
"""
|
|
|
|
Copyright 2014 Google Inc.
|
|
|
|
|
|
|
|
Use of this source code is governed by a BSD-style license that can be
|
|
|
|
found in the LICENSE file.
|
|
|
|
|
|
|
|
Test download.py
|
|
|
|
|
|
|
|
TODO(epoger): Create a command to update the expected results (in
|
2014-02-19 15:38:13 +00:00
|
|
|
self._output_dir_expected) when appropriate. For now, you should:
|
2014-07-17 19:54:16 +00:00
|
|
|
1. examine the results in self.output_dir_actual and make sure they are ok
|
2014-02-19 15:38:13 +00:00
|
|
|
2. rm -rf self._output_dir_expected
|
2014-07-17 19:54:16 +00:00
|
|
|
3. mv self.output_dir_actual self._output_dir_expected
|
2014-01-24 18:34:11 +00:00
|
|
|
Although, if you're using an SVN checkout, this will blow away .svn directories
|
2014-02-19 15:38:13 +00:00
|
|
|
within self._output_dir_expected, which wouldn't be good...
|
2014-01-24 18:34:11 +00:00
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
# System-level imports
|
|
|
|
import os
|
2014-07-11 15:52:35 +00:00
|
|
|
|
|
|
|
# Must fix up PYTHONPATH before importing from within Skia
|
2014-08-18 20:37:59 +00:00
|
|
|
import rs_fixpypath # pylint: disable=W0611
|
2014-01-24 18:34:11 +00:00
|
|
|
|
|
|
|
# Imports from within Skia
|
2014-07-11 15:52:35 +00:00
|
|
|
from py.utils import url_utils
|
2014-02-19 15:38:13 +00:00
|
|
|
import base_unittest
|
2014-01-24 18:34:11 +00:00
|
|
|
import download_actuals
|
|
|
|
|
2014-02-19 15:38:13 +00:00
|
|
|
|
|
|
|
class DownloadTest(base_unittest.TestCase):
|
2014-01-24 18:34:11 +00:00
|
|
|
|
|
|
|
def test_fetch(self):
|
|
|
|
"""Tests fetch() of GM results from actual-results.json ."""
|
|
|
|
downloader = download_actuals.Download(
|
2014-06-05 17:30:37 +00:00
|
|
|
actuals_base_url=url_utils.create_filepath_url(
|
2014-07-17 19:54:16 +00:00
|
|
|
os.path.join(self.input_dir, 'gm-actuals')),
|
2014-06-05 17:30:37 +00:00
|
|
|
gm_actuals_root_url=url_utils.create_filepath_url(
|
2014-07-17 19:54:16 +00:00
|
|
|
os.path.join(self.input_dir, 'fake-gm-imagefiles')))
|
2014-01-24 18:34:11 +00:00
|
|
|
downloader.fetch(
|
|
|
|
builder_name='Test-Android-GalaxyNexus-SGX540-Arm7-Release',
|
2014-07-17 19:54:16 +00:00
|
|
|
dest_dir=self.output_dir_actual)
|
2014-01-24 18:34:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
def main():
|
2014-02-19 15:38:13 +00:00
|
|
|
base_unittest.main(DownloadTest)
|
2014-01-24 18:34:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
main()
|