diff --git a/.gitignore b/.gitignore index f0072fec9c91e..243decad42cfd 100644 --- a/.gitignore +++ b/.gitignore @@ -30,6 +30,8 @@ *.jl.*.mem *.ji +!busybox.exe + /perf* .DS_Store .idea/* diff --git a/test/deps/busybox.exe b/test/deps/busybox.exe new file mode 100644 index 0000000000000..f1e96c888de35 Binary files /dev/null and b/test/deps/busybox.exe differ diff --git a/test/spawn.jl b/test/spawn.jl index 3fdfa794ff39e..6864f54181cb8 100644 --- a/test/spawn.jl +++ b/test/spawn.jl @@ -5,7 +5,6 @@ ################################### using Random, Sockets -using Downloads: Downloads, download valgrind_off = ccall(:jl_running_on_valgrind, Cint, ()) == 0 @@ -21,50 +20,20 @@ sleepcmd = `sleep` lscmd = `ls` havebb = false -function _tryonce_download_from_cache(desired_url::AbstractString) - cache_url = "https://cache.julialang.org/$(desired_url)" - cache_output_filename = joinpath(mktempdir(), "myfile") - cache_response = Downloads.request( - cache_url; - output = cache_output_filename, - throw = false, - timeout = 60, - ) - if cache_response isa Downloads.Response - if Downloads.status_ok(cache_response.proto, cache_response.status) - return cache_output_filename - end - end - return Downloads.download(desired_url; timeout = 60) -end - -function download_from_cache(desired_url::AbstractString) - f = () -> _tryonce_download_from_cache(desired_url) - delays = Float64[30, 30, 60, 60, 60] - g = retry(f; delays) - return g() -end - if Sys.iswindows() - busybox = download_from_cache("https://frippery.org/files/busybox/busybox.exe") - havebb = try # use busybox-w32 on windows, if available - success(`$busybox`) - true - catch - false - end - if havebb - yescmd = `$busybox yes` - echocmd = `$busybox echo` - sortcmd = `$busybox sort` - printfcmd = `$busybox printf` - truecmd = `$busybox true` - falsecmd = `$busybox false` - catcmd = `$busybox cat` - shcmd = `$busybox sh` - sleepcmd = `$busybox sleep` - lscmd = `$busybox ls` - end + busybox = joinpath(@__DIR__, "deps", "busybox.exe") + havebb = true + + yescmd = `$busybox yes` + echocmd = `$busybox echo` + sortcmd = `$busybox sort` + printfcmd = `$busybox printf` + truecmd = `$busybox true` + falsecmd = `$busybox false` + catcmd = `$busybox cat` + shcmd = `$busybox sh` + sleepcmd = `$busybox sleep` + lscmd = `$busybox ls` end #### Examples used in the manual #### @@ -878,13 +847,6 @@ end @test setenv(cmd, Dict("FOO"=>"foo"); dir="").dir == "" end - -# clean up busybox download -if Sys.iswindows() - rm(busybox, force=true) -end - - # test (t)csh escaping if tcsh is installed cshcmd = "/bin/tcsh" if isfile(cshcmd)