From 7f643498f6b8043c3d3533bde56b57adda0c1029 Mon Sep 17 00:00:00 2001 From: Theo Butler Date: Thu, 26 Dec 2019 15:54:36 -0500 Subject: [PATCH] allow tests on musl platforms --- .ci-scripts/test-bootstrap.sh | 5 +---- cmd/packages.pony | 3 ++- test/main.pony | 23 +++++++++++++++++------ 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/.ci-scripts/test-bootstrap.sh b/.ci-scripts/test-bootstrap.sh index cc35e36..76f114d 100755 --- a/.ci-scripts/test-bootstrap.sh +++ b/.ci-scripts/test-bootstrap.sh @@ -1,8 +1,5 @@ #!/bin/sh -triple="$(cc -dumpmachine)" -libc="${triple##*-}" - rm -rf \ /usr/local/bin/ponyc \ /usr/local/bin/stable \ @@ -13,7 +10,7 @@ rm -rf \ cat ponyup-init.sh | sh -s -- --prefix=/usr/local export PATH=$HOME/.local/share/ponyup/bin:$PATH -ponyup update ponyc nightly --libc=${libc} +ponyup update ponyc nightly "--platform=$(cc -dumpmachine)" ponyup update changelog-tool nightly ponyup update corral nightly ponyup update stable nightly diff --git a/cmd/packages.pony b/cmd/packages.pony index d34a008..7953a19 100644 --- a/cmd/packages.pony +++ b/cmd/packages.pony @@ -17,7 +17,7 @@ primitive Packages else error end var libc: Libc = - if name == "ponyc" then Glibc + if (name == "ponyc") and (os is Linux) then Glibc else None end for field in platform.values() do @@ -31,6 +31,7 @@ primitive Packages else error end end + if (os is Darwin) then libc = None end Package._create(name, channel, version, (cpu, os, libc)) fun from_string(str: String): Package ? => diff --git a/test/main.pony b/test/main.pony index aaf61bc..8a5f100 100644 --- a/test/main.pony +++ b/test/main.pony @@ -31,7 +31,7 @@ class _TestSync is UnitTest fun apply(h: TestHelper) ? => let auth = h.env.root as AmbientAuth _SyncTester(h, auth, _pkg_name) - h.long_test(20_000_000_000) + h.long_test(30_000_000_000) class _TestSelect is UnitTest let _ponyc_versions: Array[String] val = @@ -41,9 +41,9 @@ class _TestSelect is UnitTest "select" fun apply(h: TestHelper) ? => + let platform = _TestPonyup.platform(h.env.vars) let install_args: {(String): Array[String] val} val = - // TODO: libc - {(v) => ["update"; "ponyc"; v; "--platform=" + "gnu"] } + {(v) => ["update"; "ponyc"; v; "--platform=" + platform] } let link = FilePath( @@ -74,7 +74,7 @@ class _TestSelect is UnitTest end } val)? - h.long_test(20_000_000_000) + h.long_test(30_000_000_000) actor _SyncTester is PonyupNotify let _h: TestHelper @@ -87,11 +87,12 @@ actor _SyncTester is PonyupNotify _auth = auth _pkg_name = pkg_name + let platform = _TestPonyup.platform(h.env.vars) let http_get = HTTPGet(NetAuth(_auth), this) for channel in ["nightly"; "release"].values() do try - // TODO: specify libc - let pkg = Packages.from_fragments(_pkg_name, channel, "latest", [])? + let pkg = Packages.from_fragments( + _pkg_name, channel, "latest", platform.split("-"))? let query_string: String = Cloudsmith.repo_url(channel).clone() .> append(Cloudsmith.query(pkg)) @@ -144,6 +145,16 @@ actor _SyncTester is PonyupNotify _h.env.out.write(str) primitive _TestPonyup + fun platform(vars: Array[String] box): String => + let key = "PONYUP_PLATFORM" + var platform' = "" + for v in vars.values() do + if not v.contains(key) then continue end + platform' = v.substring(key.size().isize() + 1) + break + end + platform' + fun ponyup_bin(auth: AmbientAuth): FilePath? => FilePath(auth, "./build")? .join(if Platform.debug() then "debug" else "release" end)?