From 800608da2ebbf1f5c2dd387a585c7764622aff69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Thu, 1 Aug 2024 14:57:45 +0200 Subject: [PATCH] Allow to check explicit flags in assertflags.py --- flags/assertflags.py | 6 +++++- tests.yml | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/flags/assertflags.py b/flags/assertflags.py index c7f0b08..6b15d2c 100644 --- a/flags/assertflags.py +++ b/flags/assertflags.py @@ -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]: diff --git a/tests.yml b/tests.yml index 2e96f16..c321f7e 100644 --- a/tests.yml +++ b/tests.yml @@ -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'