1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/media/webrtc/trunk/tools/gyp/test/variables/commands/gyptest-commands-ignore-env.py Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,46 @@ 1.4 +#!/usr/bin/env python 1.5 + 1.6 +# Copyright (c) 2012 Google Inc. All rights reserved. 1.7 +# Use of this source code is governed by a BSD-style license that can be 1.8 +# found in the LICENSE file. 1.9 + 1.10 +""" 1.11 +Test that environment variables are ignored when --ignore-environment is 1.12 +specified. 1.13 +""" 1.14 + 1.15 +import os 1.16 + 1.17 +import TestGyp 1.18 + 1.19 +test = TestGyp.TestGyp(format='gypd') 1.20 + 1.21 +os.environ['GYP_DEFINES'] = 'FOO=BAR' 1.22 +os.environ['GYP_GENERATORS'] = 'foo' 1.23 +os.environ['GYP_GENERATOR_FLAGS'] = 'genflag=foo' 1.24 +os.environ['GYP_GENERATOR_OUTPUT'] = 'somedir' 1.25 + 1.26 +expect = test.read('commands.gyp.ignore-env.stdout').replace('\r\n', '\n') 1.27 + 1.28 +test.run_gyp('commands.gyp', 1.29 + '--debug', 'variables', 1.30 + '--ignore-environment', 1.31 + stdout=expect, ignore_line_numbers=True) 1.32 + 1.33 +# Verify the commands.gypd against the checked-in expected contents. 1.34 +# 1.35 +# Normally, we should canonicalize line endings in the expected 1.36 +# contents file setting the Subversion svn:eol-style to native, 1.37 +# but that would still fail if multiple systems are sharing a single 1.38 +# workspace on a network-mounted file system. Consequently, we 1.39 +# massage the Windows line endings ('\r\n') in the output to the 1.40 +# checked-in UNIX endings ('\n'). 1.41 + 1.42 +contents = test.read('commands.gypd').replace('\r', '') 1.43 +expect = test.read('commands.gypd.golden').replace('\r', '') 1.44 +if not test.match(contents, expect): 1.45 + print "Unexpected contents of `commands.gypd'" 1.46 + test.diff(expect, contents, 'commands.gypd ') 1.47 + test.fail_test() 1.48 + 1.49 +test.pass_test()