1#!/usr/bin/env python
2
3# Copyright (c) 2009 Google Inc. All rights reserved.
4# Use of this source code is governed by a BSD-style license that can be
5# found in the LICENSE file.
6
7"""
8Verifies building a subsidiary dependent target from a .gyp file in a
9subdirectory, without specifying an explicit output build directory,
10and using the subdirectory's solution or project file as the entry point.
11"""
12
13import TestGyp
14import errno
15
16test = TestGyp.TestGyp(formats=['ninja', 'make'])
17
18# We want our Makefile to be one dir up from main.gyp.
19test.run_gyp('main.gyp', '--toplevel-dir=..', chdir='src/sub1')
20
21toplevel_dir = 'src'
22
23test.build('all', chdir=toplevel_dir)
24
25test.built_file_must_exist('prog1', type=test.EXECUTABLE, chdir=toplevel_dir)
26
27test.run_built_executable('prog1',
28                          chdir=toplevel_dir,
29                          stdout="Hello from prog1.c\n")
30
31test.pass_test()
32