Commit 1895cda7 authored by maruel@chromium.org's avatar maruel@chromium.org

Rewrite isolate_smoke_test.py to increase the coverage.

Also fix discrepancy in the way timestamp was calculated. It was causing issues
on OSX and Windows.

R=nsylvain@chromium.org
BUG=98834
TEST=


Review URL: http://codereview.chromium.org/10068032

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@132569 0039d316-1c4b-4281-b951-d872f2087c98
parent 0932b30c
......@@ -5,14 +5,10 @@
'variables': {
'command': [
'python',
'child.py',
'--fail',
'fail.py',
],
'isolate_dependency_tracked': [
'<(DEPTH)/data/isolate/child.py',
],
'isolate_dependency_untracked': [
'files1/',
'fail.py',
],
},
}
#!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import sys
def main():
print 'Failing'
return 1
if __name__ == '__main__':
sys.exit(main())
......@@ -4,7 +4,8 @@
{
'variables': {
'isolate_dependency_tracked': [
'<(DEPTH)/data/isolate/child.py',
# Includes itself.
'no_run.isolate',
],
'isolate_dependency_untracked': [
'files1/',
......
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'variables': {
'command': [
'python',
'touch_root.py',
],
'isolate_dependency_tracked': [
'touch_root.py',
'../../isolate.py',
],
},
}
#!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import sys
def main():
print 'child_touch_root: Verify the relative directories'
root_dir = os.path.dirname(os.path.abspath(__file__))
parent_dir, base = os.path.split(root_dir)
parent_dir, base2 = os.path.split(parent_dir)
if base != 'isolate' or base2 != 'data':
print 'Invalid root dir %s' % root_dir
return 4
open(os.path.join(parent_dir, 'isolate.py'), 'r').close()
return 0
if __name__ == '__main__':
sys.exit(main())
......@@ -5,11 +5,11 @@
'variables': {
'command': [
'python',
'child.py',
'--ok',
'with_flag.py',
'<(FLAG)',
],
'isolate_dependency_tracked': [
'<(DEPTH)/data/isolate/child.py',
'with_flag.py',
],
'isolate_dependency_untracked': [
'files1/',
......
......@@ -8,18 +8,19 @@ import sys
def main():
print 'child: verify the test data files were mapped properly'
print 'with_flag: Verify the test data files were mapped properly'
assert len(sys.argv) == 2
mode = sys.argv[1]
assert mode in ('run', 'trace')
files = sorted(os.listdir('files1'))
tree = {
'test_file1.txt': 'Foo\n',
'test_file2.txt': 'Bar\n',
}
# For now, ignore .svn directory, which happens to be there with --mode=trace
# from a svn checkout. The file shouldn't be there when --mode=run is used.
# TODO(maruel): Differentiate between the two modes and detect .svn
# directories in --mode=run.
if '.svn' in files:
# Ignore .svn directory which happens to be there with --mode=trace
# from a svn checkout. The file shouldn't be there when --mode=run is used.
if mode == 'trace' and '.svn' in files:
files.remove('.svn')
if files != sorted(tree):
......@@ -31,11 +32,20 @@ def main():
print '%s: %r != %r' % (k, v, content)
return 3
if sys.argv[1] == '--ok':
return 0
elif sys.argv[1] == '--fail':
return 1
return 4
root_dir = os.path.dirname(os.path.abspath(__file__))
parent_dir, base = os.path.split(root_dir)
if mode == 'trace':
# Verify the parent directory.
parent_dir, base2 = os.path.split(parent_dir)
if base != 'isolate' or base2 != 'data':
print 'mode trace: Invalid root dir %s' % root_dir
return 4
else:
# Verify that we are not inside a checkout.
if base == 'data':
print 'mode run: Invalid root dir %s' % root_dir
return 5
return 0
if __name__ == '__main__':
......
......@@ -177,8 +177,7 @@ def process_inputs(prevdict, indir, infiles, level, read_only):
outdict[infile]['mode'] = filemode
outdict[infile]['size'] = filestats.st_size
# Used to skip recalculating the hash. Use the most recent update time.
outdict[infile]['timestamp'] = int(round(
max(filestats.st_mtime, filestats.st_ctime)))
outdict[infile]['timestamp'] = int(round(filestats.st_mtime))
# If the timestamp wasn't updated, carry on the sha-1.
if (prevdict.get(infile, {}).get('timestamp') ==
outdict[infile]['timestamp'] and
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment