media/webrtc/trunk/tools/gyp/test/generator-output/gyptest-copies.py

Fri, 16 Jan 2015 18:13:44 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 18:13:44 +0100
branch
TOR_BUG_9701
changeset 14
925c144e1f1f
permissions
-rwxr-xr-x

Integrate suggestion from review to improve consistency with existing code.

michael@0 1 #!/usr/bin/env python
michael@0 2
michael@0 3 # Copyright (c) 2012 Google Inc. All rights reserved.
michael@0 4 # Use of this source code is governed by a BSD-style license that can be
michael@0 5 # found in the LICENSE file.
michael@0 6
michael@0 7 """
michael@0 8 Verifies file copies with --generator-output using an explicit build
michael@0 9 target of 'all'.
michael@0 10 """
michael@0 11
michael@0 12 import TestGyp
michael@0 13
michael@0 14 # Ninja and Android don't support --generator-output.
michael@0 15 test = TestGyp.TestGyp(formats=['!ninja', '!android'])
michael@0 16
michael@0 17 test.writable(test.workpath('copies'), False)
michael@0 18
michael@0 19 test.run_gyp('copies.gyp',
michael@0 20 '--generator-output=' + test.workpath('gypfiles'),
michael@0 21 chdir='copies')
michael@0 22
michael@0 23 test.writable(test.workpath('copies'), True)
michael@0 24
michael@0 25 test.relocate('copies', 'relocate/copies')
michael@0 26 test.relocate('gypfiles', 'relocate/gypfiles')
michael@0 27
michael@0 28 test.writable(test.workpath('relocate/copies'), False)
michael@0 29
michael@0 30 test.writable(test.workpath('relocate/copies/build'), True)
michael@0 31 test.writable(test.workpath('relocate/copies/copies-out'), True)
michael@0 32 test.writable(test.workpath('relocate/copies/subdir/build'), True)
michael@0 33 test.writable(test.workpath('relocate/copies/subdir/copies-out'), True)
michael@0 34
michael@0 35 test.build('copies.gyp', test.ALL, chdir='relocate/gypfiles')
michael@0 36
michael@0 37 test.must_match(['relocate', 'copies', 'copies-out', 'file1'],
michael@0 38 "file1 contents\n")
michael@0 39
michael@0 40 if test.format == 'xcode':
michael@0 41 chdir = 'relocate/copies/build'
michael@0 42 elif test.format == 'make':
michael@0 43 chdir = 'relocate/gypfiles/out'
michael@0 44 else:
michael@0 45 chdir = 'relocate/gypfiles'
michael@0 46 test.must_match([chdir, 'Default', 'copies-out', 'file2'], "file2 contents\n")
michael@0 47
michael@0 48 test.must_match(['relocate', 'copies', 'subdir', 'copies-out', 'file3'],
michael@0 49 "file3 contents\n")
michael@0 50
michael@0 51 if test.format == 'xcode':
michael@0 52 chdir = 'relocate/copies/subdir/build'
michael@0 53 elif test.format == 'make':
michael@0 54 chdir = 'relocate/gypfiles/out'
michael@0 55 else:
michael@0 56 chdir = 'relocate/gypfiles'
michael@0 57 test.must_match([chdir, 'Default', 'copies-out', 'file4'], "file4 contents\n")
michael@0 58
michael@0 59 test.pass_test()

mercurial