Skip to content
This repository has been archived by the owner on Aug 14, 2020. It is now read-only.

Commit

Permalink
Bug 1239989 - Autophone - change file paths to include full path, syn…
Browse files Browse the repository at this point in the history
…c ep1 subproject commit, r=jmaher.
  • Loading branch information
bclary committed Jan 20, 2016
1 parent 5e802b0 commit dcd0c8a
Show file tree
Hide file tree
Showing 13 changed files with 67 additions and 52 deletions.
2 changes: 1 addition & 1 deletion configs/s1s2-blank-local.ini
Expand Up @@ -8,7 +8,7 @@ sources = files/base/ files/s1s2/
local =

[tests]
blank = blank.html
blank = files/s1s2/blank.html

[settings]
iterations = 8
Expand Down
2 changes: 1 addition & 1 deletion configs/s1s2-blank-remote.ini
Expand Up @@ -8,7 +8,7 @@ sources = files/base/
remote = %(webserver_url)s

[tests]
blank = blank.html
blank = files/s1s2/blank.html

[settings]
iterations = 8
Expand Down
2 changes: 1 addition & 1 deletion configs/s1s2-nytimes-local.ini
Expand Up @@ -8,7 +8,7 @@ sources = files/base/ files/ep1/nytimes/
local =

[tests]
nytimes = nytimes.com/index.html
nytimes = files/ep1/nytimes/nytimes.com/index.html

[settings]
iterations = 8
Expand Down
2 changes: 1 addition & 1 deletion configs/s1s2-nytimes-remote.ini
Expand Up @@ -8,7 +8,7 @@ sources = files/base/
remote = %(webserver_url)s

[tests]
nytimes = nytimes.com/index.html
nytimes = files/ep1/nytimes/nytimes.com/index.html

[settings]
iterations = 8
Expand Down
2 changes: 1 addition & 1 deletion configs/s1s2-nytimes-settings.ini
Expand Up @@ -9,7 +9,7 @@ local =
remote = %(webserver_url)s

[tests]
nytimes = nytimes.com/index.html
nytimes = files/ep1/nytimes/nytimes.com/index.html

[settings]
iterations = 8
Expand Down
4 changes: 2 additions & 2 deletions configs/s1s2-settings.ini
Expand Up @@ -9,8 +9,8 @@ local =
remote = %(webserver_url)s

[tests]
blank = blank.html
twitter = twitter.html
blank = files/s1s2/blank.html
twitter = files/ep1/twitter.com/twitter.html

[settings]
iterations = 8
Expand Down
2 changes: 1 addition & 1 deletion configs/s1s2-twitter-local.ini
Expand Up @@ -8,7 +8,7 @@ sources = files/base/ files/s1s2/ files/ep1/twitter.com/
local =

[tests]
twitter = twitter.html
twitter = files/ep1/twitter.com/twitter.html

[settings]
iterations = 8
Expand Down
2 changes: 1 addition & 1 deletion configs/s1s2-twitter-remote.ini
Expand Up @@ -8,7 +8,7 @@ sources = files/base/ files/ep1/twitter.com/
remote = %(webserver_url)s

[tests]
twitter = twitter.html
twitter = files/ep1/twitter.com/twitter.html

[settings]
iterations = 8
Expand Down
4 changes: 2 additions & 2 deletions configs/tp4m-remote.ini
@@ -1,5 +1,5 @@
[paths]
sources = files/base/ files/ep1/talos/tp4m/
sources = files/base/

[locations]
# test locations can be empty to specify a local
Expand All @@ -8,7 +8,7 @@ sources = files/base/ files/ep1/talos/tp4m/
remote = %(webserver_url)s

[tests]
tp4m = tp4m.manifest
tp4m = files/ep1/talos/tp4m/tp4m.manifest

[settings]
tpargs = -tpnoisy -rss -tpcycles 6 -tppagecycles 1 -tpdelay 1000
Expand Down
4 changes: 2 additions & 2 deletions configs/tsvg-remote.ini
@@ -1,5 +1,5 @@
[paths]
sources = files/base/ files/ep1/talos/tsvg/
sources = files/base/

[locations]
# test locations can be empty to specify a local
Expand All @@ -8,7 +8,7 @@ sources = files/base/ files/ep1/talos/tsvg/
remote = %(webserver_url)s

[tests]
tsvg = svgm.manifest
tsvg = files/ep1/talos/tsvg/svgm.manifest

[settings]
tpargs = -tpnoisy -rss -tpcycles 6 -tppagecycles 1 -tpdelay 1000
Expand Down
2 changes: 1 addition & 1 deletion files/ep1
Submodule ep1 updated from 249850 to 5216fb
8 changes: 5 additions & 3 deletions phonetest.py
Expand Up @@ -386,11 +386,13 @@ def __init__(self, dm=None, phone=None, options=None, config_file=None, chunk=1,
for push in glob.glob(source + '*'):
if push.endswith('~') or push.endswith('.bak'):
continue
push_file_name = os.path.basename(push)
push_dest = posixpath.join(self._paths['dest'],
os.path.basename(push))
source,
push_file_name)
self._pushes[push] = push_dest
self._initialize_url = os.path.join('file://', self._paths['dest'],
'initialize_profile.html')
if push_file_name == 'initialize_profile.html':
self._initialize_url = push_dest
# [tests]
self._tests = {}
try:
Expand Down
83 changes: 48 additions & 35 deletions tests/talostest.py
Expand Up @@ -36,51 +36,64 @@ def __init__(self, dm=None, phone=None, options=None,
self.perfherder_signature = ''

# Finialize test configuration
tpargs = self.cfg.get('settings', 'tpargs')
for test_location, test_path in location_items:
if test_location in config_vars:
# Ignore the pseudo-options which result from passing
# the config_vars for interpolation.
continue

for test_name in self._tests:
tpname = self._tests[test_name]
tpargs = self.cfg.get('settings', 'tpargs')
manifest_root = "file:%s" % self._paths['dest']
tppath = os.path.join(manifest_root, tpname)
extra_args = "-tp %s.develop %s" % (tppath, tpargs)

try:
for source in self._paths['sources']:
fname = os.path.join(self.autophone_directory,
source, tpname)
if not os.path.exists(fname):
continue

with open(fname, 'r') as fHandle:
lines = fHandle.readlines()

if test_location == 'remote':
manifest_root = options.webserver_url

manifest = "%s.develop" % fname
with open(manifest, 'w') as fHandle:
for line in lines:
fHandle.write(line.replace('%webserver%',
manifest_root))
relative_fname = os.path.relpath(fname, self.autophone_directory)
self._pushes[manifest] = "%s.develop" % self._pushes[relative_fname]
manifest = self._tests[test_name]

if not os.path.exists(manifest):
self.loggerdeco.debug('ignoring manifest for %s' % manifest)
continue

with open(manifest, 'r') as fHandle:
lines = fHandle.readlines()

manifest_path = os.path.dirname(manifest)
manifest_file = os.path.basename(manifest)
test_manifest_path = os.path.join(manifest_path, 'manifest')
test_manifest_file = "%s.%s" % (manifest_file, test_location)
test_manifest = os.path.join(test_manifest_path, test_manifest_file)

if not os.path.isdir(test_manifest_path):
os.mkdir(test_manifest_path)

if test_location == 'remote':
url_root = test_path
else:
url_root = self._paths['dest']

with open(test_manifest, 'w') as fHandle:
for line in lines:
fHandle.write(line.replace('%webserver%',
url_root))
dest_manifest = os.path.join(self._paths['dest'],
test_manifest_path,
test_manifest_file)
self._pushes[test_manifest] = dest_manifest

extra_args = "-tp file:%s %s" % (dest_manifest, tpargs)

self._test_args["%s-%s" % (test_location, test_name)] = extra_args

self.loggerdeco.debug(
'generating manifest: test_location: %s, test_path: %s, '
'test_name: %s, manifest: %s, extra_args: %s' %
(test_location, test_name, test_path, manifest,
extra_args))

except Exception:
self.loggerdeco.exception("exception generating manifest file: %s" %
self._pushes[fname])
pass

self.loggerdeco.debug(
'test_location: %s, test_name: %s, test_path: %s, '
'test: %s, extra_args: %s' %
(test_location, test_name, test_path,
self._tests[test_name], extra_args))
self._test_args["%s-%s" % (test_location, test_name)] = extra_args
self.loggerdeco.exception(
'generating manifest: test_location: %s, test_path: %s, '
'test_name: %s, manifest: %s' %
(test_location, test_name, test_path, manifest))
raise


@property
def name(self):
Expand Down

0 comments on commit dcd0c8a

Please sign in to comment.