mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-12-16 12:24:29 +03:00
scripts: Adapt mock-noinline.py to ATTRIBUTE_MOCKABLE
The script is renamed to mockable-attribute.py and adjusted to check for the new attribute. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
@@ -1326,9 +1326,9 @@ sc_spacing-check:
|
|||||||
$(PERL) $(top_srcdir)/build-aux/check-spacing.pl || \
|
$(PERL) $(top_srcdir)/build-aux/check-spacing.pl || \
|
||||||
{ echo 'incorrect formatting' 1>&2; exit 1; }
|
{ echo 'incorrect formatting' 1>&2; exit 1; }
|
||||||
|
|
||||||
sc_mock-noinline:
|
sc_mockable-attribute:
|
||||||
$(AM_V_GEN)$(VC_LIST_EXCEPT) | $(GREP) '\.[ch]$$' | $(RUNUTF8) \
|
$(AM_V_GEN)$(VC_LIST_EXCEPT) | $(GREP) '\.[ch]$$' | $(RUNUTF8) \
|
||||||
$(PYTHON) $(top_srcdir)/scripts/mock-noinline.py
|
$(PYTHON) $(top_srcdir)/scripts/mockable-attribute.py
|
||||||
|
|
||||||
sc_header-ifdef:
|
sc_header-ifdef:
|
||||||
$(AM_V_GEN)$(VC_LIST_EXCEPT) | $(GREP) '\.[h]$$' | $(RUNUTF8) xargs \
|
$(AM_V_GEN)$(VC_LIST_EXCEPT) | $(GREP) '\.[h]$$' | $(RUNUTF8) xargs \
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ scripts = [
|
|||||||
'meson-install-web.py',
|
'meson-install-web.py',
|
||||||
'meson-python.sh',
|
'meson-python.sh',
|
||||||
'meson-timestamp.py',
|
'meson-timestamp.py',
|
||||||
'mock-noinline.py',
|
'mockable-attribute.py',
|
||||||
'prohibit-duplicate-header.py',
|
'prohibit-duplicate-header.py',
|
||||||
'qemu-replies-tool.py',
|
'qemu-replies-tool.py',
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
#
|
#
|
||||||
# Copyright (C) 2017-2019 Red Hat, Inc.
|
# Copyright (C) 2017-2025 Red Hat, Inc.
|
||||||
#
|
#
|
||||||
# This library is free software; you can redistribute it and/or
|
# This library is free software; you can redistribute it and/or
|
||||||
# modify it under the terms of the GNU Lesser General Public
|
# modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -22,7 +22,7 @@ import sys
|
|||||||
noninlined = {}
|
noninlined = {}
|
||||||
mocked = {}
|
mocked = {}
|
||||||
|
|
||||||
# Functions in public header don't get the noinline annotation
|
# Functions in public header don't get the noipa annotation
|
||||||
noninlined["virEventAddTimeout"] = True
|
noninlined["virEventAddTimeout"] = True
|
||||||
# This one confuses the script as its defined in the mock file
|
# This one confuses the script as its defined in the mock file
|
||||||
# but is actually just a local helper
|
# but is actually just a local helper
|
||||||
@@ -43,7 +43,7 @@ def scan_annotations(filename):
|
|||||||
elif line.isspace():
|
elif line.isspace():
|
||||||
func = None
|
func = None
|
||||||
|
|
||||||
if "G_NO_INLINE" in line:
|
if "ATTRIBUTE_MOCKABLE" in line:
|
||||||
if func is not None:
|
if func is not None:
|
||||||
noninlined[func] = True
|
noninlined[func] = True
|
||||||
|
|
||||||
@@ -74,7 +74,7 @@ warned = False
|
|||||||
for func in mocked.keys():
|
for func in mocked.keys():
|
||||||
if func not in noninlined:
|
if func not in noninlined:
|
||||||
warned = True
|
warned = True
|
||||||
print("%s is mocked at %s but missing 'G_NO_INLINE' annotation" %
|
print("%s is mocked at %s but missing 'ATTRIBUTE_MOCKABLE' annotation" %
|
||||||
(func, mocked[func]), file=sys.stderr)
|
(func, mocked[func]), file=sys.stderr)
|
||||||
|
|
||||||
if warned:
|
if warned:
|
||||||
Reference in New Issue
Block a user