Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the nightly toolchain. #562

Merged
merged 1 commit into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ jobs:
# optimal for the Azure Standard_DS2_v2 VM, which is the VM type used by
# GitHub Actions at the time of this writing.
#
# We have to append the "-D warnings" flag to .cargo/config rather than
# using the RUSTFLAGS environment variable because if we set RUSTFLAGS
# cargo will ignore the rustflags config in .cargo/config, breaking
# relocation.
# We have to append the "-D warnings" flag to .cargo/config.toml rather
# than using the RUSTFLAGS environment variable because if we set
# RUSTFLAGS cargo will ignore the rustflags config in .cargo/config,
# breaking relocation.
- name: Build and Test
run: |
sudo apt-get install ninja-build
cd "${GITHUB_WORKSPACE}"
echo "[target.'cfg(all())']" >> .cargo/config
echo 'rustflags = ["-D", "warnings"]' >> .cargo/config
echo "[target.'cfg(all())']" >> .cargo/config.toml
echo 'rustflags = ["-D", "warnings"]' >> .cargo/config.toml
make -j2 setup
make -j2 test
5 changes: 3 additions & 2 deletions apis/interface/console/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ impl<S: Syscalls, C: Config> Console<S, C> {

S::subscribe::<_, _, C, DRIVER_NUM, { subscribe::WRITE }>(subscribe, &called)?;

S::command(DRIVER_NUM, command::WRITE, s.len() as u32, 0).to_result()?;
S::command(DRIVER_NUM, command::WRITE, s.len() as u32, 0)
.to_result::<(), ErrorCode>()?;

loop {
S::yield_wait();
Expand Down Expand Up @@ -87,7 +88,7 @@ impl<S: Syscalls, C: Config> Console<S, C> {

// When this fails, `called` is guaranteed unmodified,
// because upcalls are never processed until we call `yield`.
S::command(DRIVER_NUM, command::READ, len as u32, 0).to_result()?;
S::command(DRIVER_NUM, command::READ, len as u32, 0).to_result::<(), ErrorCode>()?;

loop {
S::yield_wait();
Expand Down
2 changes: 1 addition & 1 deletion apis/net/ieee802154/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ impl<S: Syscalls, C: Config> Ieee802154<S, C> {
subscribe, &called,
)?;

S::command(DRIVER_NUM, command::TRANSMIT, 0, 0).to_result()?;
S::command(DRIVER_NUM, command::TRANSMIT, 0, 0).to_result::<(), ErrorCode>()?;

loop {
S::yield_wait();
Expand Down
6 changes: 3 additions & 3 deletions apis/peripherals/i2c_master/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ impl<S: Syscalls, C: Config> I2CMaster<S, C> {
cmd_arg0,
r_len.into(),
)
.to_result()?;
.to_result::<(), ErrorCode>()?;

loop {
S::yield_wait();
Expand Down Expand Up @@ -112,7 +112,7 @@ impl<S: Syscalls, C: Config> I2CMaster<S, C> {
addr.into(),
len.into(),
)
.to_result()?;
.to_result::<(), ErrorCode>()?;

loop {
S::yield_wait();
Expand Down Expand Up @@ -163,7 +163,7 @@ impl<S: Syscalls, C: Config> I2CMaster<S, C> {
addr.into(),
len.into(),
)
.to_result()?;
.to_result::<(), ErrorCode>()?;

loop {
S::yield_wait();
Expand Down
13 changes: 8 additions & 5 deletions apis/peripherals/i2c_master_slave/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ impl<S: Syscalls, C: Config> I2CMasterSlave<S, C> {

S::subscribe::<_, _, C, DRIVER_NUM, { subscribe::MASTER_WRITE }>(subscribe, &called)?;

S::command(DRIVER_NUM, i2c_master_slave_cmd::MASTER_WRITE, cmd_arg0, 0).to_result()?;
S::command(DRIVER_NUM, i2c_master_slave_cmd::MASTER_WRITE, cmd_arg0, 0)
.to_result::<(), ErrorCode>()?;

loop {
S::yield_wait();
Expand Down Expand Up @@ -113,7 +114,8 @@ impl<S: Syscalls, C: Config> I2CMasterSlave<S, C> {
S::subscribe::<_, _, C, DRIVER_NUM, { subscribe::MASTER_READ }>(subscribe, &called)?;
// When this fails, `called` is guaranteed unmodified,
// because upcalls are never processed until we call `yield`.
S::command(DRIVER_NUM, i2c_master_slave_cmd::MASTER_READ, cmd_arg0, 0).to_result()?;
S::command(DRIVER_NUM, i2c_master_slave_cmd::MASTER_READ, cmd_arg0, 0)
.to_result::<(), ErrorCode>()?;

loop {
S::yield_wait();
Expand Down Expand Up @@ -208,7 +210,7 @@ impl<S: Syscalls, C: Config> I2CMasterSlave<S, C> {
cmd_arg0,
0,
)
.to_result()?;
.to_result::<(), ErrorCode>()?;

loop {
S::yield_wait();
Expand Down Expand Up @@ -293,7 +295,8 @@ impl<S: Syscalls, C: Config> I2CMasterSlave<S, C> {
S::allow_rw::<C, DRIVER_NUM, { rw_allow::SLAVE_RX }>(allow_rw, buf)?;
S::subscribe::<_, _, C, DRIVER_NUM, { subscribe::SLAVE_READ }>(subscribe, &called)?;

S::command(DRIVER_NUM, i2c_master_slave_cmd::SLAVE_START_LISTEN, 0, 0).to_result()?;
S::command(DRIVER_NUM, i2c_master_slave_cmd::SLAVE_START_LISTEN, 0, 0)
.to_result::<(), ErrorCode>()?;

loop {
S::yield_wait();
Expand Down Expand Up @@ -356,7 +359,7 @@ impl<S: Syscalls, C: Config> I2CMasterSlave<S, C> {
len as u32,
0,
)
.to_result()?;
.to_result::<(), ErrorCode>()?;

loop {
S::yield_wait();
Expand Down
2 changes: 1 addition & 1 deletion apis/peripherals/rng/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ impl<S: Syscalls> Rng<S> {
S::subscribe::<_, _, DefaultConfig, DRIVER_NUM, 0>(subscribe, &called)?;

// Send the command to the kernel driver to fill the allowed_readwrite buffer
S::command(DRIVER_NUM, GET_BYTES, n, 0).to_result()?;
S::command(DRIVER_NUM, GET_BYTES, n, 0).to_result::<(), ErrorCode>()?;

// Wait for a callback to happen
while !called.get() {
Expand Down
11 changes: 7 additions & 4 deletions apis/peripherals/spi_controller/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ impl<S: Syscalls, C: Config> SpiController<S, C> {
S::allow_ro::<C, DRIVER_NUM, { ro_allow::WRITE }>(allow_ro, w_buf)?;
S::subscribe::<_, _, C, DRIVER_NUM, { subscribe::COMPLETE }>(subscribe, &called)?;

S::command(DRIVER_NUM, spi_controller_cmd::READ_WRITE_BYTES, len, 0).to_result()?;
S::command(DRIVER_NUM, spi_controller_cmd::READ_WRITE_BYTES, len, 0)
.to_result::<(), ErrorCode>()?;

loop {
S::yield_wait();
Expand Down Expand Up @@ -88,7 +89,8 @@ impl<S: Syscalls, C: Config> SpiController<S, C> {
S::allow_ro::<C, DRIVER_NUM, { ro_allow::WRITE }>(allow_ro, w_buf)?;
S::subscribe::<_, _, C, DRIVER_NUM, { subscribe::COMPLETE }>(subscribe, &called)?;

S::command(DRIVER_NUM, spi_controller_cmd::READ_WRITE_BYTES, len, 0).to_result()?;
S::command(DRIVER_NUM, spi_controller_cmd::READ_WRITE_BYTES, len, 0)
.to_result::<(), ErrorCode>()?;

loop {
S::yield_wait();
Expand Down Expand Up @@ -121,7 +123,8 @@ impl<S: Syscalls, C: Config> SpiController<S, C> {
S::allow_rw::<C, DRIVER_NUM, { rw_allow::READ }>(allow_rw, r_buf)?;
S::subscribe::<_, _, C, DRIVER_NUM, { subscribe::COMPLETE }>(subscribe, &called)?;

S::command(DRIVER_NUM, spi_controller_cmd::READ_BYTES, len, 0).to_result()?;
S::command(DRIVER_NUM, spi_controller_cmd::READ_BYTES, len, 0)
.to_result::<(), ErrorCode>()?;

loop {
S::yield_wait();
Expand Down Expand Up @@ -163,7 +166,7 @@ impl<S: Syscalls, C: Config> SpiController<S, C> {
len,
0,
)
.to_result()?;
.to_result::<(), ErrorCode>()?;

loop {
S::yield_wait();
Expand Down
6 changes: 3 additions & 3 deletions apis/storage/key_value/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ impl<S: Syscalls, C: Config> KeyValue<S, C> {

S::subscribe::<_, _, C, DRIVER_NUM, { subscribe::CALLBACK }>(subscribe, &called)?;

S::command(DRIVER_NUM, command::GET, 0, 0).to_result()?;
S::command(DRIVER_NUM, command::GET, 0, 0).to_result::<(), ErrorCode>()?;

loop {
S::yield_wait();
Expand Down Expand Up @@ -69,7 +69,7 @@ impl<S: Syscalls, C: Config> KeyValue<S, C> {

S::subscribe::<_, _, C, DRIVER_NUM, { subscribe::CALLBACK }>(subscribe, &called)?;

S::command(DRIVER_NUM, command_num, 0, 0).to_result()?;
S::command(DRIVER_NUM, command_num, 0, 0).to_result::<(), ErrorCode>()?;

loop {
S::yield_wait();
Expand Down Expand Up @@ -112,7 +112,7 @@ impl<S: Syscalls, C: Config> KeyValue<S, C> {

S::subscribe::<_, _, C, DRIVER_NUM, { subscribe::CALLBACK }>(subscribe, &called)?;

S::command(DRIVER_NUM, command::DELETE, 0, 0).to_result()?;
S::command(DRIVER_NUM, command::DELETE, 0, 0).to_result::<(), ErrorCode>()?;

loop {
S::yield_wait();
Expand Down
2 changes: 1 addition & 1 deletion nightly/rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This is the nightly Rust toolchain used by `make test`.
[toolchain]
channel = "nightly-2024-04-19"
channel = "nightly-2024-11-11"
components = ["miri", "rust-src"]
2 changes: 1 addition & 1 deletion runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//! execute. It reads the `LIBTOCK_PLATFORM` variable to determine what location
//! to build for (see the `layouts/` directory to see what platforms are
//! available). It expects the following cargo config options to be set (e.g. in
//! `.cargo/config`):
//! `.cargo/config.toml`):
//! ```
//! [build]
//! rustflags = [
Expand Down
2 changes: 1 addition & 1 deletion unittest/src/fake/syscalls/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ mod yield_impl_tests;
// executes this. It is used by submodules of fake::syscalls.
fn assert_valid<T: core::fmt::Debug>(_value: T) {
#[cfg(miri)]
format!("{:?}", _value);
let _ = format!("{:?}", _value);
}
8 changes: 5 additions & 3 deletions unittest/src/fake/syscalls/subscribe_impl_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,23 +95,25 @@ fn skip_with_error() {
skip_with_error: Some(ErrorCode::NoAck),
});
unsafe extern "C" fn upcall_fn(_: u32, _: u32, _: u32, _: Register) {}
// Convert to a raw pointer to get a stable address.
let upcall_fn_ptr = upcall_fn as *const ();
let [r0, r1, r2, r3] = unsafe {
subscribe(
1u32.into(),
2u32.into(),
(upcall_fn as usize).into(),
upcall_fn_ptr.into(),
1234usize.into(),
)
};
let (r0, r1, r2, r3): (u32, u32, usize, usize) = (
let (r0, r1, r2, r3): (u32, u32, *const (), usize) = (
r0.try_into().expect("too large r0"),
r1.try_into().expect("too large r1"),
r2.into(),
r3.into(),
);
assert_eq!(r0, return_variant::FAILURE_2_U32.into());
assert_eq!(r1, ErrorCode::NoAck as u32);
assert_eq!(r2, upcall_fn as usize);
assert_eq!(r2, upcall_fn_ptr);
assert_eq!(r3, 1234);
}

Expand Down
13 changes: 8 additions & 5 deletions unittest/src/share_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ mod tests {
use super::*;
use crate::upcall::Upcall;
use crate::DriverInfo;
use libtock_platform::Register;
use std::rc::Rc;

#[derive(Default)]
Expand Down Expand Up @@ -140,6 +141,8 @@ mod tests {
// is a null upcall.
assert_eq!(mock_driver.share_ref.schedule_upcall(2, (3, 4, 5)), Ok(()));
unsafe extern "C" fn upcall(_: u32, _: u32, _: u32, _: libtock_platform::Register) {}
// Cast to a pointer to get a stable address.
let upcall_ptr = upcall as unsafe extern "C" fn(u32, u32, u32, Register);
with_kernel_data(|kernel_data| {
let kernel_data = kernel_data.unwrap();

Expand All @@ -150,7 +153,7 @@ mod tests {
kernel_data.drivers.get_mut(&1).unwrap().upcalls.insert(
2,
Upcall {
fn_pointer: Some(upcall),
fn_pointer: Some(upcall_ptr),
data: 1111usize.into(),
},
);
Expand All @@ -171,15 +174,15 @@ mod tests {
subscribe_num: 2
}
);
assert!(upcall_queue_entry.upcall.fn_pointer == Some(upcall));
assert!(upcall_queue_entry.upcall.fn_pointer == Some(upcall_ptr));
let data: usize = upcall_queue_entry.upcall.data.into();
assert_eq!(data, 1111);

// Register a non-null upcall.
kernel_data.drivers.get_mut(&1).unwrap().upcalls.insert(
2,
Upcall {
fn_pointer: Some(upcall),
fn_pointer: Some(upcall_ptr),
data: 2222u32.into(),
},
);
Expand All @@ -204,7 +207,7 @@ mod tests {
subscribe_num: 2
}
);
assert!(front_queue_entry.upcall.fn_pointer == Some(upcall));
assert!(front_queue_entry.upcall.fn_pointer == Some(upcall_ptr));
let front_data: usize = front_queue_entry.upcall.data.into();
assert_eq!(front_data, 1111);
let back_queue_entry = kernel_data.upcall_queue.back().expect("Upcall not queued");
Expand All @@ -216,7 +219,7 @@ mod tests {
subscribe_num: 2
}
);
assert!(back_queue_entry.upcall.fn_pointer == Some(upcall));
assert!(back_queue_entry.upcall.fn_pointer == Some(upcall_ptr));
let back_data: usize = back_queue_entry.upcall.data.into();
assert_eq!(back_data, 2222);
});
Expand Down
Loading