Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
typon-compiler
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
typon
typon-compiler
Commits
9104072b
Commit
9104072b
authored
Nov 02, 2023
by
Tom Niget
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add extension support to test runner
parent
c375d2bb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
5 deletions
+11
-5
typon/trans/.env.example
typon/trans/.env.example
+2
-1
typon/trans/test_runner.py
typon/trans/test_runner.py
+9
-4
No files found.
typon/trans/.env.example
View file @
9104072b
ALT_RUNNER='(clang++-16 -O3 -Wno-deprecated-declarations -Wno-return-type -Wno-unused-result -std=c++20 $(python3 __main__.py --cpp-flags) -o {name_bin} {name_cpp_posix} || exit 2) && ({run_file} || exit 0) && ({name_bin} || exit 3)'
\ No newline at end of file
ALT_RUNNER='(clang++-16 -O3 -Wno-deprecated-declarations -Wno-return-type -Wno-unused-result -std=c++20 $(python3 __main__.py --cpp-flags) -o {name_bin} {name_cpp_posix} || exit 2) && ({run_file} || exit 0) && ({test_exec} || exit 3)'
# don't use Windows SSH client
\ No newline at end of file
typon/trans/test_runner.py
View file @
9104072b
...
...
@@ -66,7 +66,7 @@ def run_test(path, quiet=True):
if
quiet
:
sys
.
stdout
=
open
(
path
.
with_suffix
(
".out"
),
'w'
)
sys
.
stderr
=
open
(
path
.
with_suffix
(
".err"
),
'w'
)
print
(
path
.
name
)
print
(
"** Running"
,
path
)
if
path
.
name
.
startswith
(
'_'
):
print
(
"Skipping"
)
return
TestStatus
.
SKIPPED
...
...
@@ -84,15 +84,20 @@ def run_test(path, quiet=True):
name_cpp
=
path
.
with_suffix
(
'.cpp'
)
with
open
(
name_cpp
,
"w"
,
encoding
=
"utf-8"
)
as
fcpp
:
fcpp
.
write
(
res
)
print
(
".cpp generated"
)
if
args
.
compile
:
return
TestStatus
.
SUCCESS
execute_str
=
"true"
if
(
execute
and
not
args
.
generate
)
else
"false"
name_bin
=
path
.
with_suffix
(
''
).
as_posix
(
)
name_bin
=
path
.
with_suffix
(
""
).
as_posix
()
+
(
"$(python3-config --extension-suffix)"
if
extension
else
".exe"
)
if
exec_cmd
(
f'bash -c "export PYTHONPATH=stdlib; if
{
execute_str
}
; then python3 ./
{
path
.
as_posix
()
}
; fi"'
)
!=
0
:
return
TestStatus
.
PYTHON_ERROR
if
compile
and
(
alt
:
=
environ
.
get
(
"ALT_RUNNER"
)):
if
(
code
:
=
exec_cmd
(
alt
.
format
(
name_bin
=
name_bin
,
name_cpp_posix
=
name_cpp
.
as_posix
(),
run_file
=
execute_str
)))
!=
0
:
if
(
code
:
=
exec_cmd
(
alt
.
format
(
name_bin
=
name_bin
,
name_cpp_posix
=
name_cpp
.
as_posix
(),
run_file
=
execute_str
,
test_exec
=
f"python3
{
path
.
with_suffix
(
'.post.py'
).
as_posix
()
}
"
if
extension
else
name_bin
,
bonus_flags
=
"-e"
if
extension
else
""
)))
!=
0
:
return
TestStatus
(
code
)
else
:
print
(
"no ALT_RUNNER"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment