summaryrefslogtreecommitdiff
path: root/test/controls/meson.build
blob: 0103543e1fc2e26937491e791cf933d437a87403 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# SPDX-License-Identifier: CC0-1.0

control_tests = [
    ['control_info',                'control_info.cpp'],
    ['control_info_map',            'control_info_map.cpp'],
    ['control_list',                'control_list.cpp'],
    ['control_value',               'control_value.cpp'],
]

foreach t : control_tests
    exe = executable(t[0], t[1],
                     dependencies : libcamera_public,
                     link_with : test_libraries,
                     include_directories : test_includes_internal)
    test(t[0], exe, suite : 'controls', is_parallel : false)
endforeach
href='#n49'>49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
#!/usr/bin/env python3
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2021, Google Inc.
#
# Author: Paul Elder <paul.elder@ideasonboard.com>
#
# extract-docs.py - Extract doxygen documentation from mojom files

import argparse
import re
import sys

regex_block_start = re.compile('^\/\*\*$')
regex_block_end = re.compile('^ \*\/$')
regex_spdx = re.compile('^\/\* SPDX-License-Identifier: .* \*\/$')


def main(argv):

    # Parse command line arguments
    parser = argparse.ArgumentParser()
    parser.add_argument('-o', dest='output', metavar='file',
                        type=argparse.FileType('w', encoding='utf-8'),
                        default=sys.stdout,
                        help='Output file name (default: standard output)')
    parser.add_argument('input', type=str,
                        help='Input file name.')
    args = parser.parse_args(argv[1:])

    lines = open(args.input, 'r').readlines()
    pipeline = args.input.split('/')[-1].replace('.mojom', '')

    if not regex_spdx.match(lines[0]):
        raise Exception(f'Missing SPDX license header in {args.input}')

    data = lines[0]
    data += f'''\
/*
 * Copyright (C) 2021, Google Inc.
 *
 * {pipeline}_ipa_interface.cpp - Docs file for generated {pipeline}.mojom
 *
 * This file is auto-generated. Do not edit.
 */

namespace libcamera {{

'''

    in_block = False
    comment = ''
    for lineno, line in enumerate(lines, start=1):
        if regex_block_start.match(line):
            if in_block:
                raise SyntaxError('Expected end of comment',
                                  (args.input, lineno, 1, line))
            in_block = True
            comment = line
            continue

        if regex_block_end.match(line):
            if in_block:
                comment += line
                data += comment + '\n'
            in_block = False
            continue

        if in_block:
            comment += line

    data += '} /* namespace libcamera */\n'

    args.output.write(data)

    return 0


if __name__ == '__main__':
    sys.exit(main(sys.argv))