Skip to content

Commit 639ca32

Browse files
committed
[tests/full] Print daemon log on crash
1 parent 1c5d773 commit 639ca32

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

tests/full.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ impl Daemon {
6868
r#"
6969
version = "v1"
7070
pkcs11.lib-path = {lib_path:?}
71-
daemon.log-level = "info"
71+
daemon.log-level = "debug"
7272
daemon.log-target = {{ type = "file", path = {log_path:?} }}
7373
"#
7474
),
@@ -154,6 +154,13 @@ impl Drop for Daemon {
154154
// Stop the daemon.
155155
// TODO: Use SIGTERM?
156156
let _ = self.process.kill();
157+
158+
if std::thread::panicking() {
159+
// Try to provide the daemon log file.
160+
if let Ok(log) = std::fs::read_to_string(self.tempdir.path().join("log")) {
161+
eprintln!("kmip2pkcs11 log:\n{log}");
162+
}
163+
}
157164
}
158165
}
159166

0 commit comments

Comments
 (0)