Skip to content

Commit 16d122f

Browse files
committed
remove release_max_level_error feature
Signed-off-by: Jorge Prendes <jorge.prendes@gmail.com>
1 parent 3c4841a commit 16d122f

2 files changed

Lines changed: 74 additions & 1 deletion

File tree

src/hyperlight-js-runtime/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ serde = { version = "1.0.228", default-features = false, features = ["derive", "
2727
serde_json = { version = "1.0.149", default-features = false, features = ["alloc"] }
2828
sha2 = { version = "0.10" , default-features = false, features = ["force-soft"]}
2929
spin = "0.10"
30-
tracing = { version = "0.1.44", default-features = false, features = ["log","attributes","max_level_trace","release_max_level_error"] }
30+
tracing = { version = "0.1.44", default-features = false, features = ["log","attributes","max_level_trace"] }
3131

3232
[target.'cfg(hyperlight)'.dependencies]
3333
hyperlight-common = { workspace = true, default-features = false }
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
/*
2+
Copyright 2026 The Hyperlight Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
//! Test to verify that tracing features are configured correctly.
18+
//!
19+
//! This test ensures that `release_max_level_error` is NOT enabled for the
20+
//! tracing crate in hyperlight-js-runtime. Having this feature enabled would
21+
//! suppress all log levels above error in release builds, which prevents
22+
//! tracing from working correctly.
23+
//!
24+
//! See: https://github.com/hyperlight-dev/hyperlight-js/issues/126
25+
26+
#![cfg(not(hyperlight))]
27+
28+
/// Verifies that the `release_max_level_error` feature is not enabled for
29+
/// the tracing crate when building hyperlight-js-runtime.
30+
///
31+
/// This is important because enabling `release_max_level_error` would
32+
/// cause all trace/debug/info/warn log levels to be compiled out in
33+
/// release builds, breaking the tracing functionality.
34+
#[test]
35+
fn tracing_does_not_have_release_max_level_error() {
36+
let mut cmd = std::process::Command::new(env!("CARGO"));
37+
let output = cmd
38+
.arg("tree")
39+
.arg("-p")
40+
.arg("hyperlight-js-runtime")
41+
.arg("-f")
42+
.arg("{f}")
43+
.arg("-i")
44+
.arg("tracing")
45+
.arg("--depth")
46+
.arg("0")
47+
.env("RUSTFLAGS", "--cfg=hyperlight --check-cfg=cfg(hyperlight)")
48+
.output()
49+
.expect("Failed to run cargo hyperlight tree");
50+
51+
assert!(
52+
output.status.success(),
53+
"cargo hyperlight tree failed: {}",
54+
String::from_utf8_lossy(&output.stderr)
55+
);
56+
57+
let stdout = String::from_utf8_lossy(&output.stdout);
58+
let features: Vec<&str> = stdout.trim().split(',').collect();
59+
60+
assert!(
61+
!features.contains(&"release_max_level_error"),
62+
"tracing crate should NOT have 'release_max_level_error' feature enabled.\n\
63+
Enabled features: {stdout}\n\
64+
See: https://github.com/hyperlight-dev/hyperlight-js/issues/126"
65+
);
66+
67+
// Also verify that the expected features ARE enabled
68+
assert!(
69+
features.contains(&"max_level_trace"),
70+
"tracing crate should have 'max_level_trace' feature enabled.\n\
71+
Enabled features: {stdout}"
72+
);
73+
}

0 commit comments

Comments
 (0)