add cargo fmt in Makefile, and exec make fmt
This commit is contained in:
parent
3979bfcfe0
commit
ef70c1aa73
7 changed files with 41 additions and 31 deletions
2
Makefile
2
Makefile
|
@ -6,3 +6,5 @@ docker:
|
||||||
|
|
||||||
build_docker:
|
build_docker:
|
||||||
docker build -t ${DOCKER_NAME} .
|
docker build -t ${DOCKER_NAME} .
|
||||||
|
fmt:
|
||||||
|
cd easy-fs; cargo fmt; cd ../easy-fs-fuse cargo fmt; cd ../os ; cargo fmt; cd ../user; cargo fmt; cd ..
|
|
@ -69,7 +69,6 @@ pub trait QEMUExit {
|
||||||
fn exit_failure(&self) -> !;
|
fn exit_failure(&self) -> !;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// RISCV64 configuration
|
/// RISCV64 configuration
|
||||||
pub struct RISCV64 {
|
pub struct RISCV64 {
|
||||||
/// Address of the sifive_test mapped device.
|
/// Address of the sifive_test mapped device.
|
||||||
|
|
|
@ -7,16 +7,18 @@ extern crate user_lib;
|
||||||
extern crate alloc;
|
extern crate alloc;
|
||||||
extern crate core;
|
extern crate core;
|
||||||
|
|
||||||
use user_lib::{thread_create, waittid, exit, sleep};
|
|
||||||
use alloc::vec::Vec;
|
use alloc::vec::Vec;
|
||||||
use core::sync::atomic::{AtomicUsize, Ordering};
|
use core::sync::atomic::{AtomicUsize, Ordering};
|
||||||
|
use user_lib::{exit, sleep, thread_create, waittid};
|
||||||
|
|
||||||
const N: usize = 2;
|
const N: usize = 2;
|
||||||
const THREAD_NUM: usize = 10;
|
const THREAD_NUM: usize = 10;
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||||
enum FlagState {
|
enum FlagState {
|
||||||
Out, Want, In,
|
Out,
|
||||||
|
Want,
|
||||||
|
In,
|
||||||
}
|
}
|
||||||
|
|
||||||
static mut TURN: usize = 0;
|
static mut TURN: usize = 0;
|
||||||
|
@ -56,8 +58,11 @@ fn eisenberg_enter_critical(id: usize) {
|
||||||
if prior_thread.is_none() {
|
if prior_thread.is_none() {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
println!("Thread[{}]: prior thread {} exist, sleep and retry",
|
println!(
|
||||||
id, prior_thread.unwrap());
|
"Thread[{}]: prior thread {} exist, sleep and retry",
|
||||||
|
id,
|
||||||
|
prior_thread.unwrap()
|
||||||
|
);
|
||||||
sleep(1);
|
sleep(1);
|
||||||
}
|
}
|
||||||
/* now tentatively claim the resource */
|
/* now tentatively claim the resource */
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate user_lib;
|
extern crate user_lib;
|
||||||
|
|
||||||
use user_lib::{exit, fork, getpid, sleep, yield_, wait};
|
use user_lib::{exit, fork, getpid, sleep, wait, yield_};
|
||||||
|
|
||||||
const DEPTH: usize = 4;
|
const DEPTH: usize = 4;
|
||||||
|
|
||||||
|
|
|
@ -8,9 +8,9 @@ extern crate user_lib;
|
||||||
extern crate alloc;
|
extern crate alloc;
|
||||||
extern crate core;
|
extern crate core;
|
||||||
|
|
||||||
use user_lib::{thread_create, waittid, exit, sleep};
|
|
||||||
use core::sync::atomic::{AtomicUsize, Ordering};
|
|
||||||
use alloc::vec::Vec;
|
use alloc::vec::Vec;
|
||||||
|
use core::sync::atomic::{AtomicUsize, Ordering};
|
||||||
|
use user_lib::{exit, sleep, thread_create, waittid};
|
||||||
const N: usize = 3;
|
const N: usize = 3;
|
||||||
|
|
||||||
static mut TURN: usize = 0;
|
static mut TURN: usize = 0;
|
||||||
|
|
|
@ -115,7 +115,11 @@ pub fn main() -> i32 {
|
||||||
let succ_num = run_tests(SUCC_TESTS);
|
let succ_num = run_tests(SUCC_TESTS);
|
||||||
let err_num = run_tests(FAIL_TESTS);
|
let err_num = run_tests(FAIL_TESTS);
|
||||||
if succ_num == SUCC_TESTS.len() as i32 && err_num == FAIL_TESTS.len() as i32 {
|
if succ_num == SUCC_TESTS.len() as i32 && err_num == FAIL_TESTS.len() as i32 {
|
||||||
println!("{} of sueecssed apps, {} of failed apps run correctly. \nUsertests passed!", SUCC_TESTS.len(), FAIL_TESTS.len() );
|
println!(
|
||||||
|
"{} of sueecssed apps, {} of failed apps run correctly. \nUsertests passed!",
|
||||||
|
SUCC_TESTS.len(),
|
||||||
|
FAIL_TESTS.len()
|
||||||
|
);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if succ_num != SUCC_TESTS.len() as i32 {
|
if succ_num != SUCC_TESTS.len() as i32 {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue