|
3 | 3 | using Test, DistributedNext, Random, Serialization, Sockets |
4 | 4 | import DistributedNext: launch, manage |
5 | 5 |
|
6 | | -import LibSSH as ssh |
7 | | -import LibSSH.Demo: DemoServer |
8 | 6 |
|
9 | 7 | @test cluster_cookie() isa String |
10 | 8 |
|
@@ -762,98 +760,6 @@ if DoFullTest |
762 | 760 | @test all([p == remotecall_fetch(myid, p) for p in all_w]) |
763 | 761 | end |
764 | 762 |
|
765 | | -# LibSSH.jl currently only works on 64bit unixes |
766 | | -if Sys.isunix() && Sys.WORD_SIZE == 64 |
767 | | - function test_n_remove_pids(new_pids) |
768 | | - for p in new_pids |
769 | | - w_in_remote = sort(remotecall_fetch(workers, p)) |
770 | | - try |
771 | | - @test intersect(new_pids, w_in_remote) == new_pids |
772 | | - catch |
773 | | - print("p : $p\n") |
774 | | - print("newpids : $new_pids\n") |
775 | | - print("w_in_remote : $w_in_remote\n") |
776 | | - print("intersect : $(intersect(new_pids, w_in_remote))\n\n\n") |
777 | | - rethrow() |
778 | | - end |
779 | | - end |
780 | | - |
781 | | - remotecall_fetch(rmprocs, 1, new_pids) |
782 | | - end |
783 | | - |
784 | | - println("\n\nTesting SSHManager. A minimum of 4GB of RAM is recommended.") |
785 | | - println("Please ensure port 9300 and 2222 are not in use.") |
786 | | - |
787 | | - DemoServer(2222; auth_methods=[ssh.AuthMethod_None], allow_auth_none=true, verbose=false, timeout=3600) do |
788 | | - sshflags = `-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o LogLevel=ERROR -p 2222 ` |
789 | | - #Issue #9951 |
790 | | - hosts=[] |
791 | | - localhost_aliases = ["localhost", string(getipaddr()), "127.0.0.1"] |
792 | | - num_workers = parse(Int,(get(ENV, "JULIA_ADDPROCS_NUM", "9"))) |
793 | | - |
794 | | - for i in 1:(num_workers/length(localhost_aliases)) |
795 | | - append!(hosts, localhost_aliases) |
796 | | - end |
797 | | - |
798 | | - # CI machines sometimes don't already have a .ssh directory |
799 | | - ssh_dir = joinpath(homedir(), ".ssh") |
800 | | - if !isdir(ssh_dir) |
801 | | - mkdir(ssh_dir) |
802 | | - end |
803 | | - |
804 | | - print("\nTesting SSH addprocs with $(length(hosts)) workers...\n") |
805 | | - new_pids = addprocs_with_testenv(hosts; sshflags=sshflags) |
806 | | - @test length(new_pids) == length(hosts) |
807 | | - test_n_remove_pids(new_pids) |
808 | | - |
809 | | - print("\nMixed ssh addprocs with :auto\n") |
810 | | - new_pids = addprocs_with_testenv(["localhost", ("127.0.0.1", :auto), "localhost"]; sshflags=sshflags) |
811 | | - @test length(new_pids) == (2 + Sys.CPU_THREADS) |
812 | | - test_n_remove_pids(new_pids) |
813 | | - |
814 | | - print("\nMixed ssh addprocs with numeric counts\n") |
815 | | - new_pids = addprocs_with_testenv([("localhost", 2), ("127.0.0.1", 2), "localhost"]; sshflags=sshflags) |
816 | | - @test length(new_pids) == 5 |
817 | | - test_n_remove_pids(new_pids) |
818 | | - |
819 | | - print("\nssh addprocs with tunnel\n") |
820 | | - new_pids = addprocs_with_testenv([("localhost", num_workers)]; tunnel=true, sshflags=sshflags) |
821 | | - @test length(new_pids) == num_workers |
822 | | - test_n_remove_pids(new_pids) |
823 | | - |
824 | | - print("\nssh addprocs with tunnel (SSH multiplexing)\n") |
825 | | - new_pids = addprocs_with_testenv([("localhost", num_workers)]; tunnel=true, multiplex=true, sshflags=sshflags) |
826 | | - @test length(new_pids) == num_workers |
827 | | - controlpath = joinpath(ssh_dir, "julia-$(ENV["USER"])@localhost:2222") |
828 | | - @test issocket(controlpath) |
829 | | - test_n_remove_pids(new_pids) |
830 | | - @test :ok == timedwait(()->!issocket(controlpath), 10.0; pollint=0.5) |
831 | | - |
832 | | - print("\nAll supported formats for hostname\n") |
833 | | - h1 = "localhost" |
834 | | - user = ENV["USER"] |
835 | | - h2 = "$user@$h1" |
836 | | - h3 = "$h2:2222" |
837 | | - h4 = "$h3 $(string(getipaddr()))" |
838 | | - h5 = "$h4:9300" |
839 | | - |
840 | | - new_pids = addprocs_with_testenv([h1, h2, h3, h4, h5]; sshflags=sshflags) |
841 | | - @test length(new_pids) == 5 |
842 | | - test_n_remove_pids(new_pids) |
843 | | - |
844 | | - print("\nkeyword arg exename\n") |
845 | | - for exename in [`$(joinpath(Sys.BINDIR, Base.julia_exename()))`, "$(joinpath(Sys.BINDIR, Base.julia_exename()))"] |
846 | | - for addp_func in [()->addprocs_with_testenv(["localhost"]; exename=exename, exeflags=test_exeflags, sshflags=sshflags), |
847 | | - ()->addprocs_with_testenv(1; exename=exename, exeflags=test_exeflags)] |
848 | | - |
849 | | - local new_pids = addp_func() |
850 | | - @test length(new_pids) == 1 |
851 | | - test_n_remove_pids(new_pids) |
852 | | - end |
853 | | - end |
854 | | - end |
855 | | -end # unix-only |
856 | | - |
857 | 763 | let t = @task 42 |
858 | 764 | schedule(t, ErrorException(""), error=true) |
859 | 765 | @test_throws TaskFailedException(t) Base.wait(t) |
|
0 commit comments