8000 bpo-36876: Add a tool that identifies unsupported global C variables. by ericsnowcurrently · Pull Request #15877 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-36876: Add a tool that identifies unsupported global C variables. #15877

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 118 commits into from
Sep 11, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
118 commits
Select commit Hold shift + click to select a range
9cdba01
Bootstrap the "c-statics" script under the test suite.
ericsnowcurrently Jun 21, 2019
cfdf57f
Stub out the "check" and "show" commands.
ericsnowcurrently Jun 22, 2019
716b13d
Add a README.
ericsnowcurrently Jun 22, 2019
ff1b447
Fix a filename.
ericsnowcurrently Jun 22, 2019
7e7d52d
Run the full check as part of the test suite.
ericsnowcurrently Jun 22, 2019
74d03d4
Frame out the functional tests.
ericsnowcurrently Jun 22, 2019
34d2c7c
Ignore the argparse output in tests.
ericsnowcurrently Jun 22, 2019
e8e2227
Move relevant tests to test_cg/.
ericsnowcurrently Jun 22, 2019
69541bf
Add StaticVar.
ericsnowcurrently Jun 22, 2019
cab1fc8
Add a fake find.statics().
ericsnowcurrently Jun 22, 2019
4bf5299
Add show.basic().
ericsnowcurrently Jun 22, 2019
c74360f
Implement cmd_show().
ericsnowcurrently Jun 22, 2019
b94833d
Add a note about the normalized vartype format.
ericsnowcurrently Jun 22, 2019
6fecaad
Do not run tests for find.statics() yet.
ericsnowcurrently Jun 22, 2019
8a53e69
Implement cmd_check().
ericsnowcurrently Jun 22, 2019
98d3737
Add scan.iter_statics().
ericsnowcurrently Jun 22, 2019
28e0f99
Add supported.is_supported().
ericsnowcurrently Jun 22, 2019 8000
1d6696c
Add find.statics().
ericsnowcurrently Jun 22, 2019
7e09aa4
Sort the output.
ericsnowcurrently Jun 23, 2019
265098d
Implement scan.iter_statics().
ericsnowcurrently Jun 23, 2019
ac70e2c
Add cg.files.iter_files().
ericsnowcurrently Jun 29, 2019
587907c
Add cg.info.Symbol.
ericsnowcurrently Jun 29, 2019
6ff136f
Properly handle local variables.
ericsnowcurrently Jun 29, 2019
9faeba9
Implement cg.parse.iter_variables().
ericsnowcurrently Jun 29, 2019
ae5c872
Start the implementation for iter_statements().
ericsnowcurrently Jul 1, 2019
0687e09
Deal with comments.
ericsnowcurrently Jul 1, 2019
a50aa32
Handle functions in iter_global_declarations().
ericsnowcurrently Jul 2, 2019
044a1f4
Implement basic variable support.
ericsnowcurrently Jul 2, 2019
c7833c1
Implement parse_func().
ericsnowcurrently Jul 2, 2019
2c164cd
Implement parse_var().
ericsnowcurrently Jul 2, 2019
84cd77e
Ignore files in Include/cpython.
ericsnowcurrently Jul 4, 2019
dc471a3
Rename the c-globals tool directory to be more generic.
ericsnowcurrently Jul 5, 2019
a9c27c5
Add imports_under_tool() CM.
ericsnowcurrently Jul 5, 2019
60dee31
Move the code under Tools (and the tests under test_tools).
ericsnowcurrently Jul 5, 2019
c0f1313
Split up the files properly.
ericsnowcurrently Jul 5, 2019
5410467
Factor out c_parser/{source,util}.py and c_symbols/local.py.
ericsnowcurrently Jul 5, 2019
caac1a9
Factor out preprocessor.py.
ericsnowcurrently Jul 5, 2019
928cc96
Factor out _NTBase.
ericsnowcurrently Jul 5, 2019
baf2bce
Add the wrapped_arg_combos() testing helper.
ericsnowcurrently Jul 10, 2019
57ec889
Add preprocessor.iter_lines().
ericsnowcurrently Jul 26, 2019
400b388
Remove line continuations and comments in preprocessor.iter_lines().
ericsnowcurrently Jul 27, 2019
13eb7b1
Fix minor formatting.
ericsnowcurrently Aug 2, 2019
182e3f9
Handle the "ignored" and "known" args to statics().
ericsnowcurrently Aug 2, 2019
ec88a4c
Factor out statics_from_symbols().
ericsnowcurrently Aug 2, 2019
a269b15
StaticVar -> Variable.
ericsnowcurrently Aug 2, 2019
842ef7c
Add statics_from_declarations().
ericsnowcurrently Aug 2, 2019
853768a
Track the per-variable preprocessor conditions.
ericsnowcurrently Aug 2, 2019
5f1b8b9
Add util.Slot (a descriptor).
ericsnowcurrently Aug 23, 2019
b850c05
Add util.classonly (a la classmethod).
ericsnowcurrently Aug 23, 2019
cde5b32
Add util._NOT_SET.
ericsnowcurrently Aug 23, 2019
11377dd
Add _NTBase.from_raw().
ericsnowcurrently Aug 23, 2019
acbedc7
Add info.ID.
ericsnowcurrently Aug 23, 2019
08310bf
Use ID in Symbol.
ericsnowcurrently Aug 23, 2019
1d5e9bf
Use ID in Variable.
ericsnowcurrently Aug 23, 2019
0c56fd9
Add a note about a "conditions" slot for info.ID.
ericsnowcurrently Aug 23, 2019
9563689
Require Variable to have filename set.
ericsnowcurrently Aug 23, 2019
7ad89b2
"???" means "unknown".
ericsnowcurrently Aug 23, 2019
2b2bc66
Make find_local_symbol() a "public" argument.
ericsnowcurrently Aug 24, 2019
1316a3b
Add info.ID.islocal.
ericsnowcurrently Aug 24, 2019
8000
4bdd9a6
Factor out c_analyzer_common package.
ericsnowcurrently Aug 24, 2019
5d52d9f
Move info.Symbol under c_symbols.
ericsnowcurrently Aug 24, 2019
d7d0d91
Do not allow Variable.id to have UNKNOWN in it.
ericsnowcurrently Aug 24, 2019
f662b63
Cache Variable.isstatic.
ericsnowcurrently Aug 24, 2019
e963103
Move known_from_file() to common/known.py.
ericsnowcurrently Aug 26, 2019
2cf6d6a
Add look_up_known_symbol() and symbols_to_variables().
ericsnowcurrently Aug 26, 2019
3d80342
Move files.py under common.
ericsnowcurrently Aug 26, 2019
d58c7c4
known_from_file() -> known.from_file().
ericsnowcurrently Aug 26, 2019
2fca1e7
Make dirnames optional.
ericsnowcurrently Aug 26, 2019
1e34a1a
Drop c_statics.scan.
ericsnowcurrently Aug 26, 2019
3f2e4f6
Implement known.from_file() and ignored_from_file().
ericsnowcurrently Aug 26, 2019
3e1657a
Fix REPO_ROOT.
ericsnowcurrently Aug 27, 2019
a2779b4
Various minor fixes to get to stable.
ericsnowcurrently Aug 27, 2019
89b887a
Add util.read_tsv() and util.write_tsv().
ericsnowcurrently Aug 27, 2019
89a02c3
Treat "-" in .tsv file as None.
ericsnowcurrently Aug 27, 2019
697ab59
Fix the statics_from_binary() tests.
ericsnowcurrently Aug 27, 2019
66a69c4
Add code to generate known.tsv.
ericsnowcurrently Aug 27, 2019
411aadd
Fix a typo in get_resolver().
ericsnowcurrently Aug 27, 2019
3bfb345
Fix a typo in _find_statics().
ericsnowcurrently Aug 27, 2019
9d731e7
Implement is_supported() (first pass).
ericsnowcurrently Aug 27, 2019
021be3c
Show the vartype in the basic output format.
ericsnowcurrently Aug 27, 2019
f620135
Use the underlying ID for the hash of Symbol and Variable.
ericsnowcurrently Aug 28, 2019
e7a029d
Move constants out of c_statics.__init__.
ericsnowcurrently Aug 28, 2019
b99c9f2
Fix a typo.
ericsnowcurrently Aug 28, 2019
3aeb32d
Clean up iter_files().
ericsnowcurrently Aug 28, 2019
8a97e50
Fix typos.
ericsnowcurrently Aug 31, 2019
51d5a19
Minor fix to find/resolve.
ericsnowcurrently Sep 2, 2019
19b9f97
Include ID in error message.
ericsnowcurrently Sep 2, 2019
a9c68c5
Add some "naive" parsing tools.
ericsnowcurrently Sep 2, 2019
2af6781
Expand the capability of the "known" generator.
ericsnowcurrently Sep 2, 2019
aa8495a
Update the "known" variables with generated values.
ericsnowcurrently Sep 2, 2019
921a465
Consider all known variables as static.
ericsnowcurrently Sep 2, 2019
48b2460
Distinguish "static" vars in output.
ericsnowcurrently Sep 3, 2019
c0a631b
Special-case variables named "id".
ericsnowcurrently Sep 6, 2019
3989a69
Fix a test.
ericsnowcurrently Sep 6, 2019
8118454
Print totals.
ericsnowcurrently Sep 6, 2019
cae5e3a
Fail if we couldn't find any of the symbols.
ericsnowcurrently Sep 6, 2019
87ebe87
Factor out _check_results().
ericsnowcurrently Sep 8, 2019
91e4fb1
Fill in gaps in known.tsv.
ericsnowcurrently Sep 8, 2019
21c4175
Mark _Py_IDENTIFIER() as unsupported.
ericsnowcurrently Sep 8, 2019
a245849
Keep "static" in output.
ericsnowcurrently Sep 8, 2019
1437d56
Fix a typo in __main__.py.
ericsnowcurrently Sep 8, 2019
8000
7feea9d
Honor provided dirnames.
ericsnowcurrently Sep 8, 2019
ae23801
Fix tests.
ericsnowcurrently Sep 8, 2019
26aaccb
Deal with default dirnames properly.
ericsnowcurrently Sep 8, 2019
4aaad5f
Supporting hiding objects in output.
ericsnowcurrently Sep 8, 2019
3d36cfc
Recognize more object types.
ericsnowcurrently Sep 8, 2019
b7420d5
Ignore known non-statics.
ericsnowcurrently Sep 8, 2019
da151a7
Always support "static const" (non-object) variables.
ericsnowcurrently Sep 9, 2019
6470eb1
"statics" -> "globals".
ericsnowcurrently Sep 9, 2019
1233cf9
Maybe limit the variables in known.tsv.
ericsnowcurrently Sep 10, 2019
fc6c97e
Generate the ignored.tsv file.
ericsnowcurrently Sep 10, 2019
6f8a223
Ignore variables with benign races.
ericsnowcurrently Sep 10, 2019
6c1db44
Mark more variables as PyObject.
ericsnowcurrently Sep 10, 2019
5888d48
Consider private, non-static globals.
ericsnowcurrently Sep 11, 2019
cdeb1d9
Update ignored global variables.
ericsnowcurrently Sep 11, 2019
569c57e
Skip the check where "nm" isn't available.
ericsnowcurrently Sep 11, 2019
7b0745f
Ignore REPL-related variables.
ericsnowcurrently Sep 12, 2019
b5dd31b
Fix whitespace.
ericsnowcurrently Sep 11, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Run the full check as part of the test suite.
  • Loading branch information
ericsnowcurrently committed Sep 11, 2019
commit 7e7d52dfd2a8cbf8ed4fc0658a23f169d63c028b
1 change: 1 addition & 0 deletions Lib/test/test_c_statics/cg/__main__.py 8000
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ def check(cmd, dirs=SOURCE_DIRS, *, ignored=IGNORED_FILE, known=KNOWN_FILE):
In the failure case, the list of unsupported variables
will be printed out.
"""
raise NotImplementedError


def show(cmd, dirs=SOURCE_DIRS, *, ignored=IGNORED_FILE, known=KNOWN_FILE):
Expand Down
16 changes: 16 additions & 0 deletions Lib/test/test_c_statics/test_check_c_statics.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import unittest

from .cg.__main__ import main


class ActualChecks(unittest.TestCase):

# XXX Also run the check in "make check".
@unittest.expectedFailure
def test_check_c_statics(self):
main('check', {})


if __name__ == '__main__':
# Test needs to be a package, so we can do relative imports.
unittest.main()
0