145dccadfea1854017abd8c47aa1728572a656135sgk@chromium.org#!/usr/bin/env python 245dccadfea1854017abd8c47aa1728572a656135sgk@chromium.org 33afe3277af466c60b6d35a56f578c09a4c5f4c98sbc@chromium.org# Copyright (c) 2012 Google Inc. All rights reserved. 4df8224662e615bd36cf8bebae8e58c017201f998sgk@chromium.org# Use of this source code is governed by a BSD-style license that can be 5df8224662e615bd36cf8bebae8e58c017201f998sgk@chromium.org# found in the LICENSE file. 6df8224662e615bd36cf8bebae8e58c017201f998sgk@chromium.org 745dccadfea1854017abd8c47aa1728572a656135sgk@chromium.org""" 845dccadfea1854017abd8c47aa1728572a656135sgk@chromium.orgTest variable expansion of '<!()' syntax commands. 945dccadfea1854017abd8c47aa1728572a656135sgk@chromium.org""" 1045dccadfea1854017abd8c47aa1728572a656135sgk@chromium.org 112de3da3d7db0aecfe20a02e797e75f18fe9b456esgk@chromium.orgimport os 12e62f19a9d0232068bfe0e525ce56087cc090ef16sgk@chromium.org 1345dccadfea1854017abd8c47aa1728572a656135sgk@chromium.orgimport TestGyp 1445dccadfea1854017abd8c47aa1728572a656135sgk@chromium.org 1545dccadfea1854017abd8c47aa1728572a656135sgk@chromium.orgtest = TestGyp.TestGyp(format='gypd') 1645dccadfea1854017abd8c47aa1728572a656135sgk@chromium.org 1701564f9904274ee6df8e5417e6a762ef9bd60389bradnelson@google.comexpect = test.read('commands.gyp.stdout').replace('\r', '') 1845dccadfea1854017abd8c47aa1728572a656135sgk@chromium.org 192de3da3d7db0aecfe20a02e797e75f18fe9b456esgk@chromium.orgtest.run_gyp('commands.gyp', 203afe3277af466c60b6d35a56f578c09a4c5f4c98sbc@chromium.org '--debug', 'variables', 21d3d94fcdfb9745d6784065cade320c2462924df9sbc@chromium.org stdout=expect, ignore_line_numbers=True) 2245dccadfea1854017abd8c47aa1728572a656135sgk@chromium.org 23c02278cfb5d8d068a26a503477bd09a600b2076asgk@chromium.org# Verify the commands.gypd against the checked-in expected contents. 24c02278cfb5d8d068a26a503477bd09a600b2076asgk@chromium.org# 25c02278cfb5d8d068a26a503477bd09a600b2076asgk@chromium.org# Normally, we should canonicalize line endings in the expected 26c02278cfb5d8d068a26a503477bd09a600b2076asgk@chromium.org# contents file setting the Subversion svn:eol-style to native, 27c02278cfb5d8d068a26a503477bd09a600b2076asgk@chromium.org# but that would still fail if multiple systems are sharing a single 28c02278cfb5d8d068a26a503477bd09a600b2076asgk@chromium.org# workspace on a network-mounted file system. Consequently, we 29c02278cfb5d8d068a26a503477bd09a600b2076asgk@chromium.org# massage the Windows line endings ('\r\n') in the output to the 30c02278cfb5d8d068a26a503477bd09a600b2076asgk@chromium.org# checked-in UNIX endings ('\n'). 31c02278cfb5d8d068a26a503477bd09a600b2076asgk@chromium.org 3201564f9904274ee6df8e5417e6a762ef9bd60389bradnelson@google.comcontents = test.read('commands.gypd').replace('\r', '') 3301564f9904274ee6df8e5417e6a762ef9bd60389bradnelson@google.comexpect = test.read('commands.gypd.golden').replace('\r', '') 34c02278cfb5d8d068a26a503477bd09a600b2076asgk@chromium.orgif not test.match(contents, expect): 35c02278cfb5d8d068a26a503477bd09a600b2076asgk@chromium.org print "Unexpected contents of `commands.gypd'" 3601564f9904274ee6df8e5417e6a762ef9bd60389bradnelson@google.com test.diff(expect, contents, 'commands.gypd ') 37c02278cfb5d8d068a26a503477bd09a600b2076asgk@chromium.org test.fail_test() 3845dccadfea1854017abd8c47aa1728572a656135sgk@chromium.org 3945dccadfea1854017abd8c47aa1728572a656135sgk@chromium.orgtest.pass_test() 40