Skip to content

Commit 5cfbe13

Browse files
committed
[ test ] Trying to figure out what happened on Windows
1 parent 2fb379b commit 5cfbe13

File tree

9 files changed

+89
-129
lines changed

9 files changed

+89
-129
lines changed

.github/workflows/test.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,10 @@ jobs:
2121
runs-on: ${{ matrix.os }}
2222
strategy:
2323
matrix:
24-
os: [windows-latest, ubuntu-latest, macos-latest]
25-
agda: ["Agda-2.6.3", "Agda-2.6.4", "Agda-2.7.0"]
24+
# os: [windows-latest, ubuntu-latest, macos-latest]
25+
os: [windows-latest]
26+
# agda: ["Agda-2.6.3", "Agda-2.6.4", "Agda-2.7.0"]
27+
agda: ["Agda-2.7.0"]
2628
fail-fast: false
2729

2830
# Steps represent a sequence of tasks that will be executed as part of the job

lib/js/src/Connection/Connection.bs.js

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/js/src/Connection/Transport/Connection__Transport__Process.bs.js

Lines changed: 17 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/js/test/tests/Test__Auto.bs.js

Lines changed: 3 additions & 72 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/js/test/tests/Test__Util.bs.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Connection/Connection.res

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,9 +322,11 @@ module Module: Module = {
322322
}
323323

324324
let sendRequest = async (connection, document, request, handler) => {
325+
Js.log("[ LOG ] Sending request: " ++ Request.toString(request))
325326
// encode the Request to some string
326327
let encodeRequest = (document, version) => {
327328
let filepath = document->VSCode.TextDocument.fileName->Parser.filepath
329+
Js.log("[ LOG ] original filepath: " ++ filepath)
328330
let libraryPath = Config.getLibraryPath()
329331
let highlightingMethod = Config.Highlighting.getHighlightingMethod()
330332
let backend = Config.getBackend()

src/Connection/Transport/Connection__Transport__Process.res

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ module Module: Module = {
6969
->Option.forEach(stream =>
7070
stream
7171
->NodeJs.Stream.onData(chunk => {
72+
Js.log("[ LOG ][ " ++ path ++ "] Process stdout: " ++ NodeJs.Buffer.toString(chunk))
7273
chan->Chan.emit(Stdout(NodeJs.Buffer.toString(chunk)))
7374
})
7475
->ignore
@@ -80,6 +81,7 @@ module Module: Module = {
8081
->Option.forEach(stream =>
8182
stream
8283
->NodeJs.Stream.onData(chunk => {
84+
Js.log("[ LOG ][ " ++ path ++ "] Process stderr: " ++ NodeJs.Buffer.toString(chunk))
8385
chan->Chan.emit(Stderr(NodeJs.Buffer.toString(chunk)))
8486
// store the latest message from stderr
8587
stderr := stderr.contents ++ NodeJs.Buffer.toString(chunk)
@@ -89,6 +91,7 @@ module Module: Module = {
8991

9092
// on `close` from `stdin` or `process`
9193
let promiseOnClose = Promise.make((resolve, _) => {
94+
Js.log("[ LOG ][ " ++ path ++ "] Process.onClose: Waiting for process to close")
9295
process
9396
->NodeJs.ChildProcess.stdin
9497
->Option.forEach(stream =>
@@ -104,21 +107,26 @@ module Module: Module = {
104107

105108
// on errors and anomalies
106109
let promiseOnExit = Promise.make((resolve, _) => {
110+
Js.log("[ LOG ][ " ++ path ++ "] Process.onExit: Waiting for process to exit")
107111
process
108112
->NodeJs.ChildProcess.onExit(code => resolve(code))
109113
->ignore
110114
})
111115

112116
process
113-
->NodeJs.ChildProcess.onDisconnect(() => chan->Chan.emit(Event(OnDestroyed)))
114-
->NodeJs.ChildProcess.onError(exn =>
117+
->NodeJs.ChildProcess.onDisconnect(() => {
118+
Js.log("[ LOG ][ " ++ path ++ "] Process.onDisconnect: Process disconnected")
119+
chan->Chan.emit(Event(OnDestroyed))})
120+
->NodeJs.ChildProcess.onError(exn =>{
121+
Js.log("[ LOG ][ " ++ path ++ "] Process.onError: Process error: " ++ Util.JsError.toString(exn))
115122
chan->Chan.emit(Event(OnError(Util.JsError.toString(exn))))
116-
)
123+
})
117124
->ignore
118125

119126
// emit `OnExit` when either `close` or `exit` was received
120127
Promise.race([promiseOnExit, promiseOnClose])
121128
->Promise.thenResolve(exitCode => {
129+
Js.log("[ LOG ][ " ++ path ++ "] Process.onExit: Process exited with code " ++ string_of_int(exitCode))
122130
chan->Chan.emit(Event(OnExit(exitCode)))
123131
})
124132
->ignore
@@ -155,6 +163,7 @@ module Module: Module = {
155163
let send = (self, request): bool => {
156164
switch self.status {
157165
| Created(process) =>
166+
Js.log("[ LOG ] Process.send: Sending request: " ++ request)
158167
let payload = NodeJs.Buffer.fromString(request ++ NodeJs.Os.eol)
159168
process
160169
->NodeJs.ChildProcess.stdin
@@ -164,7 +173,9 @@ module Module: Module = {
164173
->ignore
165174
)
166175
true
167-
| _ => false
176+
| _ =>
177+
Js.log("[ LOG ] Process.send: Cannot send, process is not in a valid state")
178+
false
168179
}
169180
}
170181

test/tests/Test__Auto.res

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -36,61 +36,61 @@ let run = normalization => {
3636
}
3737
})
3838

39-
Async.it("should be responded with correct responses 2", async () => {
40-
let ctx = await AgdaMode.makeAndLoad("Auto.agda")
39+
// Async.it("should be responded with correct responses 2", async () => {
40+
// let ctx = await AgdaMode.makeAndLoad("Auto.agda")
4141

42-
let responses = switch Goals.getGoalByIndex(ctx.state.goals, 1) {
43-
| Some(goal) =>
44-
await ctx.state->State__Connection.sendRequestAndCollectResponses(
45-
Request.Auto(normalization, goal),
46-
)
47-
| None => []
48-
}
42+
// let responses = switch Goals.getGoalByIndex(ctx.state.goals, 1) {
43+
// | Some(goal) =>
44+
// await ctx.state->State__Connection.sendRequestAndCollectResponses(
45+
// Request.Auto(normalization, goal),
46+
// )
47+
// | None => []
48+
// }
4949

50-
let filteredResponses = responses->Array.filter(filteredResponse)
50+
// let filteredResponses = responses->Array.filter(filteredResponse)
5151

52-
switch ctx.state.agdaVersion {
53-
| Some(version) =>
54-
if Util.Version.gte(version, "2.7.0") {
55-
Assert.deepStrictEqual(
56-
filteredResponses,
57-
[GiveAction(1, GiveString("n")), InteractionPoints([0])],
58-
)
59-
} else {
60-
Assert.deepStrictEqual(
61-
filteredResponses,
62-
[
63-
GiveAction(1, GiveString("m")),
64-
DisplayInfo(AllGoalsWarnings("*All Goals*", "?0 : ℕ\n")),
65-
InteractionPoints([0]),
66-
],
67-
)
68-
}
69-
| None => Assert.fail("No Agda version found")
70-
}
71-
})
52+
// switch ctx.state.agdaVersion {
53+
// | Some(version) =>
54+
// if Util.Version.gte(version, "2.7.0") {
55+
// Assert.deepStrictEqual(
56+
// filteredResponses,
57+
// [GiveAction(1, GiveString("n")), InteractionPoints([0])],
58+
// )
59+
// } else {
60+
// Assert.deepStrictEqual(
61+
// filteredResponses,
62+
// [
63+
// GiveAction(1, GiveString("m")),
64+
// DisplayInfo(AllGoalsWarnings("*All Goals*", "?0 : ℕ\n")),
65+
// InteractionPoints([0]),
66+
// ],
67+
// )
68+
// }
69+
// | None => Assert.fail("No Agda version found")
70+
// }
71+
// })
7272
}
7373

7474
describe("agda-mode.auto", () => {
7575
This.timeout(4000)
7676

77-
// testing for Auto somehow hangs on GitHub Actions Windows runners (but works fine on my desktop Windows :))
78-
// cannot find out why, so skip the tests on Windows for now
79-
if OS.onUnix {
80-
describe("AsIs", () => {
77+
// // testing for Auto somehow hangs on GitHub Actions Windows runners (but works fine on my desktop Windows :))
78+
// // cannot find out why, so skip the tests on Windows for now
79+
// if OS.onUnix {
80+
describe_only("AsIs", () => {
8181
run(AsIs)
8282
})
8383

84-
describe("Simplified", () => {
85-
run(Simplified)
86-
})
84+
// describe("Simplified", () => {
85+
// run(Simplified)
86+
// })
8787

88-
describe("Normalised", () => {
89-
run(Normalised)
90-
})
88+
// describe("Normalised", () => {
89+
// run(Normalised)
90+
// })
9191

92-
describe("HeadNormal", () => {
93-
run(HeadNormal)
94-
})
95-
}
92+
// describe("HeadNormal", () => {
93+
// run(HeadNormal)
94+
// })
95+
// }
9696
})

0 commit comments

Comments
 (0)