media/webrtc/trunk/build/nocompile.gypi

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/media/webrtc/trunk/build/nocompile.gypi	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,96 @@
     1.4 +# Copyright (c) 2011 The Chromium Authors. All rights reserved.
     1.5 +# Use of this source code is governed by a BSD-style license that can be
     1.6 +# found in the LICENSE file.
     1.7 +
     1.8 +# This file is meant to be included into an target to create a unittest that
     1.9 +# invokes a set of no-compile tests.  A no-compile test is a test that asserts
    1.10 +# a particular construct will not compile.
    1.11 +#
    1.12 +# Also see:
    1.13 +#   http://dev.chromium.org/developers/testing/no-compile-tests
    1.14 +#
    1.15 +# To use this, create a gyp target with the following form:
    1.16 +# {
    1.17 +#   'target_name': 'my_module_nc_unittests',
    1.18 +#   'type': 'executable',
    1.19 +#   'sources': [
    1.20 +#     'nc_testset_1.nc',
    1.21 +#     'nc_testset_2.nc',
    1.22 +#   ],
    1.23 +#   'includes': ['path/to/this/gypi/file'],
    1.24 +# }
    1.25 +#
    1.26 +# The .nc files are C++ files that contain code we wish to assert will not
    1.27 +# compile.  Each individual test case in the file should be put in its own
    1.28 +# #ifdef section.  The expected output should be appended with a C++-style
    1.29 +# comment that has a python list of regular expressions.  This will likely
    1.30 +# be greater than 80-characters. Giving a solid expected output test is
    1.31 +# important so that random compile failures do not cause the test to pass.
    1.32 +#
    1.33 +# Example .nc file:
    1.34 +#
    1.35 +#   #if defined(TEST_NEEDS_SEMICOLON)  // [r"expected ',' or ';' at end of input"]
    1.36 +#
    1.37 +#   int a = 1
    1.38 +#
    1.39 +#   #elif defined(TEST_NEEDS_CAST)  // [r"invalid conversion from 'void*' to 'char*'"]
    1.40 +#
    1.41 +#   void* a = NULL;
    1.42 +#   char* b = a;
    1.43 +#
    1.44 +#   #endif
    1.45 +#
    1.46 +# If we needed disable TEST_NEEDS_SEMICOLON, then change the define to:
    1.47 +#
    1.48 +#   DISABLE_TEST_NEEDS_SEMICOLON
    1.49 +#   TEST_NEEDS_CAST
    1.50 +#
    1.51 +# The lines above are parsed by a regexp so avoid getting creative with the
    1.52 +# formatting or ifdef logic; it will likely just not work.
    1.53 +#
    1.54 +# Implementation notes:
    1.55 +# The .nc files are actually processed by a python script which executes the
    1.56 +# compiler and generates a .cc file that is empty on success, or will have a
    1.57 +# series of #error lines on failure, and a set of trivially passing gunit
    1.58 +# TEST() functions on success. This allows us to fail at the compile step when
    1.59 +# something goes wrong, and know during the unittest run that the test was at
    1.60 +# least processed when things go right.
    1.61 +
    1.62 +{
    1.63 +  # TODO(awong): Disabled until http://crbug.com/105388 is resolved.
    1.64 +  'sources/': [['exclude', '\\.nc$']],
    1.65 +  'conditions': [
    1.66 +    [ 'OS=="linux" and clang==0', {
    1.67 +      'rules': [
    1.68 +        {
    1.69 +          'variables': {
    1.70 +            'nocompile_driver': '<(DEPTH)/tools/nocompile_driver.py',
    1.71 +            'nc_result_path': ('<(INTERMEDIATE_DIR)/<(module_dir)/'
    1.72 +                               '<(RULE_INPUT_ROOT)_nc.cc'),
    1.73 +           },
    1.74 +          'rule_name': 'run_nocompile',
    1.75 +          'extension': 'nc',
    1.76 +          'inputs': [
    1.77 +            '<(nocompile_driver)',
    1.78 +          ],
    1.79 +          'outputs': [
    1.80 +            '<(nc_result_path)'
    1.81 +          ],
    1.82 +          'action': [
    1.83 +            'python',
    1.84 +            '<(nocompile_driver)',
    1.85 +            '4', # number of compilers to invoke in parallel.
    1.86 +            '<(RULE_INPUT_PATH)',
    1.87 +            '-Wall -Werror -Wfatal-errors -I<(DEPTH)',
    1.88 +            '<(nc_result_path)',
    1.89 +            ],
    1.90 +          'message': 'Generating no compile results for <(RULE_INPUT_PATH)',
    1.91 +          'process_outputs_as_sources': 1,
    1.92 +        },
    1.93 +      ],
    1.94 +    }, {
    1.95 +      'sources/': [['exclude', '\\.nc$']]
    1.96 +    }],  # 'OS=="linux" and clang=="0"'
    1.97 +  ],
    1.98 +}
    1.99 +

mercurial