From 843ab45e15f66fa136647c5ba1dff6410de00e57 Mon Sep 17 00:00:00 2001 From: Erik Carstensen Date: Mon, 22 Dec 2025 19:20:37 +0100 Subject: [PATCH] Add dml-breaking-changes.yaml file to be used by cmake --- MODULEINFO | 1 + cmake/simics/dml-breaking-changes.yaml | 43 ++++++++++++++++++++++++++ test/tests.py | 33 ++++++++++++++++++++ 3 files changed, 77 insertions(+) create mode 100644 cmake/simics/dml-breaking-changes.yaml diff --git a/MODULEINFO b/MODULEINFO index 1b18318a..f9828ae5 100644 --- a/MODULEINFO +++ b/MODULEINFO @@ -91,6 +91,7 @@ Make: dmlc @dml-1.2-reference-manual @dml-1.4-reference-manual @dmlc-py + [src/tools/dmlc/]cmake/simics/dml-breaking-changes.yaml Group: dmlc-lib Require-tokens: public diff --git a/cmake/simics/dml-breaking-changes.yaml b/cmake/simics/dml-breaking-changes.yaml new file mode 100644 index 00000000..d5acae47 --- /dev/null +++ b/cmake/simics/dml-breaking-changes.yaml @@ -0,0 +1,43 @@ +# consumed by cmake, prefixed with "dml:" +forbid-broken-unused-types: + opt-in: [4, 5, 6, 7] +forbid-broken-conditional-is: + opt-in: [4, 5, 6, 7] +remove-port-proxy-ifaces: + opt-in: [4, 5, 6, 7] +remove-port-proxy-attrs: + opt-in: [4, 5, 6, 7] +forbid-function-in-extern-struct: + opt-in: [4, 5, 6, 7] +require-version-statement: + opt-in: [4, 5, 6, 7] +transaction-by-default: + opt-in: [4, 5, 6] +port-obj-param: + opt-in: [4, 5] +shared-logs-locally: + opt-in: [4, 5, 6] +enable-WLOGMIXUP: + opt-in: [4, 5, 6] +modern-attributes: + opt-in: [4, 5, 6, 7] +strict-typechecking: + opt-in: [4, 5, 6, 7] +range-check-method-indices: + opt-in: [4, 5, 6, 7] +restrict-log-levels: + opt-in: [4, 5, 6, 7] +dml12-disable-inline-constants: + opt-in: [4, 5, 6] +dml12-not-typecheck: + opt-in: [4, 5] +dml12-remove-misc-quirks: + opt-in: [4, 5, 6] +dml12-remove-goto: + opt-in: [4, 5, 6] +dml12-modern-int: + opt-in: [4, 5, 6] +vect-needs-provisional: + opt-in: [4, 5, 6, 7] +forbid-warning-statement: + opt-in: [4, 5, 6, 7] diff --git a/test/tests.py b/test/tests.py index 862b1039..e5ee9051 100644 --- a/test/tests.py +++ b/test/tests.py @@ -17,6 +17,7 @@ from typing import Optional import glob import json +import yaml from simicsutils.host import host_type, is_windows, batch_suffix from simicsutils.internal import get_simics_major import testparams @@ -32,6 +33,7 @@ def project_host_path(): sys.path.append(join(project_host_path(), 'bin', 'dml', 'python')) import dml.globals +import dml.breaking_changes import dead_dml_methods from dead_dml_methods import line_directive_re @@ -1894,6 +1896,8 @@ def test(self): 'lib-old-4.8/1.2/LICENSE', # file listing 'MODULEINFO', + # data file + 'cmake/simics/dml-breaking-changes', # essentially data files 'doc/1.2/toc.json', 'doc/1.4/toc.json', @@ -1940,6 +1944,35 @@ def test(self): all_tests.append(CopyrightTestCase('copyright')) +class CMakeTestCase(BaseTestCase): + __slots__ = () + def test(self): + file = (Path(__file__).parent.parent / 'cmake' / 'simics' + / 'dml-breaking-changes.yaml') + changes_in_cmake = sorted( + (tag, tuple(bc['opt-in']), tuple(bc.get('opt-out', []))) + for (tag, bc) in yaml.safe_load(file.read_text()).items()) + for (tag, opt_in, opt_out) in changes_in_cmake: + apis = opt_in + opt_out + if apis != tuple( + api.ordinal for api in dml.breaking_changes.apis.values())[ + :len(apis)]: + raise TestFail('versions not well-ordered: {opt_in}, {opt_out}') + changes_in_dmlc = sorted( + (tag, + tuple(api.ordinal for api in dml.breaking_changes.apis.values() + if api <= change.required_after), + ()) + for (tag, change) in dml.breaking_changes.changes.items()) + if (changes_in_cmake != changes_in_dmlc): + self.pr(f"changes only in {file}: " + str( + set(changes_in_cmake) - set(changes_in_dmlc))) + self.pr(f"changes only in breaking_changes.py: " + str( + set(changes_in_dmlc) - set(changes_in_cmake))) + raise TestFail(f'mismatch') + +all_tests.append(CMakeTestCase('cmake')) + # Device info XML generation works for version in ['1.2', '1.4']: testname = '%s-devinfo-generate' % (version,)