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.
8 Verifies simple build of a "Hello, world!" program with static libraries,
9 including verifying that libraries are rebuilt correctly when functions
10 move between libraries.
15 test = TestGyp.TestGyp()
17 test.run_gyp('library.gyp',
18 '-Dlibrary=static_library',
19 '-Dmoveable_function=lib1',
22 test.relocate('src', 'relocate/src')
24 test.build('library.gyp', test.ALL, chdir='relocate/src')
30 Hello from lib1_moveable.c
32 test.run_built_executable('program', chdir='relocate/src', stdout=expect)
35 test.run_gyp('library.gyp',
36 '-Dlibrary=static_library',
37 '-Dmoveable_function=lib2',
40 # Update program.c to force a rebuild.
42 contents = test.read('relocate/src/program.c')
43 contents = contents.replace('Hello', 'Hello again')
44 test.write('relocate/src/program.c', contents)
46 test.build('library.gyp', test.ALL, chdir='relocate/src')
49 Hello again from program.c
52 Hello from lib2_moveable.c
54 test.run_built_executable('program', chdir='relocate/src', stdout=expect)
57 test.run_gyp('library.gyp',
58 '-Dlibrary=static_library',
59 '-Dmoveable_function=lib1',
62 # Update program.c and lib2.c to force a rebuild.
64 contents = test.read('relocate/src/program.c')
65 contents = contents.replace('again', 'again again')
66 test.write('relocate/src/program.c', contents)
68 # TODO(sgk): we have to force a rebuild of lib2 so that it weeds out
69 # the "moved" module. This should be done in gyp by adding a dependency
70 # on the generated .vcproj file itself.
71 test.touch('relocate/src/lib2.c')
73 test.build('library.gyp', test.ALL, chdir='relocate/src')
76 Hello again again from program.c
79 Hello from lib1_moveable.c
81 test.run_built_executable('program', chdir='relocate/src', stdout=expect)