Merge pull request #205584 from wegank/julia-darwin

julia_18-bin: add darwin support
This commit is contained in:
Nick Cao 2023-01-18 14:04:53 +08:00 committed by GitHub
commit e37d909c97
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 83 additions and 4 deletions

View File

@ -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";
};
}

View File

@ -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 |>