asterinas/kernel/libs/comp-sys/cargo-component/tests/violate_policy.rs

18 lines
558 B
Rust
Raw Normal View History

2024-01-03 03:22:36 +00:00
// Licensed under the Apache License, Version 2.0 or the MIT License.
// Copyright (C) 2023-2024 Ant Group.
//! This test checks that if controlled resource not in whitelist is visited, cargo-component will
//! report warning message.
2023-02-07 08:05:21 +00:00
#![feature(once_cell)]
mod test_utils;
#[test]
fn violate_policy() {
2023-03-08 07:42:21 +00:00
let stderr = run_cargo_component_cmd!();
2023-02-07 08:05:21 +00:00
assert!(stderr.contains("access controlled entry point is disallowed"));
assert!(stderr.contains("access foo3::foo_add in bar3"));
assert!(stderr.contains("access foo3::FOO_ITEM in bar3"));
2023-02-07 08:05:21 +00:00
}