Skip to content

Commit 345b873

Browse files
authored
Merge pull request #299 from certik/ci_fail
CI: Enable failing on error
2 parents 7d250c7 + d427bc4 commit 345b873

File tree

3 files changed

+21
-4
lines changed

3 files changed

+21
-4
lines changed

ci/test.xsh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
#!/usr/bin/env xonsh
2+
#
3+
$RAISE_SUBPROC_ERROR = True
4+
trace on
5+
16
# Run some simple compilation tests, works everywhere:
27
src/bin/lpython --version
38
# Compile and link separately

integration_tests/test_os.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
from ltypes import i64
2-
from os import (open, read, close)
2+
from os import (open, read, close, O_RDONLY)
33

44
def test():
55
path: str
66
path = "integration_tests/test_os.py"
77
fd: i64
88
n: i64
9-
fd = open(path, "r")
9+
fd = open(path, O_RDONLY)
1010
n = 100
1111
print(read(fd, n))
1212
close(fd)

src/runtime/os.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,22 @@
11
from ltypes import i32, i64, ccall
22

3-
def open(path: str, flag: str) -> i64:
3+
O_RDONLY: i32 # = 0 FIXME: Assign the value 0 to O_RDONLY
4+
# O_WRONLY: i32 = 1
5+
# O_RDWR : i32 = 2
6+
# O_CREAT : i32 = 64
7+
# O_APPEND: i32 = 1024
8+
9+
10+
def open(path: str, flag: i32) -> i64:
411
"""
512
Returns the file descriptor for the newly opened file
613
"""
7-
return _lpython_open(path, flag)
14+
sflag: str
15+
if flag == O_RDONLY:
16+
sflag = "r"
17+
else:
18+
quit(1) # not implemented yet
19+
return _lpython_open(path, sflag)
820

921
@ccall
1022
def _lpython_open(path: str, flag: str) -> i64:

0 commit comments

Comments
 (0)