forked from able/aos_userland
add in aos_stress_test
This commit is contained in:
parent
0ffd50df94
commit
31207b2550
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -1,2 +1,3 @@
|
||||||
/*/target
|
*/target
|
||||||
|
target
|
||||||
Cargo.lock
|
Cargo.lock
|
||||||
|
|
|
@ -2,4 +2,5 @@
|
||||||
|
|
||||||
members = [
|
members = [
|
||||||
"libwasm",
|
"libwasm",
|
||||||
|
"aos_wasm_stress_test",
|
||||||
]
|
]
|
6
aos_wasm_stress_test/.cargo/config.toml
Normal file
6
aos_wasm_stress_test/.cargo/config.toml
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
[build]
|
||||||
|
target = "wasm32-unknown-unknown"
|
||||||
|
|
||||||
|
# [unstable]
|
||||||
|
# build-std = ["core", "compiler_builtins", "alloc"]
|
||||||
|
# build-std-features = ["compiler-builtins-mem"]
|
10
aos_wasm_stress_test/Cargo.toml
Normal file
10
aos_wasm_stress_test/Cargo.toml
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
[package]
|
||||||
|
name = "aos_wasm_stress_test"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
libwasm = {path="../libwasm"}
|
||||||
|
# mice = "0.11.0"
|
3
aos_wasm_stress_test/build.sh
Executable file
3
aos_wasm_stress_test/build.sh
Executable file
|
@ -0,0 +1,3 @@
|
||||||
|
cargo build --release
|
||||||
|
wasm-strip target/wasm32-unknown-unknown/release/aos_wasm_stress_test.wasm
|
||||||
|
mv target/wasm32-unknown-unknown/release/aos_wasm_stress_test.wasm aos_wasm_stress_test.wasm
|
4
aos_wasm_stress_test/readme.md
Normal file
4
aos_wasm_stress_test/readme.md
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
|
||||||
|
This is a stress test and simple program for ableOS.
|
||||||
|
|
||||||
|
|
31
aos_wasm_stress_test/src/main.rs
Normal file
31
aos_wasm_stress_test/src/main.rs
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
#![no_std]
|
||||||
|
#![no_main]
|
||||||
|
|
||||||
|
use libwasm::driver::DriverExitCode;
|
||||||
|
|
||||||
|
#[no_mangle]
|
||||||
|
fn start() -> i32 {
|
||||||
|
let rand;
|
||||||
|
unsafe {
|
||||||
|
send_signal(PID(1), Signals::Quit);
|
||||||
|
rand = get_random();
|
||||||
|
}
|
||||||
|
|
||||||
|
rand as i32
|
||||||
|
}
|
||||||
|
|
||||||
|
#[no_mangle]
|
||||||
|
fn driver_entry() {}
|
||||||
|
|
||||||
|
#[no_mangle]
|
||||||
|
fn driver_exit() -> DriverExitCode {
|
||||||
|
DriverExitCode::Success
|
||||||
|
}
|
||||||
|
|
||||||
|
use {
|
||||||
|
libwasm::get_random,
|
||||||
|
libwasm::process::{signals::Signals, PID},
|
||||||
|
libwasm::syscalls::send_signal,
|
||||||
|
};
|
||||||
|
|
||||||
|
mod panic;
|
6
aos_wasm_stress_test/src/panic.rs
Normal file
6
aos_wasm_stress_test/src/panic.rs
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
#[panic_handler]
|
||||||
|
fn panic(_info: &PanicInfo) -> ! {
|
||||||
|
loop {}
|
||||||
|
}
|
||||||
|
|
||||||
|
use core::panic::PanicInfo;
|
Loading…
Reference in a new issue