Skip to content

Commit

Permalink
test: ✅ 使用属性宏「ignore」忽略部分【不宜参与整体测试】的测试
Browse files Browse the repository at this point in the history
①忽略所有「整体测试后留下残余子进程」的测试(OpenNARS、NARS-Python)②忽略Websocket相关、仅用于快捷运行的「持续性压力测试」
  • Loading branch information
ARCJ137442 committed Apr 14, 2024
1 parent 446842e commit 5f92c98
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "babel_nar"
version = "0.21.0"
version = "0.21.1"
edition = "2021"
description = """
Implementation and application supports of the NAVM model
Expand Down
1 change: 1 addition & 0 deletions src/bin/babelnar_cli/arg_parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ mod tests {

/// 测试/成功的解析
#[test]
#[ignore = "【2024-04-14 20:24:52】会导致残留子进程"]
fn test_arg_parse() {
test_arg_parse! {
["-c", ARG_PARSE_TEST]
Expand Down
6 changes: 5 additions & 1 deletion src/bin/babelnar_cli/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ mod tests {
/// 批量生成「预引入NAL」
macro_rules! cin_tests {
(
$cin_path:expr;
$(#[$attr_root:meta])*
$cin_path:ident; // ! ❌若为`expr`,则会和上边的修饰符导致「本地歧义」
$(
$(#[$attr:meta])*
$name:ident => $config_path:expr $(;)?
Expand All @@ -155,6 +156,7 @@ mod tests {
/// 主Shell
/// * 🎯正常BabelNAR CLI shell启动
/// * 🎯正常用户命令行交互体验
$(#[$attr_root])*
#[test]
pub fn main_shell() -> Result<()> {
main($cin_path, &[])
Expand All @@ -163,6 +165,7 @@ mod tests {

/// Matriangle服务器
/// * 🎯复现先前基于Matriangle环境的NARS实验
$(#[$attr_root])*
#[test]
pub fn main_matriangle_server() -> Result<()> {
// 以默认参数启动
Expand Down Expand Up @@ -219,6 +222,7 @@ mod tests {
use super::*;

cin_tests! {
#[ignore = "【2024-04-14 20:24:52】会导致残留子进程"]
OPENNARS;

/// 简单演绎
Expand Down
2 changes: 2 additions & 0 deletions src/bin/ws_server_test/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ fn main() {
}

#[test]
#[ignore = "【2024-04-14 20:38:45】仅作为其它Websocket服务端的压力测试,不应在库测试中出现"]
fn test_overwhelming_nse() {
loop {
let _ = ws::connect("ws://127.0.0.1:8765", |sender| {
Expand All @@ -123,6 +124,7 @@ fn test_overwhelming_nse() {
/// 压力测试
/// * 🔗GitHub issue:<https://github.com/housleyjk/ws-rs/issues/346>
#[test]
#[ignore = "【2024-04-14 20:38:45】仅作为其它Websocket服务端的压力测试,不应在库测试中出现"]
fn main_server() {
// A client that sends tons of messages to the server
thread::spawn(move || {
Expand Down
1 change: 1 addition & 0 deletions src/cin_implements/nars_python/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ mod tests {
};

#[test]
#[ignore = "【2024-04-14 20:24:52】会导致残留子进程"]
fn test() {
// 从别的地方获取exe路径
let exe_path = NARS_PYTHON;
Expand Down
1 change: 1 addition & 0 deletions src/cin_implements/openjunars/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ mod tests {
};

#[test]
#[ignore = "【2024-04-14 20:24:52】会导致残留子进程"]
fn test() {
// 从别的地方获取jl路径
let jl_path = OPENJUNARS;
Expand Down
2 changes: 2 additions & 0 deletions src/cin_implements/opennars/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ mod tests {

/// 测试
#[test]
#[ignore = "【2024-04-14 20:24:52】会导致残留子进程"]
fn test() {
// 启动OpenNARS虚拟机
let vm = launch_vm();
Expand All @@ -44,6 +45,7 @@ mod tests {

/// 测试/通用 | 基于Narsese
#[test]
#[ignore = "【2024-04-14 20:24:52】会导致残留子进程"]
fn test_universal() {
// 启动OpenNARS虚拟机
let vm = launch_vm();
Expand Down
1 change: 1 addition & 0 deletions src/runtimes/command_vm/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,7 @@ pub mod tests {
/// 示例测试 | OpenNARS
/// * 🚩通过Java命令启动
#[test]
#[ignore = "【2024-04-14 20:24:52】会导致残留子进程"]
fn test_opennars() {
// 构造指令
let mut command_java = Command::new(COMMAND_JAVA);
Expand Down

0 comments on commit 5f92c98

Please sign in to comment.