Skip to content

Commit 4792bd3

Browse files
committed
illumos: add CI using Buildomat
Add continuous integration for the x86_64-unknown-illumos target using the [buildomat] CI service, and fix up issues such that CI passes. ## What is buildomat? Buildomat is a CI service, similar in spirit to services like GitHub Actions. Buildomat is open source, built and maintained by us at Oxide, and is used by our own CI. Here's an example run with this PR: * [GitHub](https://github.com/sunshowers/libc/runs/32829121549) * [Buildomat](https://buildomat.eng.oxide.computer/wg/0/details/01JCEH2XM6JWQMFZRWP20XM7D8/NBYYTAsj3lylUuK0VrofLaby5WaNremha5hZrvuWRjw7fYqY/01JCEH37JR7KQXJZMVFX1E6KN1) As part of this, at Oxide we're committing to maintaining the buildomat support. This includes: * Providing compute resources. * Maintaining and fixing issues in a timely manner. In order to have buildomat CI working, the rust-lang project would need to [install the buildomat app] (allowlisted to libc if desired). ## Why another CI system? The main alternative to buildomat would be something like [vmactions]. While vmactions provides an OmniOS build, OmniOS is actually a downstream distribution of illumos that includes several APIs not present in illumos. For example, OmniOS has an [inotify implementation] but upstream illumos doesn't. It would be easy to accidentally add inotify APIs to libc even though that wouldn't build on other illumos distributions. More importantly, at Oxide we don't feel confident providing support for a third-party service. We'd like to not just throw CI support over the wall but instead are committed to the long-term health of Rust on illumos. Since we use Buildomat ourselves, we're strongly incentivized to maintain it in a way that wouldn't be true for other solutions. [Buildomat]: https://github.com/oxidecomputer/buildomat [install the buildomat app]: https://github.com/apps/buildomat [vmactions]: https://github.com/vmactions [inotify implementation]: https://man.omnios.org/7/inotify
1 parent e4c7acc commit 4792bd3

File tree

7 files changed

+85
-0
lines changed

7 files changed

+85
-0
lines changed

.github/buildomat/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Buildomat CI
2+
3+
Builds on illumos use Oxide Computer's [buildomat CI](https://github.com/oxidecomputer/buildomat).
4+
5+
Maintenance and compute resources are provided by Oxide Computer.

.github/buildomat/build-and-test.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/env bash
2+
3+
set -o errexit
4+
set -o pipefail
5+
set -o xtrace
6+
7+
# Enable ANSI colors in Cargo output.
8+
export CARGO_TERM_COLOR=always
9+
10+
banner install
11+
TOOLCHAIN=stable INSTALL_RUSTUP=1 ptime -m sh ci/install-rust.sh
12+
13+
banner run.sh
14+
ptime -m sh ci/run.sh x86_64-unknown-illumos

.github/buildomat/config.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Configuration for buildomat. See
2+
# https://github.com/oxidecomputer/buildomat/blob/main/README.md#per-repository-configuration.
3+
4+
enable = true
5+
# The buildomat jobs don't have access to any secrets, so it's okay for GitHub
6+
# users to create them.
7+
org_only = false
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/env bash
2+
#:
3+
#: name = "x86_64-unknown-illumos"
4+
#: variety = "basic"
5+
#: target = "helios-latest"
6+
7+
# Note: we use ci/install-rust.sh rather than buildomat to install Rust, for
8+
# consistency with other CI jobs.
9+
exec .github/buildomat/build-and-test.sh illumos

ci/install-rust.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,40 @@ if [ -n "$TOOLCHAIN" ]; then
1010
else
1111
toolchain=nightly
1212
fi
13+
14+
if [ "$INSTALL_RUSTUP" = "1" ]; then
15+
echo "Install rustup"
16+
17+
# If the CI system already has Rust installed, we'll override that
18+
# installation via sourcing ~/.cargo/env.
19+
export RUSTUP_INIT_SKIP_PATH_CHECK=yes
20+
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain none
21+
# shellcheck source=/dev/null
22+
. "$HOME/.cargo/env"
23+
24+
# It is possible that "$HOME/.cargo/bin" was already in the PATH, in which
25+
# case the above source would not have any effect. If the directory wasn't
26+
# present on disk, then some shells negatively cache the PATH lookup and not
27+
# find the directory even after it is created. To work around this, force a
28+
# change to the PATH.
29+
#
30+
# This is a more portable version of `hash -r`. `hash -r` is part of the POSIX
31+
# spec [1] but may not be available in all shells. The manual suggests the
32+
# following, more portable option:
33+
#
34+
# PATH="$PATH"
35+
#
36+
# But empirically, that has been observed to not invalidate the cache in some
37+
# shells. Actually making a change to the PATH should always work (hopefully!)
38+
#
39+
# [1] https://pubs.opengroup.org/onlinepubs/9799919799/utilities/hash.html
40+
41+
# First, add a trailing colon.
42+
PATH="$PATH:"
43+
# Then, remove it.
44+
PATH="${PATH%:}"
45+
fi
46+
1347
if [ "$OS" = "windows" ]; then
1448
: "${TARGET?The TARGET environment variable must be set.}"
1549
rustup set profile minimal

libc-test/build.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -923,6 +923,13 @@ fn test_solarish(target: &str) {
923923
// This evaluates to a sysconf() call rather than a constant
924924
"PTHREAD_STACK_MIN" => true,
925925

926+
// Note: on illumos, the value of PTHREAD_MUTEX_DEFAULT was changed to a
927+
// new value, 0x8, in 2024-02:
928+
// https://github.com/illumos/illumos-gate/commit/50718d3ece2504ebcfdc3f385132f664b567cdd0.
929+
// libc still has the old value (= PTHREAD_MUTEX_NORMAL = 0x0) for a
930+
// window of time in case illumos systems are out of date.
931+
"PTHREAD_MUTEX_DEFAULT" if is_illumos => true,
932+
926933
// EPOLLEXCLUSIVE is a relatively recent addition to the epoll interface and may not be
927934
// defined on older systems. It is, however, safe to use on systems which do not
928935
// explicitly support it. (A no-op is an acceptable implementation of EPOLLEXCLUSIVE.)

src/unix/solarish/mod.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2041,6 +2041,15 @@ pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t {
20412041
pub const PTHREAD_MUTEX_NORMAL: ::c_int = 0;
20422042
pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 2;
20432043
pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 4;
2044+
2045+
// Note: on illumos, the value of PTHREAD_MUTEX_DEFAULT was changed to a new
2046+
// value, 0x8, in 2024-02:
2047+
// https://github.com/illumos/illumos-gate/commit/50718d3ece2504ebcfdc3f385132f664b567cdd0.
2048+
// libc still has the old value (= PTHREAD_MUTEX_NORMAL = 0x0) for a window of
2049+
// time in case illumos systems are out of date.
2050+
//
2051+
// Once this constant has been updated on illumos, the corresponding
2052+
// `cfg.skip_const` configuration in `libc-test/build.rs` should be removed.
20442053
pub const PTHREAD_MUTEX_DEFAULT: ::c_int = ::PTHREAD_MUTEX_NORMAL;
20452054

20462055
pub const RTLD_NEXT: *mut ::c_void = -1isize as *mut ::c_void;

0 commit comments

Comments
 (0)