media/webrtc/trunk/tools/gyp/test/library/gyptest-shared.py

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rwxr-xr-x

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 #!/usr/bin/env python
     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.
     7 """
     8 Verifies simple build of a "Hello, world!" program with shared libraries,
     9 including verifying that libraries are rebuilt correctly when functions
    10 move between libraries.
    11 """
    13 import TestGyp
    15 test = TestGyp.TestGyp()
    17 test.run_gyp('library.gyp',
    18              '-Dlibrary=shared_library',
    19              '-Dmoveable_function=lib1',
    20              chdir='src')
    22 test.relocate('src', 'relocate/src')
    24 test.build('library.gyp', test.ALL, chdir='relocate/src')
    26 expect = """\
    27 Hello from program.c
    28 Hello from lib1.c
    29 Hello from lib2.c
    30 Hello from lib1_moveable.c
    31 """
    32 test.run_built_executable('program', chdir='relocate/src', stdout=expect)
    35 test.run_gyp('library.gyp',
    36              '-Dlibrary=shared_library',
    37              '-Dmoveable_function=lib2',
    38              chdir='relocate/src')
    40 # Update program.c to force a rebuild.
    41 test.sleep()
    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')
    48 expect = """\
    49 Hello again from program.c
    50 Hello from lib1.c
    51 Hello from lib2.c
    52 Hello from lib2_moveable.c
    53 """
    54 test.run_built_executable('program', chdir='relocate/src', stdout=expect)
    57 test.run_gyp('library.gyp',
    58              '-Dlibrary=shared_library',
    59              '-Dmoveable_function=lib1',
    60              chdir='relocate/src')
    62 # Update program.c to force a rebuild.
    63 test.sleep()
    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')
    75 expect = """\
    76 Hello again again from program.c
    77 Hello from lib1.c
    78 Hello from lib2.c
    79 Hello from lib1_moveable.c
    80 """
    81 test.run_built_executable('program', chdir='relocate/src', stdout=expect)
    84 test.pass_test()

mercurial