Skip to content

CI: Enable failing on error #299

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions ci/test.xsh
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
#!/usr/bin/env xonsh
#
$RAISE_SUBPROC_ERROR = True
trace on

# Run some simple compilation tests, works everywhere:
src/bin/lpython --version
# Compile and link separately
Expand Down
4 changes: 2 additions & 2 deletions integration_tests/test_os.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from ltypes import i64
from os import (open, read, close)
from os import (open, read, close, O_RDONLY)

def test():
path: str
path = "integration_tests/test_os.py"
fd: i64
n: i64
fd = open(path, "r")
fd = open(path, O_RDONLY)
n = 100
print(read(fd, n))
close(fd)
Expand Down
16 changes: 14 additions & 2 deletions src/runtime/os.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
from ltypes import i32, i64, ccall

def open(path: str, flag: str) -> i64:
O_RDONLY: i32 # = 0 FIXME: Assign the value 0 to O_RDONLY
# O_WRONLY: i32 = 1
# O_RDWR : i32 = 2
# O_CREAT : i32 = 64
# O_APPEND: i32 = 1024


def open(path: str, flag: i32) -> i64:
"""
Returns the file descriptor for the newly opened file
"""
return _lpython_open(path, flag)
sflag: str
if flag == O_RDONLY:
sflag = "r"
else:
quit(1) # not implemented yet
return _lpython_open(path, sflag)

@ccall
def _lpython_open(path: str, flag: str) -> i64:
Expand Down