13c6a659ed056267f0c244875f39b606dd9fb447ethakis@chromium.org#!/usr/bin/env python
23c6a659ed056267f0c244875f39b606dd9fb447ethakis@chromium.org
33c6a659ed056267f0c244875f39b606dd9fb447ethakis@chromium.org# Copyright (c) 2011 Google Inc. All rights reserved.
43c6a659ed056267f0c244875f39b606dd9fb447ethakis@chromium.org# Use of this source code is governed by a BSD-style license that can be
53c6a659ed056267f0c244875f39b606dd9fb447ethakis@chromium.org# found in the LICENSE file.
63c6a659ed056267f0c244875f39b606dd9fb447ethakis@chromium.org
73c6a659ed056267f0c244875f39b606dd9fb447ethakis@chromium.org"""
83c6a659ed056267f0c244875f39b606dd9fb447ethakis@chromium.orgVerifies that postbuild steps work.
93c6a659ed056267f0c244875f39b606dd9fb447ethakis@chromium.org"""
103c6a659ed056267f0c244875f39b606dd9fb447ethakis@chromium.org
113c6a659ed056267f0c244875f39b606dd9fb447ethakis@chromium.orgimport TestGyp
123c6a659ed056267f0c244875f39b606dd9fb447ethakis@chromium.org
133c6a659ed056267f0c244875f39b606dd9fb447ethakis@chromium.orgimport sys
143c6a659ed056267f0c244875f39b606dd9fb447ethakis@chromium.org
153c6a659ed056267f0c244875f39b606dd9fb447ethakis@chromium.orgif sys.platform == 'darwin':
16ecae04c143848a2a0247af1af0180fe0a19b1a77thakis@chromium.org  test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode'])
173c6a659ed056267f0c244875f39b606dd9fb447ethakis@chromium.org
183c6a659ed056267f0c244875f39b606dd9fb447ethakis@chromium.org  test.run_gyp('test.gyp', chdir='postbuilds')
193c6a659ed056267f0c244875f39b606dd9fb447ethakis@chromium.org
203c6a659ed056267f0c244875f39b606dd9fb447ethakis@chromium.org  test.build('test.gyp', test.ALL, chdir='postbuilds')
213c6a659ed056267f0c244875f39b606dd9fb447ethakis@chromium.org
223c6a659ed056267f0c244875f39b606dd9fb447ethakis@chromium.org  # See comment in test/subdirectory/gyptest-subdir-default.py
233c6a659ed056267f0c244875f39b606dd9fb447ethakis@chromium.org  if test.format == 'xcode':
243c6a659ed056267f0c244875f39b606dd9fb447ethakis@chromium.org    chdir = 'postbuilds/subdirectory'
253c6a659ed056267f0c244875f39b606dd9fb447ethakis@chromium.org  else:
263c6a659ed056267f0c244875f39b606dd9fb447ethakis@chromium.org    chdir = 'postbuilds'
273c6a659ed056267f0c244875f39b606dd9fb447ethakis@chromium.org
283c6a659ed056267f0c244875f39b606dd9fb447ethakis@chromium.org  # Created by the postbuild scripts
293c6a659ed056267f0c244875f39b606dd9fb447ethakis@chromium.org  test.built_file_must_exist('el.a_touch',
303c6a659ed056267f0c244875f39b606dd9fb447ethakis@chromium.org                             type=test.STATIC_LIB,
313c6a659ed056267f0c244875f39b606dd9fb447ethakis@chromium.org                             chdir='postbuilds')
327824cd9bea470b5d7e763fc40eed9b79a5f4d534thakis@chromium.org  test.built_file_must_exist('el.a_gyp_touch',
337824cd9bea470b5d7e763fc40eed9b79a5f4d534thakis@chromium.org                             type=test.STATIC_LIB,
347824cd9bea470b5d7e763fc40eed9b79a5f4d534thakis@chromium.org                             chdir='postbuilds')
353c6a659ed056267f0c244875f39b606dd9fb447ethakis@chromium.org  test.built_file_must_exist('nest_el.a_touch',
363c6a659ed056267f0c244875f39b606dd9fb447ethakis@chromium.org                             type=test.STATIC_LIB,
377824cd9bea470b5d7e763fc40eed9b79a5f4d534thakis@chromium.org                             chdir=chdir)
383c6a659ed056267f0c244875f39b606dd9fb447ethakis@chromium.org  test.built_file_must_exist(
393c6a659ed056267f0c244875f39b606dd9fb447ethakis@chromium.org      'dyna.framework/Versions/A/dyna_touch',
403c6a659ed056267f0c244875f39b606dd9fb447ethakis@chromium.org      chdir='postbuilds')
413c6a659ed056267f0c244875f39b606dd9fb447ethakis@chromium.org  test.built_file_must_exist(
427824cd9bea470b5d7e763fc40eed9b79a5f4d534thakis@chromium.org      'dyna.framework/Versions/A/dyna_gyp_touch',
437824cd9bea470b5d7e763fc40eed9b79a5f4d534thakis@chromium.org      chdir='postbuilds')
447824cd9bea470b5d7e763fc40eed9b79a5f4d534thakis@chromium.org  test.built_file_must_exist(
453c6a659ed056267f0c244875f39b606dd9fb447ethakis@chromium.org      'nest_dyna.framework/Versions/A/nest_dyna_touch',
463c6a659ed056267f0c244875f39b606dd9fb447ethakis@chromium.org      chdir=chdir)
477824cd9bea470b5d7e763fc40eed9b79a5f4d534thakis@chromium.org  test.built_file_must_exist('dyna_standalone.dylib_gyp_touch',
487824cd9bea470b5d7e763fc40eed9b79a5f4d534thakis@chromium.org                             type=test.SHARED_LIB,
497824cd9bea470b5d7e763fc40eed9b79a5f4d534thakis@chromium.org                             chdir='postbuilds')
506cde8d2820d498078f4c9b5e20a50318c627da14thakis@chromium.org  test.built_file_must_exist('copied_file.txt', chdir='postbuilds')
516cde8d2820d498078f4c9b5e20a50318c627da14thakis@chromium.org  test.built_file_must_exist('copied_file_2.txt', chdir=chdir)
523c6a659ed056267f0c244875f39b606dd9fb447ethakis@chromium.org
533c6a659ed056267f0c244875f39b606dd9fb447ethakis@chromium.org  test.pass_test()
54