Castle: The best Real-Time/Embedded/HighTech language EVER. Attempt 2
Révision | 9e8d9a7552ae4d80974ef529f8d95730eb6d69c9 (tree) |
---|---|
l'heure | 2023-02-11 08:25:45 |
Auteur | Albert Mietus < albert AT mietus DOT nl > |
Commiter | Albert Mietus < albert AT mietus DOT nl > |
asis
@@ -36,7 +36,9 @@ | ||
36 | 36 | elif self.type is None: |
37 | 37 | return "NULL" |
38 | 38 | else: |
39 | + from warnings import warn | |
39 | 40 | tn = self.type if isinstance(self.type, str) else self.type.__name__ |
41 | + warn(f"Using string (or other non CC_Base types) port.types (for >>{tn}<<) is not wise", DeprecationWarning, stacklevel=2) | |
40 | 42 | return f'&cc_P_{tn}' |
41 | 43 | |
42 | 44 |
@@ -7,6 +7,10 @@ | ||
7 | 7 | import logging; logger = logging.getLogger(__name__) |
8 | 8 | import pytest |
9 | 9 | |
10 | +from pathlib import Path | |
11 | +import os | |
12 | +import subprocess | |
13 | + | |
10 | 14 | |
11 | 15 | from castle.writers.CC2Cpy.Protocol import * |
12 | 16 | from castle.writers.CC2Cpy.Event import * |
@@ -43,11 +47,6 @@ | ||
43 | 47 | ) |
44 | 48 | |
45 | 49 | |
46 | -from pathlib import Path | |
47 | -from tempfile import TemporaryDirectory | |
48 | -import os | |
49 | -import subprocess | |
50 | - | |
51 | 50 | |
52 | 51 | def write_header(f): |
53 | 52 | f.writelines("""/*(C) Alber Mietus, Generated code*/ |
@@ -57,8 +56,9 @@ | ||
57 | 56 | """) |
58 | 57 | |
59 | 58 | def verify_it_compiles(file, in_dir:Path): |
59 | + print(f"Compiling {file}") | |
60 | 60 | os.symlink("/Users/albert/work/CCastle2/from_CC-Castle/SRC-EXAMPLE/SIEVE/2.GCD-work/CC", in_dir/"CC") |
61 | - return_code = subprocess.run(["gcc", "-I", in_dir, "-c", file]).returncode | |
61 | + return_code = subprocess.run(["cc", "-arch", "x86_64", "-arch", "arm64", "-I", in_dir, "-c", file], cwd=in_dir).returncode | |
62 | 62 | assert return_code == 0 |
63 | 63 | |
64 | 64 |
@@ -69,7 +69,7 @@ | ||
69 | 69 | f.write(sieveInterface.render()) |
70 | 70 | verify_it_compiles(f.name, tmp_path) |
71 | 71 | |
72 | -@pytest.mark.skip(reason="sieveClass refer to ``cc_B_Sieve_methods`` and ``CC_C_Sieve`` which aren't renderable yet") | |
72 | +#@pytest.mark.skip(reason="sieveClass refer to ``cc_B_Sieve_methods`` and ``CC_C_Sieve`` which aren't renderable yet") | |
73 | 73 | def test_0b(simpleSieve, sieveInterface, sieveClass, tmp_path): |
74 | 74 | with open(tmp_path/"sieve-interface.c", 'w') as f: |
75 | 75 | write_header(f) |
@@ -77,7 +77,7 @@ | ||
77 | 77 | f.write(sieveInterface.render()) |
78 | 78 | f.write(sieveClass.render()) |
79 | 79 | verify_it_compiles(f.name, tmp_path) |
80 | - | |
80 | + | |
81 | 81 | |
82 | 82 | @pytest.mark.skip(reason="More Generate C-file(s)") |
83 | 83 | def test_more(): pass |