Skip to content

Commit fe96f86

Browse files
committed
set a timeout for the integration test execution
the fake `FSIHelper.executeFSI` doesnt timeout
1 parent 5e64a76 commit fe96f86

File tree

1 file changed

+24
-7
lines changed

1 file changed

+24
-7
lines changed

build.fsx

+24-7
Original file line numberDiff line numberDiff line change
@@ -73,38 +73,55 @@ let runIntegrationTest (fn: string) : bool =
7373
true
7474
| None ->
7575
tracefn "Running FSIHelper '%s', '%s', '%s'" FSIHelper.fsiPath dir fn
76-
let result, msgs = FSIHelper.executeFSI dir fn []
77-
let msgs = msgs |> Seq.filter (fun x -> x.IsError) |> Seq.toList
78-
if not result then
79-
for msg in msgs do
80-
traceError msg.Message
81-
result
76+
let testExecution =
77+
try
78+
let fsiExec = async {
79+
return Some (FSIHelper.executeFSI dir fn [])
80+
}
81+
Async.RunSynchronously (fsiExec, TimeSpan.FromMinutes(10.0).TotalMilliseconds |> int)
82+
with :? TimeoutException ->
83+
None
84+
match testExecution with
85+
| None -> //timeout
86+
false
87+
| Some (result, msgs) ->
88+
let msgs = msgs |> Seq.filter (fun x -> x.IsError) |> Seq.toList
89+
if not result then
90+
for msg in msgs do
91+
traceError msg.Message
92+
result
8293

8394
Target "IntegrationTest" (fun _ ->
95+
trace "Running Integration tests..."
8496
let runOk =
8597
integrationTests
8698
|> Seq.map runIntegrationTest
8799
|> Seq.forall id
88100

89101
if not runOk then
102+
trace "Integration tests did not run successfully"
90103
failwith "Integration tests did not run successfully"
91104
else
105+
trace "checking tests results..."
92106
let ok, out, err =
93107
Git.CommandHelper.runGitCommand
94108
"."
95109
("-c core.fileMode=false diff --exit-code " + integrationTestDir)
96110
if not ok then
97111
trace (toLines out)
98112
failwithf "Integration tests failed:\n%s" err
113+
trace "Done Integration tests."
99114
)
100115

101116
Target "UnitTest" (fun _ ->
117+
trace "Running Unit tests."
102118
!! testAssemblies
103119
|> NUnit3 (fun p ->
104120
{ p with
105121
ShadowCopy = true
106-
TimeOut = TimeSpan.FromMinutes 20.
122+
TimeOut = TimeSpan.FromMinutes 10.
107123
OutputDir = "TestResults.xml" })
124+
trace "Done Unit tests."
108125
)
109126

110127

0 commit comments

Comments
 (0)