Commit Graph

66 Commits

Author SHA1 Message Date
Alan Somers
4a83f8b8b5 Drop x86_64-unknown-darwin to Tier 2
And promote aarch64-unknown-darwin to Tier 1.  Because that's what
Cirrus CI is doing.

Fixes #1904
2023-01-17 14:37:53 -07:00
Alex Saveau
17833268cb
Reformat everything
Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>
2022-11-06 11:39:09 -08:00
Alan Somers
29f4d52df6 Eliminate Cargo.lock.msrv
We no longer need it since updating our MSRV to 1.56.1.

Issue #1809
2022-08-25 19:25:00 -06:00
Alan Somers
2cba3afa78 Raise the MSRV to 1.56.1 in anticipation of the next release
And fix some documentation lints warned about by the newer rustdoc.
2022-08-14 09:53:42 -06:00
Alan Somers
42ca951f60 Reenable cargo-hack in CI
But instead of building it from source, download pre-built binaries.
2022-08-12 16:52:03 -06:00
Alan Somers
8a63e3e5d9 Also raise the MSRV just for cross-tests. Cross uses Serde too. 2022-08-11 17:57:10 -06:00
Alan Somers
8c65c3702d Disable cargo-hack in CI
Serde accidentally raised its MSRV to 1.51.0 in a patch release.  They
don't intent to fix it. Nix uses Serde via cargo-hack in CI.  Disable it
so we can publish a final release at 1.46.0.
2022-08-11 17:47:10 -06:00
Alan Somers
ca2c9208ec Pin cargo-hack to 0.5.14 in CI
Newer versions of cargo-hack require a newer toolchain to install
2022-07-23 14:46:42 -06:00
Alan Somers
dc1a34b864 Clippy cleanup in the tests.
* Remove a redundant closure.
* Comparison with null
* Manual implementation of find
* Suppress a false positive
2022-07-10 08:43:04 -06:00
Ryan Zoeller
d0d48f214b Pin cross to 0.2.1, as 0.2.2 requires Rust 1.58.1 2022-06-25 21:27:15 -05:00
Costin-Robert Sin
8f08a69c28 Add format test to CI
To enforce uniformity for all PRs, the CI checks if the code
is formatted rigth using `cargo fmt` tool.

Signed-off-by: Costin-Robert Sin <sin.costinrobert@gmail.com>
2022-06-24 00:35:31 +03:00
Al Hoang
d02e27476c add haiku support
* enabled as much functionality and defines that match
  updated libc definitions for haiku
2022-05-14 18:45:18 -05:00
Alan Somers
0c07a9e469 Rewrite the aio module
The existing AIO implementation has some problems:
1) The in_progress field is checked at runtime, not compile time.
2) The mutable field is checked at runtime, not compile time.
3) A downstream lio_listio user must store extra state to track whether
   the whole operation is partially, completely, or not at all
   submitted.
4) Nix does heap allocation itself, rather than allowing the caller to
   choose it.  This can result in double (or triple, or quadruple)
   boxing.
5) There's no easy way to use lio_listio to submit multiple operations with
   a single syscall, but poll each individually.
6) The lio_listio usage is far from transparent and zero-cost.
7) No aio_readv or aio_writev support.
8) priority has type c_int; should be i32
9) aio_return should return a usize instead of an isize, since it only
   uses negative values to indicate errors, which Rust represents via
   the Result type.

This rewrite solves several problems:
1) Unsolved.  I don't think it can be solved without something like
   C++'s guaranteed type elision.  It might require changing the
   signature of Future::poll too.
2) Solved.
3) Solved, by the new in_progress method and by removing the complicated
   lio_listio resubmit code.
4) Solved.
5) Solved.
6) Solved, by removing the lio_listo resubmit code.  It can be
   reimplemented downstream if necessary.  Or even in Nix, but it
   doesn't fit Nix's theme of zero-cost abstractions.
7) Solved.
8) Solved.
9) Solved.

The rewrite includes functions that don't work on FreeBSD, so add CI
testing for FreeBSD 14 too.

By default only enable tests that will pass on FreeBSD 12.3.  But run a
CI job on FreeBSD 14 and set a flag that will enable such tests.
2022-05-14 13:34:11 -06:00
bors[bot]
6f57f2e11d
Merge #1699
1699: Revert "Pin nightly compiler used in CI for uclibc" r=rtzoeller a=asomers

This reverts commit 23f18dfc18.

libc v0.2.124 fixes the problem.

Co-authored-by: Alan Somers <asomers@gmail.com>
2022-05-11 02:34:14 +00:00
Ryan Zoeller
ad7d45a0bf Log compiler version in Cirrus CI 2022-05-06 22:07:05 -05:00
Alan Somers
c5927f3dab Revert "Pin nightly compiler used in CI for uclibc"
This reverts commit 23f18dfc18.

libc v0.2.124 fixes the problem.
2022-04-18 20:23:23 -06:00
bors[bot]
bfb290bf2b
Merge #1698
1698: Update FreeBSD CI image to 12.3.  12.2 is EoL. r=rtzoeller a=asomers



Co-authored-by: Alan Somers <asomers@gmail.com>
2022-04-15 01:44:05 +00:00
Alan Somers
7497b8a9e5 Update FreeBSD CI image to 12.3. 12.2 is EoL. 2022-04-14 09:31:19 -06:00
Alan Somers
23f18dfc18 Pin nightly compiler used in CI for uclibc
Workaround for https://github.com/rust-lang/rust/issues/95866
2022-04-10 12:40:31 -06:00
Alan Somers
333d03be5d Use the nightly toolchain for Redox
The latest redox-syscall crate requires at least Rust 1.59.0, but they
don't define an MSRV policy.  And the version given in the
rust-toolchain file in the Redox repository doesn't work.  So until they
clarify their MSRV, use nightly.

30f29c3295
2022-03-25 18:09:37 -06:00
Ryan Zoeller
b637f12bf9 Add support for aarch64-apple-darwin
Replace 'OSX' language with 'macOS', to match Rust's language.
2022-01-29 23:39:21 -06:00
Jonah Petri
6c4b9133f1 uclibc support 2022-01-24 10:06:35 -05:00
Alan Somers
475da53d56 Better type safety for mqueue
On some platforms, mqd_t is a pointer.  That means code like the below
can trigger a segfault.  Fix it by defining a Newtype around mqd_t that
prevents use-after-free and dangling pointer scenarios.

```rust
fn invalid_mqd_t() {
    let mqd: libc::mqd_t = std::ptr::null_mut();
    mq_close(mqd).unwrap();
}
```

Also, get test coverage for mqueue in CI on FreeBSD.
2022-01-22 14:48:48 -07:00
Ryan Zoeller
3674d58b6f Re-enable deprecation warnings on DragonFly
Use latest nightly compiler.
2022-01-12 22:03:55 -06:00
Alan Somers
0b4717d3a4 try cargo-hack on Redox. It might work. 2021-12-20 23:11:25 -07:00
Alan Somers
a91424f614 Use the correct toolchain for cargo-hack 2021-12-20 23:11:25 -07:00
Vincent Dagonneau
5f5b7d4d7a feature-gate most Nix functions
Using features reduces build time and size for consumer crates.  By
default all features are enabled.
2021-12-20 18:47:16 -07:00
Alan Somers
ac159d9c4e Pin the nightly compiler version used with DragonflyBSD
Newer rustc is broken on DragonflyBSD, probably by e68887e67c
2021-12-14 22:12:29 -07:00
Alan Somers
77bc02e110 Update the OSX test environment for Big Sur
Big Sur is the first OSX version that supports preadv/pwritev
2021-12-14 20:47:29 -07:00
Aleksey Kladov
9735c5f524 Ensure that MSRV tests do not regress
When testing with older versions of rustc, there's a CI failure mode
when our dependency, which used to be compatible with that Rust version,
publishes a new version which can't be compiled using that old Rust
anymore. That's pretty unfortunate, as that means that third parties can
break our CI without any changes to the code in this repo.

To protect against that, let's use Cargo.lock on CI, but only when
testing against older versions. For stable Rust, we continue to generate
Cargo.lock with freshest dependencies. Implementation wise, we save
known-good Cargo.lock as `Cargo.lock.msrv`, and just copy that in every
relevant CI job.

To get a working `Cargo.lock.msrv`, I run `cargo +nightly
generate-lockfile -Zminimal-versions` -- that is guaranteed to support
the oldest Rust version we can.
2021-11-18 12:28:34 +03:00
Alan Somers
0df82ded47 Suppress deprecation warnings on Dragonfly
libc::stat is deprecated on DragonflyBSD in libc.  But there isn't any
alternative yet, so Nix must simply suppress the warnings.  It's used in
too many places to suppress each one individually, so just suppress all
deprecation warnings globally until it's properly fixed.

https://github.com/rust-lang/libc/pull/2522
2021-11-15 20:52:58 -07:00
Alan Somers
3ad742fadc Update Redox compiler.
The latest libc uses the native_link_modifiers feature, which isn't
known by the old compiler used in the Redox builds.  Update Redox's
compiler to that used by the Redox project itself.
2021-11-15 18:54:06 -07:00
Alan Somers
18b73602b8 Revert "Suppress a warning from the latest clippy"
This reverts commit fb1ae125d9.

Nightly clippy removed the warning in question.
2021-11-15 18:50:10 -07:00
Alan Somers
39f1c99b49 Revert "Temporarily use Rust 1.51.0 for testing cross-based builds"
This reverts commit 5e7c5f6e88.

Upstream swiftly fixed the bug.
2021-10-22 17:43:54 -06:00
Alan Somers
5e7c5f6e88 Temporarily use Rust 1.51.0 for testing cross-based builds
A bug in gimli-rs/object is causing the build to fail at the
"cargo install cross" step.  Until that's fixed, we must use Rust 1.51.0
or newer for cross-based builds.

https://github.com/gimli-rs/object/issues/394
2021-10-21 19:43:31 -06:00
Alan Somers
fb1ae125d9 Suppress a warning from the latest clippy 2021-10-03 15:09:40 -06:00
Alan Somers
a09b1c8ac6 Clippy cleanup
And this time, start running Clippy in CI
2021-09-19 07:58:15 -06:00
Alan Somers
5771d8e9bc Update the FreeBSD CI image
FreeBSD 11.4 will be EoL on 30-Sept
2021-09-17 16:51:48 -06:00
Alan Somers
3a2163a21a Check Dragonfly BSD and OpenBSD in CI
Build, but don't test, for these operating systems.  Thanks to
@rtzoeller for the tip.

Also, fix the OpenBSD build.
2021-09-04 16:49:16 -06:00
Alan Somers
70d8cf3104 DRY in the CI config
* Define the build and test scripts once instead of repeating them
* Don't use cross with OSX.  We no longer need it.
2021-09-04 16:15:22 -06:00
Alan Somers
b6f7da61d8 Document more things
Also, test rustdoc in CI, and demote missing_docs from a deny to a
warning (but still deny it in CI).
2021-09-04 11:44:17 -06:00
Alan Somers
18c095b367 Ignore vsock tests on Linux aarch64
Apparently AWS Graviton containers don't support it.  socket() retunrs
EAFNOSUPPORT in that environment.

Also, be more selective about skipping tests under QEMU

Instead of skipping them on architectures where we happen to use QEMU,
only skip them when QEMU is actually being used.
2021-08-27 22:31:20 -06:00
Alan Somers
a593227c7e Test Linux aarch64 on real aarch64 hardware. 2021-08-27 21:06:53 -06:00
Alan Somers
d20fe20af7 Multiple CI improvements:
* Install cross the easy way, via cargo
* Don't test in release mode.  Nix contains no release-dependent paths,
  and release mode testing has to my knowledge never revealed a bug in
  Nix.
* Add Linux powerpc back to CI, fixed by the latest cross.
* Check the tests even on platforms that can't run them.
* DRY for the Illumos and Redox sections
* Cross-check iOS from a Linux VM instead of OSX
* Revert the workaround for rust-lang/rustup issue 2774
2021-08-22 10:33:07 -06:00
Alan Somers
8acdaef51a Remove support for 32-bit Apple targets 2021-08-13 17:58:33 -06:00
Alan Somers
5495bbce52 Fix the build with bitflags-1.3.0 and newer
Bitflags raised its MSRV in a minor version, forcing all consumers to
follow suit.

Fixes #1491
2021-08-13 17:39:04 -06:00
Alan Somers
5ac876e17d Adapt aio to the world of async/await, and fix some potential unsoundness.
* libc::aiocb must not be moved while the kernel has a pointer to it.
  This change enforces that requirement by using std::pin.

* Split LioCbBuilder out of LioCb.  struct LioCb relied on the
  (incorrect) assumption that a Vec's elements have a stable location in
  memory.  That's not true; they can be moved during Vec::push.  The
  solution is to use a Vec in the new Builder struct, but finalize it to
  a boxed slice (which doesn't support push) before allowing it to be
  submitted to the kernel.

* Eliminate owned buffer types.  mio-aio no longer uses owned buffers
  with nix::aio.  There's little need for it in the world of
  async/await.  I'm not aware of any other consumers.  This
  substantially simplifies the code.
2021-05-30 17:41:47 -06:00
Alan Somers
5f0807a352 Workaround Rustup bug 2774
A regression in rustup has broken that tool on FreeBSD.  Set
RUSTUP_IO_THREADS=1 as a workaround.
https://github.com/rust-lang/rustup/issues/2774
2021-05-23 07:49:58 -06:00
Alan Somers
2ba6999e2e Check all tests in CI
Travis didn't compile check tests on platforms that couldn't run tests
in CI, so they bitrotted.  Let's see how bad they are.

Most annoyingly, 32-bit Android defines mode_t as 16 bits, but
stat.st_mode as 32-bits.
2021-04-04 19:32:54 -06:00
Jason King
d444f1bcf2 illumos and Solaris support
Co-authored-by: Dominik Hassler <hadfl@omnios.org>
Co-authored-by: Joshua M. Clulow <josh@sysmgr.org>
2021-03-21 23:04:03 +00:00