1b63e0f07f01f18343a20e44065b4b290d5e695e8thomasvl@chromium.org#!/usr/bin/env python
2b63e0f07f01f18343a20e44065b4b290d5e695e8thomasvl@chromium.org
346d34d835a9fb416adc83e8cf4aba29204bece0bbradnelson@google.com# Copyright (c) 2012 Google Inc. All rights reserved.
4b63e0f07f01f18343a20e44065b4b290d5e695e8thomasvl@chromium.org# Use of this source code is governed by a BSD-style license that can be
5b63e0f07f01f18343a20e44065b4b290d5e695e8thomasvl@chromium.org# found in the LICENSE file.
6b63e0f07f01f18343a20e44065b4b290d5e695e8thomasvl@chromium.org
7b63e0f07f01f18343a20e44065b4b290d5e695e8thomasvl@chromium.org"""
8b63e0f07f01f18343a20e44065b4b290d5e695e8thomasvl@chromium.orgTest variable expansion of '<!()' syntax commands where they are evaluated
9b63e0f07f01f18343a20e44065b4b290d5e695e8thomasvl@chromium.orgmore then once..
10b63e0f07f01f18343a20e44065b4b290d5e695e8thomasvl@chromium.org"""
11b63e0f07f01f18343a20e44065b4b290d5e695e8thomasvl@chromium.org
12b63e0f07f01f18343a20e44065b4b290d5e695e8thomasvl@chromium.orgimport TestGyp
13b63e0f07f01f18343a20e44065b4b290d5e695e8thomasvl@chromium.org
14b63e0f07f01f18343a20e44065b4b290d5e695e8thomasvl@chromium.orgtest = TestGyp.TestGyp(format='gypd')
15b63e0f07f01f18343a20e44065b4b290d5e695e8thomasvl@chromium.org
163afe3277af466c60b6d35a56f578c09a4c5f4c98sbc@chromium.orgexpect = test.read('commands-repeated.gyp.stdout').replace('\r\n', '\n')
17b63e0f07f01f18343a20e44065b4b290d5e695e8thomasvl@chromium.org
18b63e0f07f01f18343a20e44065b4b290d5e695e8thomasvl@chromium.orgtest.run_gyp('commands-repeated.gyp',
193afe3277af466c60b6d35a56f578c09a4c5f4c98sbc@chromium.org             '--debug', 'variables',
203afe3277af466c60b6d35a56f578c09a4c5f4c98sbc@chromium.org             stdout=expect, ignore_line_numbers=True)
21b63e0f07f01f18343a20e44065b4b290d5e695e8thomasvl@chromium.org
22b63e0f07f01f18343a20e44065b4b290d5e695e8thomasvl@chromium.org# Verify the commands-repeated.gypd against the checked-in expected contents.
23b63e0f07f01f18343a20e44065b4b290d5e695e8thomasvl@chromium.org#
24b63e0f07f01f18343a20e44065b4b290d5e695e8thomasvl@chromium.org# Normally, we should canonicalize line endings in the expected
25b63e0f07f01f18343a20e44065b4b290d5e695e8thomasvl@chromium.org# contents file setting the Subversion svn:eol-style to native,
26b63e0f07f01f18343a20e44065b4b290d5e695e8thomasvl@chromium.org# but that would still fail if multiple systems are sharing a single
27b63e0f07f01f18343a20e44065b4b290d5e695e8thomasvl@chromium.org# workspace on a network-mounted file system.  Consequently, we
28b63e0f07f01f18343a20e44065b4b290d5e695e8thomasvl@chromium.org# massage the Windows line endings ('\r\n') in the output to the
29b63e0f07f01f18343a20e44065b4b290d5e695e8thomasvl@chromium.org# checked-in UNIX endings ('\n').
30b63e0f07f01f18343a20e44065b4b290d5e695e8thomasvl@chromium.org
313afe3277af466c60b6d35a56f578c09a4c5f4c98sbc@chromium.orgcontents = test.read('commands-repeated.gypd').replace('\r\n', '\n')
323afe3277af466c60b6d35a56f578c09a4c5f4c98sbc@chromium.orgexpect = test.read('commands-repeated.gypd.golden').replace('\r\n', '\n')
33b63e0f07f01f18343a20e44065b4b290d5e695e8thomasvl@chromium.orgif not test.match(contents, expect):
34b63e0f07f01f18343a20e44065b4b290d5e695e8thomasvl@chromium.org  print "Unexpected contents of `commands-repeated.gypd'"
3501564f9904274ee6df8e5417e6a762ef9bd60389bradnelson@google.com  test.diff(expect, contents, 'commands-repeated.gypd ')
36b63e0f07f01f18343a20e44065b4b290d5e695e8thomasvl@chromium.org  test.fail_test()
37b63e0f07f01f18343a20e44065b4b290d5e695e8thomasvl@chromium.org
38b63e0f07f01f18343a20e44065b4b290d5e695e8thomasvl@chromium.orgtest.pass_test()
39