Skip to content

Commit 299a31d

Browse files
authored
Merge pull request #1296 from melted/windows_ci_test
add tests to Windows CI
2 parents 2287a7f + 473b8ee commit 299a31d

File tree

8 files changed

+37
-33
lines changed

8 files changed

+37
-33
lines changed

.github/workflows/ci-windows.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,4 @@ jobs:
4545
run: |
4646
scheme --version
4747
- name: Bootstrap and install
48-
run: c:\msys64\usr\bin\bash -l -c "cd $env:PWD && make bootstrap && make install"
48+
run: c:\msys64\usr\bin\bash -l -c "cd $env:PWD && make bootstrap && make bootstrap-test && make install"

libs/base/System/Directory.idr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ support : String -> String
1010
support fn = "C:" ++ fn ++ ", libidris2_support"
1111

1212
%foreign support "idris2_fileErrno"
13-
"node:support:fileErrno,support_system_directory"
13+
"node:support:fileErrno,support_system_file"
1414
prim__fileErrno : PrimIO Int
1515

1616
returnError : HasIO io => io (Either FileError a)

libs/base/System/File.idr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ prim__close : FilePtr -> PrimIO ()
3434
prim__error : FilePtr -> PrimIO Int
3535

3636
%foreign support "idris2_fileErrno"
37-
"node:lambda:()=>-BigInt(process.__lasterr.errno)"
37+
"node:support:fileErrno,support_system_file"
3838
prim__fileErrno : PrimIO Int
3939

4040
%foreign support "idris2_seekLine"

libs/test/Test/Golden.idr

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -264,17 +264,22 @@ Show Requirement where
264264
export
265265
checkRequirement : Requirement -> IO (Maybe String)
266266
checkRequirement req
267-
= do let (envvar, paths) = requirement req
268-
Just exec <- getEnv envvar | Nothing => pathLookup paths
269-
pure (Just exec)
270-
267+
= if platformSupport req
268+
then do let (envvar, paths) = requirement req
269+
Just exec <- getEnv envvar | Nothing => pathLookup paths
270+
pure (Just exec)
271+
else pure Nothing
271272
where
272273
requirement : Requirement -> (String, List String)
273274
requirement C = ("CC", ["cc"])
274275
requirement Chez = ("CHEZ", ["chez", "chezscheme9.5", "scheme"])
275276
requirement Node = ("NODE", ["node"])
276277
requirement Racket = ("RACKET", ["racket"])
277278
requirement Gambit = ("GAMBIT", ["gsc"])
279+
platformSupport : Requirement -> Bool
280+
platformSupport C = not isWindows
281+
platformSupport Racket = not isWindows
282+
platformSupport _ = True
278283

279284
export
280285
findCG : IO (Maybe String)

src/Compiler/ES/Node.idr

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ executeExpr c tmpDir tm
4747
Right () <- coreLift $ writeFile outn js
4848
| Left err => throw (FileErr outn err)
4949
node <- coreLift findNode
50-
coreLift_ $ system (node ++ " " ++ outn)
50+
quoted_node <- pure $ "\"" ++ node ++ "\"" -- Windows often have a space in the path.
51+
coreLift_ $ system (quoted_node ++ " " ++ outn)
5152
pure ()
5253

5354
||| Codegen wrapper for Node implementation.

support/js/support_system_directory.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,4 @@
1-
const support_system_directory_fs = require("fs")
2-
3-
function support_system_directory_fileErrno(){
4-
const n = process.__lasterr.errno;
5-
switch(n){
6-
case -17: return 4n;
7-
default: return -BigInt(n)
8-
}
9-
}
1+
const support_system_directory_fs = require("fs");
102

113
function support_system_directory_changeDir(d){
124
try{

support/js/support_system_file.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
const support_system_file_fs = require('fs')
22

3+
4+
function support_system_file_fileErrno(){
5+
const n = process.__lasterr.errno || 0
6+
if (process.platform == 'win32') {
7+
// TODO: Add the error codes for the other errors
8+
switch(n) {
9+
case -4058: return 2n
10+
case -4075: return 4n
11+
default: return -BigInt(n)
12+
}
13+
} else {
14+
switch(n){
15+
case -17: return 4n
16+
default: return -BigInt(n)
17+
}
18+
}
19+
}
20+
321
// like `readLine` without the overhead of copying characters.
422
// returns int (success 0, failure -1) to align with the C counterpart.
523
function support_system_file_seekLine (file_ptr) {
@@ -46,7 +64,7 @@ function support_system_file_getStr () {
4664

4765
function support_system_file_openFile (n, m) {
4866
try {
49-
const fd = support_system_file_fs.openSync(n, m)
67+
const fd = support_system_file_fs.openSync(n, m.replace('b', ''))
5068
return { fd: fd, buffer: Buffer.alloc(0), name: n, eof: false }
5169
} catch (e) {
5270
process.__lasterr = e

tests/chez/chez016/run

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,8 @@
1-
# This test needs to run `idris2` from a sub-folder.
2-
# Split path to `idris2` executable into dirname and basename.
3-
# If the path is relative, add `..` to compensate for running `idris2` in a sub-folder.
4-
case "$1" in
5-
/*)
6-
# Absolute path
7-
IDRIS2_DIR="$(dirname "$1")"
8-
;;
9-
*)
10-
# Relative path
11-
IDRIS2_DIR="../$(dirname "$1")"
12-
;;
13-
esac
1+
# This test needs to run `idris2` from a sub-folder. Get the absolute path.
142

15-
IDRIS2_EXEC="$(basename "$1")"
3+
IDRIS2_EXEC="$(realpath "$1")"
164

175
cd "folder with spaces" || exit
186

19-
"$IDRIS2_DIR/$IDRIS2_EXEC" --no-color --console-width 0 --no-banner Main.idr < ../input
7+
"$IDRIS2_EXEC" --no-color --console-width 0 --no-banner Main.idr < ../input
208
rm -rf build

0 commit comments

Comments
 (0)