media/webrtc/trunk/build/nocompile.gypi

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 # Copyright (c) 2011 The Chromium Authors. All rights reserved.
michael@0 2 # Use of this source code is governed by a BSD-style license that can be
michael@0 3 # found in the LICENSE file.
michael@0 4
michael@0 5 # This file is meant to be included into an target to create a unittest that
michael@0 6 # invokes a set of no-compile tests. A no-compile test is a test that asserts
michael@0 7 # a particular construct will not compile.
michael@0 8 #
michael@0 9 # Also see:
michael@0 10 # http://dev.chromium.org/developers/testing/no-compile-tests
michael@0 11 #
michael@0 12 # To use this, create a gyp target with the following form:
michael@0 13 # {
michael@0 14 # 'target_name': 'my_module_nc_unittests',
michael@0 15 # 'type': 'executable',
michael@0 16 # 'sources': [
michael@0 17 # 'nc_testset_1.nc',
michael@0 18 # 'nc_testset_2.nc',
michael@0 19 # ],
michael@0 20 # 'includes': ['path/to/this/gypi/file'],
michael@0 21 # }
michael@0 22 #
michael@0 23 # The .nc files are C++ files that contain code we wish to assert will not
michael@0 24 # compile. Each individual test case in the file should be put in its own
michael@0 25 # #ifdef section. The expected output should be appended with a C++-style
michael@0 26 # comment that has a python list of regular expressions. This will likely
michael@0 27 # be greater than 80-characters. Giving a solid expected output test is
michael@0 28 # important so that random compile failures do not cause the test to pass.
michael@0 29 #
michael@0 30 # Example .nc file:
michael@0 31 #
michael@0 32 # #if defined(TEST_NEEDS_SEMICOLON) // [r"expected ',' or ';' at end of input"]
michael@0 33 #
michael@0 34 # int a = 1
michael@0 35 #
michael@0 36 # #elif defined(TEST_NEEDS_CAST) // [r"invalid conversion from 'void*' to 'char*'"]
michael@0 37 #
michael@0 38 # void* a = NULL;
michael@0 39 # char* b = a;
michael@0 40 #
michael@0 41 # #endif
michael@0 42 #
michael@0 43 # If we needed disable TEST_NEEDS_SEMICOLON, then change the define to:
michael@0 44 #
michael@0 45 # DISABLE_TEST_NEEDS_SEMICOLON
michael@0 46 # TEST_NEEDS_CAST
michael@0 47 #
michael@0 48 # The lines above are parsed by a regexp so avoid getting creative with the
michael@0 49 # formatting or ifdef logic; it will likely just not work.
michael@0 50 #
michael@0 51 # Implementation notes:
michael@0 52 # The .nc files are actually processed by a python script which executes the
michael@0 53 # compiler and generates a .cc file that is empty on success, or will have a
michael@0 54 # series of #error lines on failure, and a set of trivially passing gunit
michael@0 55 # TEST() functions on success. This allows us to fail at the compile step when
michael@0 56 # something goes wrong, and know during the unittest run that the test was at
michael@0 57 # least processed when things go right.
michael@0 58
michael@0 59 {
michael@0 60 # TODO(awong): Disabled until http://crbug.com/105388 is resolved.
michael@0 61 'sources/': [['exclude', '\\.nc$']],
michael@0 62 'conditions': [
michael@0 63 [ 'OS=="linux" and clang==0', {
michael@0 64 'rules': [
michael@0 65 {
michael@0 66 'variables': {
michael@0 67 'nocompile_driver': '<(DEPTH)/tools/nocompile_driver.py',
michael@0 68 'nc_result_path': ('<(INTERMEDIATE_DIR)/<(module_dir)/'
michael@0 69 '<(RULE_INPUT_ROOT)_nc.cc'),
michael@0 70 },
michael@0 71 'rule_name': 'run_nocompile',
michael@0 72 'extension': 'nc',
michael@0 73 'inputs': [
michael@0 74 '<(nocompile_driver)',
michael@0 75 ],
michael@0 76 'outputs': [
michael@0 77 '<(nc_result_path)'
michael@0 78 ],
michael@0 79 'action': [
michael@0 80 'python',
michael@0 81 '<(nocompile_driver)',
michael@0 82 '4', # number of compilers to invoke in parallel.
michael@0 83 '<(RULE_INPUT_PATH)',
michael@0 84 '-Wall -Werror -Wfatal-errors -I<(DEPTH)',
michael@0 85 '<(nc_result_path)',
michael@0 86 ],
michael@0 87 'message': 'Generating no compile results for <(RULE_INPUT_PATH)',
michael@0 88 'process_outputs_as_sources': 1,
michael@0 89 },
michael@0 90 ],
michael@0 91 }, {
michael@0 92 'sources/': [['exclude', '\\.nc$']]
michael@0 93 }], # 'OS=="linux" and clang=="0"'
michael@0 94 ],
michael@0 95 }
michael@0 96

mercurial