demumble_test.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 from __future__ import print_function
3 import os, re, subprocess, sys
4 
5 tests = [
6  ('demumble hello', 'hello\n'),
7  ('demumble _Z4funcPci _Z1fv', 'func(char*, int)\nf()\n'),
8  ('demumble < _Z4funcPci _Z1fv', 'func(char*, int)\nf()\n'),
9  ('demumble ?Fx_i@@YAHP6AHH@Z@Z', 'int __cdecl Fx_i(int (__cdecl*)(int))\n'),
10  ('demumble __Znwi', 'operator new(int)\n'), # Strip extra _ (for OS X)
11  ('demumble < __Znwi', 'operator new(int)\n'), # Also from stdin
12  ('demumble -m hi _Z1fv ho _Z1gv', 'hi\nf()\nho\ng()\n'),
13  ('demumble -m < hi_ho _Z1fv ho _Z1gv ?hm', 'f()\ng()\n?hm\n'),
14  ('demumble -m < _Z1fv!_Z1gv', 'f()\ng()\n'),
15  ('demumble -m < _Z1fv!foo_bar', 'f()\n'),
16  ('demumble Pi', 'int*\n'),
17  ('demumble < Pi', 'Pi\n'),
18  ('demumble < ___Z10blocksNRVOv_block_invoke',
19  'invocation function for block in blocksNRVO()\n'),
20  ('demumble < .____Z10blocksNRVOv_block_invoke',
21  '.invocation function for block in blocksNRVO()\n'),
22  ('demumble -m < .____Z10blocksNRVOv_block_invoke',
23  'invocation function for block in blocksNRVO()\n'),
24  ('demumble -- -m', '-m\n'),
25  ('demumble -- -h', '-h\n'),
26  ('demumble -h', re.compile('.*usage: demumble.*')),
27  ('demumble --help', re.compile('.*usage: demumble.*')),
28  ('demumble --version', re.compile('.*\..*')),
29 ]
30 
31 status = 0
32 for t in tests:
33  cmd = t[0].split()
34  # Assume that demumble is next to this script.
35  cmd[0] = os.path.join(os.path.dirname(__file__) or '.', cmd[0])
36  if '<' in cmd:
37  p = subprocess.Popen(cmd[:cmd.index('<')], stdin=subprocess.PIPE,
38  stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
39  universal_newlines=True)
40  out = p.communicate(input='\n'.join(cmd[cmd.index('<') + 1:]) + '\n')[0]
41  else:
42  out = subprocess.check_output(cmd, universal_newlines=True)
43  if (out != t[1] if isinstance(t[1], str) else t[1].match(out, re.M)):
44  print("`%s`: Expected '%s', got '%s'" % (t[0], t[1], out))
45  status = 1
46 print("passed" if status == 0 else "failed")
47 sys.exit(status)
match
unsigned char match[65280+2]
Definition: bloaty/third_party/zlib/examples/gun.c:165
split
static void split(const char *s, char ***ss, size_t *ns)
Definition: debug/trace.cc:111


grpc
Author(s):
autogenerated on Thu Mar 13 2025 02:59:04