Skip to content

Commit b41fc06

Browse files
committed
Add tests for all _compat_* params
This lets us use whatever hardcoded isolated one-time hacks to preserve their legacy behaviour
1 parent b2a137a commit b41fc06

File tree

8 files changed

+208
-0
lines changed

8 files changed

+208
-0
lines changed

test/1.4/legacy/no_compat.dml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/*
2+
© 2025 Intel Corporation
3+
SPDX-License-Identifier: MPL-2.0
4+
*/
5+
6+
dml 1.4;
7+
8+
// Test that the legacy compat params still work: For each API,
9+
// we partition the set of compat features for that version
10+
// in two sets A and B, each set explicitly disabled by one
11+
// of the tests of that API.
12+
13+
param enabled_5a;
14+
param enabled_5b;
15+
param enabled_6a;
16+
param enabled_6b;
17+
param enabled_7a;
18+
param enabled_7b;
19+
20+
#if (_compat_dml12_not != enabled_5a
21+
// disabled in DML 1.4, which the 6 test cases use
22+
|| _compat_dml12_misc != enabled_5a) {
23+
error;
24+
}
25+
26+
#if (_compat_port_obj_param != enabled_5b
27+
// disabled in DML 1.4, which the 6 test cases use
28+
|| _compat_dml12_inline != enabled_5b) {
29+
error;
30+
}
31+
32+
#if (_compat_dml12_int != enabled_6a
33+
|| _compat_dml12_goto != enabled_6a
34+
|| _compat_io_memory != enabled_6a) {
35+
error;
36+
}
37+
38+
#if (_compat_shared_logs_on_device != enabled_6b
39+
|| _compat_suppress_WLOGMIXUP != enabled_6b) {
40+
error;
41+
}
42+
43+
#if (_compat_broken_conditional_is != enabled_7a
44+
|| _compat_broken_unused_types != enabled_7a
45+
|| _compat_no_method_index_asserts != enabled_7a
46+
|| _compat_warning_statement != enabled_7a
47+
|| _compat_lenient_typechecking != enabled_7a
48+
|| _compat_port_proxy_ifaces != enabled_7a) {
49+
error;
50+
}
51+
52+
#if (_compat_function_in_extern_struct != enabled_7b
53+
|| _compat_port_proxy_attrs != enabled_7b
54+
|| _compat_meaningless_log_levels != enabled_7b
55+
|| _compat_optional_version_statement != enabled_7b
56+
|| _compat_experimental_vect != enabled_7b
57+
|| _compat_legacy_attributes != enabled_7b) {
58+
error;
59+
}

test/1.4/legacy/no_compat_5a.dml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
© 2025 Intel Corporation
3+
SPDX-License-Identifier: MPL-2.0
4+
*/
5+
6+
// 1.2 because some compat features are auto-disabled in DML 1.4
7+
dml 1.2;
8+
9+
device test;
10+
11+
/// COMPILE-ONLY
12+
/// DMLC-FLAG --no-compat=dml12_not,dml12_misc
13+
14+
import "no_compat.dml";
15+
16+
parameter enabled_5a = false;
17+
parameter enabled_5b = true;
18+
parameter enabled_6a = true;
19+
parameter enabled_6b = true;
20+
parameter enabled_7a = true;
21+
parameter enabled_7b = true;

test/1.4/legacy/no_compat_5b.dml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
© 2025 Intel Corporation
3+
SPDX-License-Identifier: MPL-2.0
4+
*/
5+
6+
// 1.2 because some compat features are auto-disabled in DML 1.4
7+
dml 1.2;
8+
9+
device test;
10+
11+
/// COMPILE-ONLY
12+
/// DMLC-FLAG --no-compat=port_obj_param,dml12_inline
13+
14+
import "no_compat.dml";
15+
16+
parameter enabled_5a = true;
17+
parameter enabled_5b = false;
18+
parameter enabled_6a = true;
19+
parameter enabled_6b = true;
20+
parameter enabled_7a = true;
21+
parameter enabled_7b = true;

test/1.4/legacy/no_compat_6a.dml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
© 2025 Intel Corporation
3+
SPDX-License-Identifier: MPL-2.0
4+
*/
5+
6+
dml 1.4;
7+
8+
device test;
9+
10+
/// COMPILE-ONLY
11+
/// DMLC-FLAG --no-compat=dml12_int,dml12_goto,io_memory
12+
13+
import "no_compat.dml";
14+
15+
param enabled_5a = false;
16+
param enabled_5b = false;
17+
param enabled_6a = false;
18+
param enabled_6b = true;
19+
param enabled_7a = true;
20+
param enabled_7b = true;

test/1.4/legacy/no_compat_6b.dml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
© 2025 Intel Corporation
3+
SPDX-License-Identifier: MPL-2.0
4+
*/
5+
6+
dml 1.4;
7+
8+
device test;
9+
10+
/// COMPILE-ONLY
11+
/// DMLC-FLAG --no-compat=shared_logs_on_device,suppress_WLOGMIXUP
12+
13+
import "no_compat.dml";
14+
15+
param enabled_5a = false;
16+
param enabled_5b = false;
17+
param enabled_6a = true;
18+
param enabled_6b = false;
19+
param enabled_7a = true;
20+
param enabled_7b = true;

test/1.4/legacy/no_compat_7a.dml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
© 2025 Intel Corporation
3+
SPDX-License-Identifier: MPL-2.0
4+
*/
5+
6+
dml 1.4;
7+
8+
device test;
9+
10+
/// COMPILE-ONLY
11+
/// DMLC-FLAG --no-compat=broken_conditional_is,broken_unused_types,no_method_index_asserts,warning_statement,lenient_typechecking,port_proxy_ifaces
12+
13+
import "no_compat.dml";
14+
15+
param enabled_5a = false;
16+
param enabled_5b = false;
17+
param enabled_6a = false;
18+
param enabled_6b = false;
19+
param enabled_7a = false;
20+
param enabled_7b = true;

test/1.4/legacy/no_compat_7b.dml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
© 2025 Intel Corporation
3+
SPDX-License-Identifier: MPL-2.0
4+
*/
5+
6+
dml 1.4;
7+
8+
device test;
9+
10+
/// COMPILE-ONLY
11+
/// DMLC-FLAG --no-compat=function_in_extern_struct,port_proxy_attrs,meaningless_log_levels,optional_version_statement,experimental_vect,legacy_attributes
12+
13+
import "no_compat.dml";
14+
15+
param enabled_5a = false;
16+
param enabled_5b = false;
17+
param enabled_6a = false;
18+
param enabled_6b = false;
19+
param enabled_7a = true;
20+
param enabled_7b = false;

test/tests.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1090,6 +1090,33 @@ def run_cc(self, cc_extraargs):
10901090
["1.2", "errors", "WREF"],
10911091
join(testdir, "1.2", "errors", "WREF.dml"),
10921092
api_version="5"))
1093+
all_tests.append(CTestCase(
1094+
["1.4", "legacy", "no_compat_5a"],
1095+
join(testdir, "1.4", "legacy", "no_compat_5a.dml"),
1096+
api_version="5"))
1097+
all_tests.append(CTestCase(
1098+
["1.4", "legacy", "no_compat_5b"],
1099+
join(testdir, "1.4", "legacy", "no_compat_5b.dml"),
1100+
api_version="5"))
1101+
1102+
all_tests.append(CTestCase(
1103+
["1.4", "legacy", "no_compat_6a"],
1104+
join(testdir, "1.4", "legacy", "no_compat_6a.dml"),
1105+
api_version="6"))
1106+
all_tests.append(CTestCase(
1107+
["1.4", "legacy", "no_compat_6b"],
1108+
join(testdir, "1.4", "legacy", "no_compat_6b.dml"),
1109+
api_version="6"))
1110+
if get_simics_major() != "6":
1111+
# API=7 not possible in 6
1112+
all_tests.append(CTestCase(
1113+
["1.4", "legacy", "no_compat_7a"],
1114+
join(testdir, "1.4", "legacy", "no_compat_7a.dml"),
1115+
api_version="7"))
1116+
all_tests.append(CTestCase(
1117+
["1.4", "legacy", "no_compat_7b"],
1118+
join(testdir, "1.4", "legacy", "no_compat_7b.dml"),
1119+
api_version="7"))
10931120

10941121
if get_simics_major() == "7":
10951122
all_tests.append(CTestCase(

0 commit comments

Comments
 (0)