Skip to content

Commit

Permalink
Fix micro_rpc cross workspace dependency
Browse files Browse the repository at this point in the history
Add a manual test to check regressions in the future.

Ref project-oak#4573
  • Loading branch information
tiziano88 committed Jan 2, 2024
1 parent 38d4d58 commit e43b1c7
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 6 deletions.
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ members = [
"linux_boot_params",
"micro_rpc",
"micro_rpc_build",
"micro_rpc_tests",
"micro_rpc_tests", "micro_rpc_workspace_test",
"oak_attestation_verification",
"oak_channel",
"oak_client",
Expand Down
7 changes: 2 additions & 5 deletions micro_rpc/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,8 @@

fn main() {
micro_rpc_build::compile(
&[format!(
"{}proto/micro_rpc/messages.proto",
env!("WORKSPACE_ROOT")
)],
&[env!("WORKSPACE_ROOT")],
&["../proto/micro_rpc/messages.proto"],
&["../proto"],
Default::default(),
);
}
2 changes: 2 additions & 0 deletions micro_rpc_workspace_test/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[env]
WORKSPACE_ROOT = { value = "_invalid_workspace_root_" }
7 changes: 7 additions & 0 deletions micro_rpc_workspace_test/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[package]
name = "micro_rpc_workspace_test"
version = "0.1.0"
edition = "2021"

[dependencies]
micro_rpc = { path = "../micro_rpc" }
15 changes: 15 additions & 0 deletions micro_rpc_workspace_test/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
This directory contains a manual test to check whether the `micro_rpc` crate can
be depended on from a crate in another workspace.

See https://github.com/project-oak/oak/issues/4573 for context.

This crate overwrites the `WORKSPACE_ROOT` env variable with an invalid value in
the `.cargo/config.toml` file, which is necessary to shadow the corresponding
one in the root of this repository, to simulate an external workspace that would
not have that env variable set.

To reproduce the issue, run the following command from the repository root:

```bash
env --chdir=./micro_rpc_workspace_test bash -c 'cargo clean && cargo build'
```
3 changes: 3 additions & 0 deletions micro_rpc_workspace_test/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fn main() {
println!("Hello, world!");
}

0 comments on commit e43b1c7

Please sign in to comment.