File tree Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
2
3
+ # inspired by https://doc.rust-lang.org/rustc/instrument-coverage.html#tips-for-listing-the-binaries-automatically
4
+ TEST_OBJECTS=$( \
5
+ for file in $( cargo test --no-run 2>&1 | grep " target/debug/deps/pgcat-[[:alnum:]]\+" -o) ; \
6
+ do \
7
+ printf " %s %s " --object $file ; \
8
+ done \
9
+ )
10
+
3
11
rust-profdata merge -sparse pgcat-* .profraw -o pgcat.profdata
4
12
5
- rust-cov export -ignore-filename-regex=" rustc|registry" -Xdemangler=rustfilt -instr-profile=pgcat.profdata --object ./target/debug/pgcat --format lcov > ./lcov.info
13
+ bash -c " rust-cov export -ignore-filename-regex=' rustc|registry' -Xdemangler=rustfilt -instr-profile=pgcat.profdata $TEST_OBJECTS --object ./target/debug/pgcat --format lcov > ./lcov.info"
6
14
7
15
genhtml lcov.info --output-directory /tmp/cov --prefix $( pwd)
Original file line number Diff line number Diff line change @@ -8,7 +8,11 @@ class PgcatProcess
8
8
attr_reader :pid
9
9
10
10
def self . finalize ( pid , log_filename , config_filename )
11
- `kill #{ pid } ` if pid
11
+ if pid
12
+ Process . kill ( "TERM" , pid )
13
+ Process . wait ( pid )
14
+ end
15
+
12
16
File . delete ( config_filename ) if File . exist? ( config_filename )
13
17
File . delete ( log_filename ) if File . exist? ( log_filename )
14
18
end
@@ -77,8 +81,8 @@ def wait_until_ready
77
81
def stop
78
82
return unless @pid
79
83
80
- ` kill #{ @pid } `
81
- sleep 0.1
84
+ Process . kill ( "TERM" , @pid )
85
+ Process . wait ( @pid )
82
86
@pid = nil
83
87
end
84
88
You can’t perform that action at this time.
0 commit comments