|
| 1 | +#!/usr/bin/env python3 |
| 2 | +"""Check the installed-library implementation contract for representative operations.""" |
| 3 | +import argparse |
| 4 | +import subprocess |
| 5 | + |
| 6 | +# These operations must have a library-owned definition even when no consumer |
| 7 | +# instantiates them. Behavioral suites cover their semantics independently. |
| 8 | +OPERATIONS = ( |
| 9 | + 'httpserver::http::fields::append(', |
| 10 | + 'httpserver::server::server_options::validate(', |
| 11 | + 'httpserver::server::resource_budget::reserve(', |
| 12 | + 'httpserver::server::route_pattern::parse(', |
| 13 | + 'httpserver::server::make_sync_route(', |
| 14 | + 'httpserver::manual_executor::run_one(', |
| 15 | + 'httpserver::detail::current_executor_slot(', |
| 16 | + 'httpserver::detail::task_frame_base::finish(', |
| 17 | + 'httpserver::stop_token::cancellation_awaiter::await_suspend(', |
| 18 | + 'httpserver::detail::fire_trigger(', |
| 19 | + 'httpserver::exchange::admit_body(', |
| 20 | + 'httpserver::body_reader::collect(', |
| 21 | + 'httpserver::response_writer::finish(', |
| 22 | + 'httpserver::response_definition::owned_bytes(', |
| 23 | + 'httpserver::send_definition(', |
| 24 | + 'httpserver::detail::send_cursor::pull(', |
| 25 | + 'httpserver::detail::http1_head_parser::', |
| 26 | + 'httpserver::detail::hpack_decoder::', |
| 27 | + 'httpserver::detail::qpack_decoder::', |
| 28 | + 'httpserver::websocket::options::validate(', |
| 29 | + 'httpserver::detail::http2_dispatch::post(', |
| 30 | + 'httpserver::detail::valid_http1_host(', |
| 31 | + 'httpserver::detail::unescape_buf_raw(', |
| 32 | + 'httpserver::detail::owned_completion_storage::claim_read(', |
| 33 | +) |
| 34 | + |
| 35 | + |
| 36 | +def main(): |
| 37 | + parser = argparse.ArgumentParser(description=__doc__) |
| 38 | + parser.add_argument('library') |
| 39 | + args = parser.parse_args() |
| 40 | + result = subprocess.run(['nm', '-C', args.library], |
| 41 | + check=True, text=True, capture_output=True) |
| 42 | + definitions = [line for line in result.stdout.splitlines() |
| 43 | + if ' T ' in line] |
| 44 | + missing = [name for name in OPERATIONS if not any(name in line for line in definitions)] |
| 45 | + if missing: |
| 46 | + raise SystemExit('Missing compiled library operations:\n' + '\n'.join(missing)) |
| 47 | + print('PASS representative operations have compiled library definitions') |
| 48 | + |
| 49 | + |
| 50 | +if __name__ == '__main__': |
| 51 | + main() |
0 commit comments