Skip to content

Commit 8774180

Browse files
authored
Merge pull request #17 from polyphony-dev/devel
version 0.4.0
2 parents 657c5c7 + 3e20121 commit 8774180

590 files changed

Lines changed: 23026 additions & 18668 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.flake8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[flake8]
22
ignore = H101,H301,H304,H306,E221,E231,E241,E265,F403,F405,W503,W504
3-
max-line-length = 99
3+
max-line-length = 120

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
.gitignore
2+
.*/
3+
.*
24
__pycache__
35
debug*
4-
tmp/
56
out/
67
.suite_ignores

.suite_ignores

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
io/connect01.py
2+
io/connect02.py
3+
io/connect03.py
4+
io/connect04.py
5+
io/flipped01.py
6+
io/flipped02.py
7+
io/flipped03.py
8+
io/flipped04.py
9+
io/thru01.py
10+
io/thru02.py

error.py

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
sys.path.append(ROOT_DIR)
1515

1616
from polyphony.compiler.__main__ import compile_main, logging_setting
17-
from polyphony.compiler.env import env
17+
from polyphony.compiler.common.env import env
1818

1919

2020
def parse_options():
@@ -26,13 +26,20 @@ def parse_options():
2626
parser.add_argument('-d', '--enable_debug', dest='debug_mode',
2727
action='store_true', help='enable debug mode')
2828
parser.add_argument('-w', dest='warn_test', action='store_true')
29+
parser.add_argument('-p', dest='with_path_name', action='store_true')
2930
parser.add_argument('source', help='Python source file')
3031
return parser.parse_args()
3132

3233

33-
def make_compile_options(casename, err_options, quiet_level):
34+
def make_compile_options(casename, casefile_path, err_options, quiet_level):
3435
options = types.SimpleNamespace()
3536
options.config = err_options.config
37+
if err_options.with_path_name:
38+
p, _ = os.path.splitext(casefile_path)
39+
options.output_prefix = p.replace('.', '').replace(os.path.sep, '_')
40+
casename = f'{options.output_prefix}_{casename}'
41+
else:
42+
options.output_prefix = ''
3643
options.output_name = casename
3744
options.output_dir = TMP_DIR
3845
options.verbose_level = 0
@@ -52,7 +59,7 @@ def error_test(casefile_path, err_options):
5259
print('The file is not error test file')
5360
sys.exit(0)
5461
expected_msg = first_line.split('#')[1].rstrip('\n')
55-
options = make_compile_options(casename, err_options, env.QUIET_ERROR)
62+
options = make_compile_options(casename, casefile_path, err_options, env.QUIET_ERROR)
5663
try:
5764
compile_main(casefile_path, options)
5865
except AssertionError:
@@ -81,13 +88,17 @@ def warn_test(casefile_path, err_options):
8188
expected_msg = first_line.split('#')[1].rstrip('\n')
8289
f = io.StringIO()
8390
err_options.debug_mode = False
84-
options = make_compile_options(casename, err_options, 0)
91+
options = make_compile_options(casename, casefile_path, err_options, 0)
92+
stopped = False
8593
with redirect_stdout(f):
8694
try:
8795
compile_main(casefile_path, options)
8896
except Exception as e:
89-
print(casefile_path)
90-
print('[WARNING TEST] FAILED')
97+
stopped = True
98+
if stopped:
99+
print(casefile_path)
100+
print('[WARNING TEST] FAILED: Compilation has stopped')
101+
return False
91102
msg = f.getvalue()
92103
#print(msg)
93104
header = 'Warning: '

0 commit comments

Comments
 (0)