mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-21 00:06:34 +00:00
Add vsock_server test in ci
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
ad140cec3c
commit
50a2aead52
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
use alloc::sync::Arc;
|
use alloc::sync::Arc;
|
||||||
|
|
||||||
use aster_virtio::device::socket::{register_recv_callback, DEVICE_NAME};
|
use aster_virtio::device::socket::{get_device, register_recv_callback, DEVICE_NAME};
|
||||||
use common::VsockSpace;
|
use common::VsockSpace;
|
||||||
use spin::Once;
|
use spin::Once;
|
||||||
|
|
||||||
@ -15,9 +15,11 @@ pub use stream::VsockStreamSocket;
|
|||||||
pub static VSOCK_GLOBAL: Once<Arc<VsockSpace>> = Once::new();
|
pub static VSOCK_GLOBAL: Once<Arc<VsockSpace>> = Once::new();
|
||||||
|
|
||||||
pub fn init() {
|
pub fn init() {
|
||||||
VSOCK_GLOBAL.call_once(|| Arc::new(VsockSpace::new()));
|
if get_device(DEVICE_NAME).is_some() {
|
||||||
register_recv_callback(DEVICE_NAME, || {
|
VSOCK_GLOBAL.call_once(|| Arc::new(VsockSpace::new()));
|
||||||
let vsockspace = VSOCK_GLOBAL.get().unwrap();
|
register_recv_callback(DEVICE_NAME, || {
|
||||||
let _ = vsockspace.poll();
|
let vsockspace = VSOCK_GLOBAL.get().unwrap();
|
||||||
})
|
let _ = vsockspace.poll();
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,6 @@ VSOCK_DIR=/regression/vsock
|
|||||||
cd ${VSOCK_DIR}
|
cd ${VSOCK_DIR}
|
||||||
|
|
||||||
echo "Start vsock test......"
|
echo "Start vsock test......"
|
||||||
# ./vsock_server
|
|
||||||
./vsock_client
|
./vsock_client
|
||||||
|
./vsock_server
|
||||||
echo "Vsock test passed."
|
echo "Vsock test passed."
|
||||||
|
Reference in New Issue
Block a user