File tree Expand file tree Collapse file tree 3 files changed +54
-14
lines changed Expand file tree Collapse file tree 3 files changed +54
-14
lines changed Original file line number Diff line number Diff line change @@ -38,11 +38,13 @@ jobs:
38
38
run : cargo run --package tool-dev -- clippy
39
39
- name : Format
40
40
run : cargo run --package tool-dev -- fmt
41
+ - name : Test
42
+ run : cargo run --package tool-dev -- test
43
+ - name : Bench
44
+ run : cargo run --package tool-dev -- bench
41
45
- name : Build
42
46
id : build
43
47
run : cargo run --package tool-dev -- build --target ${{ matrix.target }}
44
- - name : Test
45
- run : cargo run --package tool-dev -- test --target ${{ matrix.target }}
46
48
- name : Upload Artifact
47
49
uses : actions/upload-artifact@v4
48
50
with :
Original file line number Diff line number Diff line change
1
+ #![ feature( test) ]
2
+
3
+ extern crate test;
4
+
5
+ use kill_tree:: { get_available_max_process_id, Config } ;
6
+ use test:: Bencher ;
7
+
8
+ #[ bench]
9
+ fn kill_tree ( b : & mut Bencher ) {
10
+ b. iter ( || {
11
+ let target_process_id = get_available_max_process_id ( ) ;
12
+ kill_tree:: blocking:: kill_tree ( target_process_id) . unwrap ( ) ;
13
+ } ) ;
14
+ }
15
+
16
+ #[ bench]
17
+ fn kill_tree_with_sigkill ( b : & mut Bencher ) {
18
+ b. iter ( || {
19
+ let target_process_id = get_available_max_process_id ( ) ;
20
+ let config = Config {
21
+ signal : String :: from ( "SIGKILL" ) ,
22
+ ..Default :: default ( )
23
+ } ;
24
+ kill_tree:: blocking:: kill_tree_with_config ( target_process_id, & config) . unwrap ( ) ;
25
+ } ) ;
26
+ }
27
+
28
+ #[ bench]
29
+ fn kill_tree_exclude_target ( b : & mut Bencher ) {
30
+ b. iter ( || {
31
+ let target_process_id = get_available_max_process_id ( ) ;
32
+ let config = Config {
33
+ include_target : false ,
34
+ ..Default :: default ( )
35
+ } ;
36
+ kill_tree:: blocking:: kill_tree_with_config ( target_process_id, & config) . unwrap ( ) ;
37
+ } ) ;
38
+ }
Original file line number Diff line number Diff line change @@ -15,14 +15,12 @@ enum Command {
15
15
Check ,
16
16
Clippy ,
17
17
Fmt ,
18
+ Bench ,
19
+ Test ,
18
20
Build {
19
21
#[ arg( short, long) ]
20
22
target : String ,
21
23
} ,
22
- Test {
23
- #[ arg( short, long) ]
24
- target : Option < String > ,
25
- } ,
26
24
PrePush ,
27
25
}
28
26
@@ -84,19 +82,20 @@ fn build(target: &str) {
84
82
}
85
83
}
86
84
87
- fn test ( target : Option < String > ) {
88
- if let Some ( target ) = target {
89
- run ! ( "cargo test --target {target}" ) ;
90
- } else {
91
- run ! ( "cargo test --workspace" ) ;
92
- }
85
+ fn test ( ) {
86
+ run ! ( "cargo test --workspace --all-targets --all-features" ) ;
87
+ }
88
+
89
+ fn bench ( ) {
90
+ run ! ( "cargo bench --workspace --all-targets --all-features" ) ;
93
91
}
94
92
95
93
fn pre_push ( ) {
96
94
check ( ) ;
97
95
clippy ( ) ;
98
96
fmt ( ) ;
99
- test ( None ) ;
97
+ test ( ) ;
98
+ bench ( ) ;
100
99
}
101
100
102
101
fn init_log ( ) {
@@ -119,8 +118,9 @@ fn main() {
119
118
Command :: Check => check ( ) ,
120
119
Command :: Clippy => clippy ( ) ,
121
120
Command :: Fmt => fmt ( ) ,
121
+ Command :: Bench => bench ( ) ,
122
+ Command :: Test => test ( ) ,
122
123
Command :: Build { target } => build ( & target) ,
123
- Command :: Test { target } => test ( target) ,
124
124
Command :: PrePush => pre_push ( ) ,
125
125
}
126
126
}
You can’t perform that action at this time.
0 commit comments