Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fc1943s committed Apr 13, 2024
1 parent 9d61041 commit 247fbba
Show file tree
Hide file tree
Showing 98 changed files with 52,396 additions and 11,125 deletions.
1 change: 0 additions & 1 deletion apps/builder/Builder.dib
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#!import ../../lib/fsharp/CommonFSharp.fs
#!import ../../lib/fsharp/Async.fs
#!import ../../lib/fsharp/AsyncSeq.fs
#!import ../../lib/fsharp/Networking.fs
#!import ../../lib/fsharp/Runtime.fs
#!import ../../lib/fsharp/FileSystem.fs

Expand Down
1 change: 0 additions & 1 deletion apps/dir-tree-html/DirTreeHtml.dib
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#!import ../../lib/fsharp/CommonFSharp.fs
#!import ../../lib/fsharp/Async.fs
#!import ../../lib/fsharp/AsyncSeq.fs
#!import ../../lib/fsharp/Networking.fs
#!import ../../lib/fsharp/Runtime.fs
#!import ../../lib/fsharp/FileSystem.fs

Expand Down
2 changes: 1 addition & 1 deletion apps/dir-tree-html/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ if (!$fast) {
{ . ../parser/dist/DibParser$(GetExecutableSuffix) DirTreeHtml.dib fs } | Invoke-Block

$runtime = $fast -or $env:CI ? @("--runtime", ($IsWindows ? "win-x64" : "linux-x64")) : @()
$builderArgs = @("DirTreeHtml.fs", $runtime, "--packages", "Argu", "Falco.Markup", "FSharp.Control.AsyncSeq", "FSharp.Json", "System.CommandLine", "System.Reactive.Linq", "--modules", @(GetFsxModules), "lib/fsharp/Common.fs", "lib/fsharp/CommonFSharp.fs", "lib/fsharp/Async.fs", "lib/fsharp/AsyncSeq.fs", "lib/fsharp/Networking.fs", "lib/fsharp/Runtime.fs", "lib/fsharp/FileSystem.fs")
$builderArgs = @("DirTreeHtml.fs", $runtime, "--packages", "Argu", "Falco.Markup", "FSharp.Control.AsyncSeq", "FSharp.Json", "System.CommandLine", "System.Reactive.Linq", "--modules", @(GetFsxModules), "lib/fsharp/Common.fs", "lib/fsharp/CommonFSharp.fs", "lib/fsharp/Async.fs", "lib/fsharp/AsyncSeq.fs", "lib/fsharp/Runtime.fs", "lib/fsharp/FileSystem.fs")
{ . ../builder/dist/Builder$(GetExecutableSuffix) @builderArgs } | Invoke-Block
10 changes: 5 additions & 5 deletions apps/parser/JsonParser.dib.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions apps/parser/JsonParser.dib.ipynb

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions apps/spiral/Eval.dib
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,8 @@

#!import ../../lib/fsharp/Common.fs
#!import ../../lib/fsharp/CommonFSharp.fs
#!import ../../lib/fsharp/Threading.fs
#!import ../../lib/fsharp/Async.fs
#!import ../../lib/fsharp/AsyncSeq.fs
#!import ../../lib/fsharp/Networking.fs
#!import ../../lib/fsharp/Runtime.fs
#!import ../../lib/fsharp/FileSystem.fs

Expand Down
2 changes: 0 additions & 2 deletions apps/spiral/Eval.dib.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions apps/spiral/Eval.dib.ipynb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 9 additions & 11 deletions apps/spiral/Supervisor.dib
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,8 @@

#!import ../../lib/fsharp/Common.fs
#!import ../../lib/fsharp/CommonFSharp.fs
#!import ../../lib/fsharp/Threading.fs
#!import ../../lib/fsharp/Async.fs
#!import ../../lib/fsharp/AsyncSeq.fs
#!import ../../lib/fsharp/Networking.fs
#!import ../../lib/fsharp/Runtime.fs
#!import ../../lib/fsharp/FileSystem.fs

Expand All @@ -55,7 +53,7 @@ open Microsoft.AspNetCore.SignalR.Client
#!fsharp

let inline sendJson (port : int) (json : string) = async {
let! portOpen = Networking.testPortOpen port
let! portOpen = SpiralNetworking.test_port_open port
if portOpen then
try
let connection = HubConnectionBuilder().WithUrl($"http://127.0.0.1:{port}").Build()
Expand Down Expand Up @@ -104,11 +102,11 @@ type ClientErrorsRes =
#!fsharp

let inline awaitCompiler port cancellationToken = async {
let ct, disposable = cancellationToken |> Threading.newDisposableToken
let struct (ct, disposable) = cancellationToken |> SpiralThreading.new_disposable_token
let! ct = ct |> SpiralAsync.merge_cancellation_token_with_default_async

let compiler = MailboxProcessor.Start (fun inbox -> async {
let! availablePort = Networking.getAvailablePort (Some 60) port
let! availablePort = SpiralNetworking.get_available_port (Some 60) port
if availablePort <> port then
inbox.Post (port, false)
else
Expand All @@ -123,7 +121,7 @@ let inline awaitCompiler port cancellationToken = async {
let command = $@"dotnet ""{dllPath}"" --port {availablePort} --default-int i32 --default-float f64"
let onLine = fun struct (_, line, _) -> async {
if line |> SpiralSm.contains $"Server bound to: http://localhost:{availablePort}" then
do! Networking.waitForPortAccess (Some 500) true availablePort |> Async.Ignore
do! SpiralNetworking.wait_for_port_access (Some 500) true availablePort |> Async.Ignore

let rec loop retry = async {
let getLocals () = $"port: {availablePort} / retry: {retry} / {getLocals ()}"
Expand Down Expand Up @@ -169,7 +167,7 @@ let inline awaitCompiler port cancellationToken = async {
do! connection.StopAsync () |> Async.AwaitTask
disposable.Dispose ()
if managed
then do! Networking.waitForPortAccess (Some 2000) false serverPort |> Async.Ignore
then do! SpiralNetworking.wait_for_port_access (Some 2000) false serverPort |> Async.Ignore
}
|> Async.RunSynchronously
)
Expand Down Expand Up @@ -242,7 +240,7 @@ let inline buildFile timeout port cancellationToken path = async {
let stream, disposable = fileDir |> FileSystem.watchDirectory (fun _ -> false)
use _ = disposable

let token, disposable = Threading.newDisposableToken cancellationToken
let struct (token, disposable) = SpiralThreading.new_disposable_token cancellationToken
use _ = disposable

let! serverPort, errors, ct, disposable = awaitCompiler port (Some token)
Expand Down Expand Up @@ -687,7 +685,7 @@ let inline getFileTokenRange port cancellationToken path = async {
let! code = fullPath |> SpiralFileSystem.read_all_text_async
let lines = code |> SpiralSm.split "\n"

let token, disposable = Threading.newDisposableToken cancellationToken
let struct (token, disposable) = SpiralThreading.new_disposable_token cancellationToken
use _ = disposable

let! serverPort, _errors, ct, disposable =
Expand Down Expand Up @@ -834,7 +832,7 @@ let main args =

async {
let port = port |> Option.defaultWith getCompilerPort
let localToken, disposable = Threading.newDisposableToken None
let struct (localToken, disposable) = SpiralThreading.new_disposable_token None
let! serverPort, _errors, compilerToken, disposable = awaitCompiler port (Some localToken)
use _ = disposable

Expand Down Expand Up @@ -885,7 +883,7 @@ let main args =
|> Seq.collect id
|> fun x ->
if isParallel
then Async.Parallel (x, float System.Environment.ProcessorCount * 0.75 |> ceil |> int)
then Async.Parallel (x, float System.Environment.ProcessorCount * 0.51 |> ceil |> int)
else Async.Sequential x
|> Async.map Array.sum
}
Expand Down
Loading

0 comments on commit 247fbba

Please sign in to comment.