Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Side by Side Diff: test/mac/gyptest-bundle-resources.py

Issue 61293004: ninja generator vs file permissions (Closed) Base URL: http://gyp.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 2
3 # Copyright (c) 2013 Google Inc. All rights reserved. 3 # Copyright (c) 2013 Google Inc. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """ 7 """
8 Verifies things related to bundle resources. 8 Verifies things related to bundle resources.
9 """ 9 """
10 10
11 import TestGyp 11 import TestGyp
12 12
13 import os
14 import stat
13 import sys 15 import sys
14 16
17
18 def check_attribs(path):
19 out_path = test.built_file_path(
20 os.path.join('resource.app/Contents/Resources', path), chdir=CHDIR)
21
22 in_stat = os.stat(os.path.join(CHDIR, path))
23 out_stat = os.stat(out_path)
24 if in_stat.st_mode != out_stat.st_mode:
Mark Mentovai 2013/11/06 02:50:40 You’re returning the mode for comparison outside o
Nico 2013/11/06 02:58:16 I'm only returning the out_stat.st_mode, and only
25 test.fail_test()
26 if in_stat.st_mtime == out_stat.st_mtime:
27 test.fail_test()
28 return out_stat.st_mode
29
30
15 if sys.platform == 'darwin': 31 if sys.platform == 'darwin':
16 # set |match| to ignore build stderr output. 32 # set |match| to ignore build stderr output.
17 test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode']) 33 test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode'])
18 34
19 CHDIR = 'bundle-resources' 35 CHDIR = 'bundle-resources'
20 test.run_gyp('test.gyp', chdir=CHDIR) 36 test.run_gyp('test.gyp', chdir=CHDIR)
21 37
22 test.build('test.gyp', test.ALL, chdir=CHDIR) 38 test.build('test.gyp', test.ALL, chdir=CHDIR)
23 39
24 test.built_file_must_match('resource.app/Contents/Resources/secret.txt', 40 test.built_file_must_match('resource.app/Contents/Resources/secret.txt',
25 'abc\n', chdir=CHDIR) 41 'abc\n', chdir=CHDIR)
26 test.built_file_must_match('source_rule.app/Contents/Resources/secret.txt', 42 test.built_file_must_match('source_rule.app/Contents/Resources/secret.txt',
27 'ABC\n', chdir=CHDIR) 43 'ABC\n', chdir=CHDIR)
28 44
45 test.built_file_must_match(
46 'resource.app/Contents/Resources/executable-file.sh',
47 '#!/bin/bash\n'
48 '\n'
49 'echo echo echo echo cho ho o o\n', chdir=CHDIR)
50
51 if check_attribs('executable-file.sh') & stat.S_IXUSR == 0:
52 test.fail_test()
53 if check_attribs('secret.txt') & stat.S_IXUSR != 0:
54 test.fail_test()
55
29 # TODO(thakis): This currently fails with make. 56 # TODO(thakis): This currently fails with make.
30 if test.format != 'make': 57 if test.format != 'make':
31 test.built_file_must_match( 58 test.built_file_must_match(
32 'resource_rule.app/Contents/Resources/secret.txt', 'ABC\n', chdir=CHDIR) 59 'resource_rule.app/Contents/Resources/secret.txt', 'ABC\n', chdir=CHDIR)
33 60
34 test.pass_test() 61 test.pass_test()
OLDNEW
« test/copies/src/copies-attribs.gyp ('K') | « test/mac/bundle-resources/test.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698