Skip to content

Commit

Permalink
Fixed rust-toolchain, fix problems in CI (#138)
Browse files Browse the repository at this point in the history
* feat: set specific rust-toolchain version, fix some clippy warning, update qemu version in ci

* feat: add build-latest-nightly workflow

* fix: rename build-latest-nightly action

* feat: use matrix to set rust-toolchain

* WIP: try to modify build_c.mk to fix c app compile error

* fix: add enable-slirp in setup-qemu, problem exists in build_c.mk

* :feat: update cache key in setup-qemu action

* fix: qemu install bug by add libslirp-dev

* fix: update qemu_build cache key

* fix: update qemu_build cache key in qemu run

* fix: use -a in app_test.sh line37 grep

* feat: change memory layout of pthread_mutex_t in build.rs

* feat: change memory layout of pthread_mutex_t in build.rs under no smp

* feat: add #[cfg(feature = preempt)] in percpu_macros

* fix: delete #[cfg(feature = preempt)] in percpu_macros

* fix: delete async from build-dependencies

* feat: update toolchain version, fix error in errno
  • Loading branch information
hky1999 authored Jan 26, 2024
1 parent 7eeebc5 commit 9f51c1d
Show file tree
Hide file tree
Showing 14 changed files with 28 additions and 28 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/actions/setup-qemu/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,25 @@ runs:
uses: actions/cache/restore@v3
with:
path: qemu_build
key: qemu-${{ inputs.qemu-version }}
key: qemu-${{ inputs.qemu-version }}-slirp-1
- name: Download and build QEMU
if: steps.cache-qemu.outputs.cache-hit != 'true'
env:
QEMU_PATH: qemu-${{ inputs.qemu-version }}
PREFIX: ${{ github.workspace }}/qemu_build
shell: bash
run: |
sudo apt-get update && sudo apt-get install -y ninja-build
sudo apt-get update && sudo apt-get install -y ninja-build libslirp-dev
wget https://download.qemu.org/$QEMU_PATH.tar.xz && tar -xJf $QEMU_PATH.tar.xz
cd $QEMU_PATH \
&& ./configure --prefix=$PREFIX --target-list=x86_64-softmmu,riscv64-softmmu,aarch64-softmmu \
&& ./configure --prefix=$PREFIX --target-list=x86_64-softmmu,riscv64-softmmu,aarch64-softmmu --enable-slirp \
&& make -j > /dev/null 2>&1 \
&& make install
- uses: actions/cache/save@v3
if: steps.cache-qemu.outputs.cache-hit != 'true'
with:
path: qemu_build
key: qemu-${{ inputs.qemu-version }}
key: qemu-${{ inputs.qemu-version }}-slirp-1

- name: Install QEMU
shell: bash
Expand Down
16 changes: 9 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,19 @@ name: Build CI

on: [push, pull_request]

env:
rust-toolchain: nightly

jobs:
clippy:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
rust-toolchain: [nightly, nightly-2024-01-19]
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ env.rust-toolchain }}
toolchain: ${{ matrix.rust-toolchain }}
components: rust-src, clippy, rustfmt
- name: Clippy for the default target
run: make clippy
Expand All @@ -35,12 +34,13 @@ jobs:
matrix:
os: [ubuntu-latest]
arch: [x86_64, riscv64, aarch64]
rust-toolchain: [nightly, nightly-2024-01-19]
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ env.rust-toolchain }}
toolchain: ${{ matrix.rust-toolchain }}
components: rust-src
- uses: actions-rs/[email protected]
with:
Expand Down Expand Up @@ -102,12 +102,13 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
rust-toolchain: [nightly, nightly-2024-01-19]
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ env.rust-toolchain }}
toolchain: ${{ matrix.rust-toolchain }}
components: rust-src
- uses: actions-rs/[email protected]
with:
Expand Down Expand Up @@ -142,12 +143,13 @@ jobs:
matrix:
os: [ubuntu-latest]
arch: [x86_64]
rust-toolchain: [nightly, nightly-2024-01-19]
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ env.rust-toolchain }}
toolchain: ${{ matrix.rust-toolchain }}
- name: Build helloworld
run: cargo build -p arceos-helloworld
- name: Build memtest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Build & Deploy docs
on: [push, pull_request]

env:
rust-toolchain: nightly
rust-toolchain: nightly-2024-01-19

jobs:
doc:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ name: Test CI
on: [push, pull_request]

env:
qemu-version: 7.1.0
rust-toolchain: nightly
qemu-version: 8.2.0
rust-toolchain: nightly-2024-01-19

jobs:
unit-test:
Expand Down
1 change: 0 additions & 1 deletion api/arceos_api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
//! [ArceOS]: https://github.com/rcore-os/arceos
#![no_std]
#![feature(ip_in_core)]
#![feature(doc_auto_cfg)]
#![feature(doc_cfg)]
#![allow(unused_imports)]
Expand Down
4 changes: 2 additions & 2 deletions api/arceos_posix_api/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ fn main() {
// TODO: generate size and initial content automatically.
let (mutex_size, mutex_init) = if cfg!(feature = "multitask") {
if cfg!(feature = "smp") {
(6, "{0, 8, 0, 0, 0, 0}") // core::mem::transmute::<_, [usize; 6]>(axsync::Mutex::new(()))
(6, "{0, 0, 8, 0, 0, 0}") // core::mem::transmute::<_, [usize; 6]>(axsync::Mutex::new(()))
} else {
(5, "{8, 0, 0, 0, 0}") // core::mem::transmute::<_, [usize; 5]>(axsync::Mutex::new(()))
(5, "{0, 8, 0, 0, 0}") // core::mem::transmute::<_, [usize; 5]>(axsync::Mutex::new(()))
}
} else {
(1, "{0}")
Expand Down
4 changes: 2 additions & 2 deletions api/arceos_posix_api/src/imp/pthread/mutex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ use core::ffi::c_int;
use core::mem::{size_of, ManuallyDrop};

static_assertions::const_assert_eq!(
size_of::<PthreadMutex>(),
size_of::<ctypes::pthread_mutex_t>()
size_of::<ctypes::pthread_mutex_t>(),
size_of::<PthreadMutex>()
);

#[repr(C)]
Expand Down
1 change: 0 additions & 1 deletion api/arceos_posix_api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
//! [ArceOS]: https://github.com/rcore-os/arceos
#![cfg_attr(all(not(test), not(doc)), no_std)]
#![feature(ip_in_core)]
#![feature(doc_cfg)]
#![feature(doc_auto_cfg)]
#![allow(clippy::missing_safety_doc)]
Expand Down
8 changes: 5 additions & 3 deletions crates/driver_net/src/ixgbe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,13 @@ impl<H: IxgbeHal, const QS: usize, const QN: u16> NetDriverOps for IxgbeNic<H, Q
// RX buffer have received packets.
Ok(self.rx_buffer_queue.pop_front().unwrap())
} else {
// RX queue is empty, receive from ixgbe NIC.
match self.inner.receive_packets(0, RECV_BATCH_SIZE, |rx_buf| {
let f = |rx_buf| {
let rx_buf = NetBufPtr::from(rx_buf);
self.rx_buffer_queue.push_back(rx_buf);
}) {
};

// RX queue is empty, receive from ixgbe NIC.
match self.inner.receive_packets(0, RECV_BATCH_SIZE, f) {
Ok(recv_nums) => {
if recv_nums == 0 {
// No packet is received, it is impossible things.
Expand Down
1 change: 0 additions & 1 deletion modules/axnet/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
//! [smoltcp]: https://github.com/smoltcp-rs/smoltcp
#![no_std]
#![feature(ip_in_core)]
#![feature(new_uninit)]

#[macro_use]
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[toolchain]
profile = "minimal"
channel = "nightly"
channel = "nightly-2024-01-19"
components = ["rust-src", "llvm-tools-preview", "rustfmt", "clippy"]
targets = ["x86_64-unknown-none", "riscv64gc-unknown-none-elf", "aarch64-unknown-none-softfloat"]
2 changes: 1 addition & 1 deletion scripts/test/app_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function compare() {
fi
IFS=''
while read -r line; do
local matched=$(grep -m1 "$line" < "$actual")
local matched=$(grep -m1 -a "$line" < "$actual")
if [ -z "$matched" ]; then
MSG="pattern \"${BLOD_C}$line${END_C}\" not matched!"
unset IFS
Expand Down
2 changes: 1 addition & 1 deletion ulib/axlibc/src/errno.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub fn set_errno(code: i32) {
/// Returns a pointer to the global errno variable.
#[no_mangle]
pub unsafe extern "C" fn __errno_location() -> *mut c_int {
&mut errno
core::ptr::addr_of_mut!(errno)
}

/// Returns a pointer to the string representation of the given error code.
Expand Down
1 change: 0 additions & 1 deletion ulib/axstd/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
#![cfg_attr(all(not(test), not(doc)), no_std)]
#![feature(doc_cfg)]
#![feature(doc_auto_cfg)]
#![feature(ip_in_core)]

#[cfg(feature = "alloc")]
extern crate alloc;
Expand Down

0 comments on commit 9f51c1d

Please sign in to comment.