required=True, help='The root of the source directory') parser.add_argument('-I', '--include', nargs='+', help="Include folders for the preprocessor", default=[]) parser.add_argument('-D', '--define', nargs='+', help="Defines for the preprocessor", default=[]) args = parser.parse_args() serial_info = generate(args.binary, args.define, args.include) p = Popen(args.binary, stdin=PIPE, stdout=PIPE, stderr=sys.stdout.buffer, close_fds=True) engine = Engine(input=p.stdout, output=p.stdin, serial_info=serial_info) assert engine.init_marker.file.endswith('write.c') assert engine.init_marker.line == 25 engine.write_byte(b'0') assert engine.read_byte() == b'9'
required=True, help='The root of the source directory') parser.add_argument('-I', '--include', nargs='+', help="Include folders for the preprocessor", default=[]) parser.add_argument('-D', '--define', nargs='+', help="Defines for the preprocessor", default=[]) args = parser.parse_args() serial_info = generate(args.binary, args.define, args.include, ['METAL_SERIAL_INIT_ARGV', 'METAL_SERIAL_TEST']) argv_ = [] class ArgvTest(MacroHook): identifier = 'METAL_SERIAL_TEST' def invoke(self, engine: Engine, macro_expansion: MacroExpansion): l = engine.read_int() global argv_ argv_ = [engine.read_string() for i in range(l)] def __init__(self): global argv_ argv_ = [] super().__init__()