Allow to check explicit flags in assertflags.py

This commit is contained in:
Miro Hrončok 2024-08-01 14:57:45 +02:00
commit 800608da2e
2 changed files with 8 additions and 1 deletions

View file

@ -14,6 +14,9 @@ the last such option is the one that is effective."
import sys
import sysconfig
# We will check all flags if none were requested
KEYS_TO_CHECK = sys.argv[2:] or list(sysconfig.get_config_vars().keys())
# The flags that currently don't have the -Og flag on the debug build
# and we consider it OK, because we don't know any better :)
SKIP = [
@ -26,9 +29,10 @@ SKIP = [
print('Expecting that {} is the last -O flag:\n'.format(sys.argv[1]))
ret = 0
for key, flags in sysconfig.get_config_vars().items():
for key in KEYS_TO_CHECK:
if key in SKIP:
continue
flags = sysconfig.get_config_vars()[key]
if isinstance(flags, str):
oflags = [f for f in flags.split(' ') if f.startswith('-O')]
if oflags and oflags[-1] != sys.argv[1]:

View file

@ -69,6 +69,9 @@
- debugflags:
dir: flags
run: runuser testuser -c 'python3-debug ./assertflags.py -O0'
- debugflags_some:
dir: flags
run: runuser testuser -c 'python3-debug ./assertflags.py -O0 PY_STDMODULE_CFLAGS'
- marshalparser_compatibility:
dir: marshalparser
run: runuser testuser -c 'SAMPLE=10 test_marshalparser_compatibility.sh'