From a862d89303f2bbc72d1aa0b54bbbfc4e51e9974e Mon Sep 17 00:00:00 2001 From: Weijia Wang <9713184+wegank@users.noreply.github.com> Date: Tue, 17 Jan 2023 02:11:22 +0100 Subject: [PATCH] julia_18-bin: add darwin support --- pkgs/development/compilers/julia/1.8-bin.nix | 40 ++++++++++++++-- ...low-skipping-internet-required-tests.patch | 47 +++++++++++++++++++ 2 files changed, 83 insertions(+), 4 deletions(-) create mode 100644 pkgs/development/compilers/julia/patches/1.8-bin/0001-allow-skipping-internet-required-tests.patch diff --git a/pkgs/development/compilers/julia/1.8-bin.nix b/pkgs/development/compilers/julia/1.8-bin.nix index 01806fc208a1..198eeb445548 100644 --- a/pkgs/development/compilers/julia/1.8-bin.nix +++ b/pkgs/development/compilers/julia/1.8-bin.nix @@ -1,5 +1,23 @@ { autoPatchelfHook, fetchurl, lib, stdenv }: +let + skip_tests = [ + # Test flaky on ofborg + "channels" + ] ++ lib.optionals stdenv.isDarwin [ + # Test flaky on ofborg + "FileWatching" + # Test requires pbcopy + "InteractiveUtils" + # Test requires network access + "Sockets" + ] ++ lib.optionals (stdenv.isDarwin && stdenv.isx86_64) [ + # Test Failed at $out/share/julia/stdlib/v1.8/LinearAlgebra/test/blas.jl:702 + "LinearAlgebra/blas" + # Test Failed at $out/share/julia/test/misc.jl:724 + "misc" + ]; +in stdenv.mkDerivation rec { pname = "julia-bin"; version = "1.8.5"; @@ -13,8 +31,21 @@ stdenv.mkDerivation rec { url = "https://julialang-s3.julialang.org/bin/linux/aarch64/${lib.versions.majorMinor version}/julia-${version}-linux-aarch64.tar.gz"; sha256 = "sha256-ofY3tExx6pvJbXw+80dyTAVKHlInuYCt6/wzWZ5RU6Q="; }; + x86_64-darwin = fetchurl { + url = "https://julialang-s3.julialang.org/bin/mac/x64/${lib.versions.majorMinor version}/julia-${version}-mac64.tar.gz"; + sha256 = "sha256-oahZ7af7QaC1VGczmhHDwcDfeLJ9HhYOgLxnWLPY2uA="; + }; + aarch64-darwin = fetchurl { + url = "https://julialang-s3.julialang.org/bin/mac/aarch64/${lib.versions.majorMinor version}/julia-${version}-macaarch64.tar.gz"; + sha256 = "sha256-6oXgSJw2MkxNpiFjqhuC/PL1L3LRc+590hOjqSmSyrc="; + }; }.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}"); + patches = [ + # https://github.com/JuliaLang/julia/commit/f5eeba35d9bf20de251bb9160cc935c71e8b19ba + ./patches/1.8-bin/0001-allow-skipping-internet-required-tests.patch + ]; + postPatch = '' # Julia fails to pick up our Certification Authority root certificates, but # it provides its own so we can simply disable the test. Patching in the @@ -24,7 +55,7 @@ stdenv.mkDerivation rec { '@test_skip ca_roots_path() != bundled_ca_roots()' ''; - nativeBuildInputs = [ autoPatchelfHook ]; + nativeBuildInputs = lib.optionals stdenv.isLinux [ autoPatchelfHook ]; installPhase = '' runHook preInstall @@ -48,7 +79,8 @@ stdenv.mkDerivation rec { --check-bounds=yes \ --startup-file=no \ --depwarn=error \ - $out/share/julia/test/runtests.jl + $out/share/julia/test/runtests.jl \ + --skip internet_required ${toString skip_tests} runHook postInstallCheck ''; @@ -57,8 +89,8 @@ stdenv.mkDerivation rec { homepage = "https://julialang.org"; # Bundled and linked with various GPL code, although Julia itself is MIT. license = lib.licenses.gpl2Plus; - maintainers = with lib.maintainers; [ ninjin raskin nickcao ]; - platforms = [ "x86_64-linux" "aarch64-linux" ]; + maintainers = with lib.maintainers; [ ninjin raskin nickcao wegank ]; + platforms = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ]; mainProgram = "julia"; }; } diff --git a/pkgs/development/compilers/julia/patches/1.8-bin/0001-allow-skipping-internet-required-tests.patch b/pkgs/development/compilers/julia/patches/1.8-bin/0001-allow-skipping-internet-required-tests.patch new file mode 100644 index 000000000000..ab256f54848e --- /dev/null +++ b/pkgs/development/compilers/julia/patches/1.8-bin/0001-allow-skipping-internet-required-tests.patch @@ -0,0 +1,47 @@ +--- a/share/julia/test/choosetests.jl ++++ b/share/julia/test/choosetests.jl +@@ -31,6 +31,19 @@ const TESTNAMES = [ + "smallarrayshrink", "opaque_closure", "filesystem", "download", + ] + ++ ++const INTERNET_REQUIRED_LIST = [ ++ "Artifacts", ++ "Downloads", ++ "LazyArtifacts", ++ "LibCURL", ++ "LibGit2", ++ "Pkg", ++ "download", ++] ++ ++const NETWORK_REQUIRED_LIST = vcat(INTERNET_REQUIRED_LIST, ["Sockets"]) ++ + """ + `(; tests, net_on, exit_on_error, seed) = choosetests(choices)` selects a set of tests to be + run. `choices` should be a vector of test names; if empty or set to +@@ -147,6 +160,7 @@ function choosetests(choices = []) + filtertests!(tests, "compiler/EscapeAnalysis", [ + "compiler/EscapeAnalysis/local", "compiler/EscapeAnalysis/interprocedural"]) + filtertests!(tests, "stdlib", STDLIBS) ++ filtertests!(tests, "internet_required", INTERNET_REQUIRED_LIST) + # do ambiguous first to avoid failing if ambiguities are introduced by other tests + filtertests!(tests, "ambiguous") + +@@ -157,15 +171,7 @@ function choosetests(choices = []) + filter!(x -> (x != "Profile"), tests) + end + +- net_required_for = [ +- "Artifacts", +- "Downloads", +- "LazyArtifacts", +- "LibCURL", +- "LibGit2", +- "Sockets", +- "download", +- ] ++ net_required_for = filter!(in(tests), NETWORK_REQUIRED_LIST) + net_on = true + JULIA_TEST_NETWORKING_AVAILABLE = get(ENV, "JULIA_TEST_NETWORKING_AVAILABLE", "") |> + strip |>