1316572adf9447041df54617c9bcd7341aae83296scottmg@chromium.org#!/usr/bin/env python 2316572adf9447041df54617c9bcd7341aae83296scottmg@chromium.org 3316572adf9447041df54617c9bcd7341aae83296scottmg@chromium.org# Copyright (c) 2012 Google Inc. All rights reserved. 4316572adf9447041df54617c9bcd7341aae83296scottmg@chromium.org# Use of this source code is governed by a BSD-style license that can be 5316572adf9447041df54617c9bcd7341aae83296scottmg@chromium.org# found in the LICENSE file. 6316572adf9447041df54617c9bcd7341aae83296scottmg@chromium.org 7316572adf9447041df54617c9bcd7341aae83296scottmg@chromium.org""" 8316572adf9447041df54617c9bcd7341aae83296scottmg@chromium.orgMake sure paths are normalized with VS macros properly expanded on Windows. 9316572adf9447041df54617c9bcd7341aae83296scottmg@chromium.org""" 10316572adf9447041df54617c9bcd7341aae83296scottmg@chromium.org 11316572adf9447041df54617c9bcd7341aae83296scottmg@chromium.orgimport TestGyp 12316572adf9447041df54617c9bcd7341aae83296scottmg@chromium.org 13316572adf9447041df54617c9bcd7341aae83296scottmg@chromium.orgimport sys 14316572adf9447041df54617c9bcd7341aae83296scottmg@chromium.org 15316572adf9447041df54617c9bcd7341aae83296scottmg@chromium.orgif sys.platform == 'win32': 16316572adf9447041df54617c9bcd7341aae83296scottmg@chromium.org test = TestGyp.TestGyp(formats=['ninja']) 17316572adf9447041df54617c9bcd7341aae83296scottmg@chromium.org 18316572adf9447041df54617c9bcd7341aae83296scottmg@chromium.org test.run_gyp('normalize-paths.gyp') 19316572adf9447041df54617c9bcd7341aae83296scottmg@chromium.org 20316572adf9447041df54617c9bcd7341aae83296scottmg@chromium.org # We can't use existence tests because any case will pass, so we check the 21316572adf9447041df54617c9bcd7341aae83296scottmg@chromium.org # contents of ninja files directly since that's what we're most concerned 22316572adf9447041df54617c9bcd7341aae83296scottmg@chromium.org # with anyway. 23316572adf9447041df54617c9bcd7341aae83296scottmg@chromium.org subninja = open(test.built_file_path('obj/some_target.ninja')).read() 24316572adf9447041df54617c9bcd7341aae83296scottmg@chromium.org if '$!product_dir' in subninja: 25316572adf9447041df54617c9bcd7341aae83296scottmg@chromium.org test.fail_test() 26316572adf9447041df54617c9bcd7341aae83296scottmg@chromium.org if 'out\\Default' in subninja: 27316572adf9447041df54617c9bcd7341aae83296scottmg@chromium.org test.fail_test() 28316572adf9447041df54617c9bcd7341aae83296scottmg@chromium.org 29316572adf9447041df54617c9bcd7341aae83296scottmg@chromium.org second = open(test.built_file_path('obj/second.ninja')).read() 30316572adf9447041df54617c9bcd7341aae83296scottmg@chromium.org if ('..\\..\\things\\AnotherName.exe' in second or 31316572adf9447041df54617c9bcd7341aae83296scottmg@chromium.org 'AnotherName.exe' not in second): 32316572adf9447041df54617c9bcd7341aae83296scottmg@chromium.org test.fail_test() 33316572adf9447041df54617c9bcd7341aae83296scottmg@chromium.org 346a66aeb38f7e4c4ed41feb36bd0b1cffb13e54c7scottmg@chromium.org copytarget = open(test.built_file_path('obj/copy_target.ninja')).read() 356a66aeb38f7e4c4ed41feb36bd0b1cffb13e54c7scottmg@chromium.org if '$(VSInstallDir)' in copytarget: 366a66aeb38f7e4c4ed41feb36bd0b1cffb13e54c7scottmg@chromium.org test.fail_test() 376a66aeb38f7e4c4ed41feb36bd0b1cffb13e54c7scottmg@chromium.org 38316572adf9447041df54617c9bcd7341aae83296scottmg@chromium.org action = open(test.built_file_path('obj/action.ninja')).read() 39316572adf9447041df54617c9bcd7341aae83296scottmg@chromium.org if '..\\..\\out\\Default' in action: 40316572adf9447041df54617c9bcd7341aae83296scottmg@chromium.org test.fail_test() 41316572adf9447041df54617c9bcd7341aae83296scottmg@chromium.org if '..\\..\\SomethingElse' in action or 'SomethingElse' not in action: 42316572adf9447041df54617c9bcd7341aae83296scottmg@chromium.org test.fail_test() 43316572adf9447041df54617c9bcd7341aae83296scottmg@chromium.org if '..\\..\\SomeOtherInput' in action or 'SomeOtherInput' not in action: 44316572adf9447041df54617c9bcd7341aae83296scottmg@chromium.org test.fail_test() 45316572adf9447041df54617c9bcd7341aae83296scottmg@chromium.org 46316572adf9447041df54617c9bcd7341aae83296scottmg@chromium.org test.pass_test() 47