forked from Mirror/frr
tools/gcc-frr-format: improve test
Signed-off-by: David Lamparter <equinox@diac24.net>
This commit is contained in:
parent
05675eb32f
commit
555cc1001d
|
@ -82,6 +82,12 @@ int test(unsigned long long ay)
|
||||||
testfn("%Ld", v_pid_t); // WARN
|
testfn("%Ld", v_pid_t); // WARN
|
||||||
testfn("%Ld", v_uint64_t); // NOWARN
|
testfn("%Ld", v_uint64_t); // NOWARN
|
||||||
|
|
||||||
|
/* retain-typeinfo patch */
|
||||||
|
testfn("%zu", (size_t)v_pid_t); // NOWARN (need retain-typeinfo patch)
|
||||||
|
testfn("%lu", (size_t)v_pid_t); // WARN (need retain-typeinfo patch)
|
||||||
|
testfn("%Lu", (uint64_t)v_pid_t); // NOWARN (need retain-typeinfo patch)
|
||||||
|
testfn("%lu", (uint64_t)v_pid_t); // WARN (need retain-typeinfo patch)
|
||||||
|
|
||||||
testfn("%pI4", &v_long); // WARN
|
testfn("%pI4", &v_long); // WARN
|
||||||
|
|
||||||
in_addr_t v_in_addr_t;
|
in_addr_t v_in_addr_t;
|
||||||
|
|
|
@ -10,6 +10,10 @@ for k in list(os.environ.keys()):
|
||||||
if k.startswith('LC_'):
|
if k.startswith('LC_'):
|
||||||
os.environ.pop(k)
|
os.environ.pop(k)
|
||||||
|
|
||||||
|
if len(sys.argv) < 2:
|
||||||
|
sys.stderr.write('start as format-test.py gcc-123.45 [-options ...]\n')
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
c_re = re.compile(r'//\s+(NO)?WARN')
|
c_re = re.compile(r'//\s+(NO)?WARN')
|
||||||
expect = {}
|
expect = {}
|
||||||
lines = {}
|
lines = {}
|
||||||
|
@ -25,9 +29,9 @@ with open('format-test.c', 'r') as fd:
|
||||||
else:
|
else:
|
||||||
expect[lno] = 'nowarn'
|
expect[lno] = 'nowarn'
|
||||||
|
|
||||||
cmd = shlex.split('gcc -Wall -Wextra -Wno-unused -fplugin=./frr-format.so -fno-diagnostics-show-caret -c -o format-test.o format-test.c')
|
cmd = shlex.split('-Wall -Wextra -Wno-unused -fplugin=./frr-format.so -fno-diagnostics-show-caret -c -o format-test.o format-test.c')
|
||||||
|
|
||||||
gcc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
gcc = subprocess.Popen(sys.argv[1:] + cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
sout, serr = gcc.communicate()
|
sout, serr = gcc.communicate()
|
||||||
gcc.wait()
|
gcc.wait()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue