From 6d56cd8a5f58ffbbf8596c15cac42b59c2afb961 Mon Sep 17 00:00:00 2001 From: David Brown Date: Thu, 19 Aug 2021 11:06:57 -0600 Subject: [PATCH] sim: Move Cargo package to top level Instead of having to cd into the 'sim' directory, create a top-level Cargo.toml file that adds the sim as a workspace. For the most part, this doesn't change how the simulator works. It is still possible to run `cargo test ...` within the `sim` directory. However, the `target` directory will reside at the top-level of the tree instead of within the sim directory. One change is that running cargo commands at the top of the tree will run those commands on all of the packages found within the tree. Specific packages can be tested by either changing to the directory of that package, or passing `-p ` to the cargo test command (i.e. `cargo test -p bootsim`). The other visible change from this commit is that the 'target' directory will always be at the top of the tree, rather than in particular directory where the test is run. Any scripts or tools that expect this to be in a certainly location, will have to be modified. Signed-off-by: David Brown --- .gitignore | 3 +++ sim/Cargo.lock => Cargo.lock | 0 Cargo.toml | 13 +++++++++++++ sim/Cargo.toml | 10 ---------- 4 files changed, 16 insertions(+), 10 deletions(-) rename sim/Cargo.lock => Cargo.lock (100%) create mode 100644 Cargo.toml diff --git a/.gitignore b/.gitignore index 4169afcd..79866888 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,6 @@ rusty-tags.* # Python egg metadata, regenerated from source files by setuptools. /scripts/*.egg-info /scripts/*.egg + +# The target directory from Rust development +/target/ diff --git a/sim/Cargo.lock b/Cargo.lock similarity index 100% rename from sim/Cargo.lock rename to Cargo.lock diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 00000000..46b8a672 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,13 @@ +[workspace] +members = ["sim"] +exclude = ["ptest"] + +# The simulator runs very slowly without optimization. A value of 1 +# compiles in about half the time, but runs about 5-6 times slower. 2 +# and 3 are hardly different in either compile time or performance. +# Use 2 in case that makes the code slightly more debuggable. +[profile.test] +opt-level = 2 + +[profile.dev] +opt-level = 2 diff --git a/sim/Cargo.toml b/sim/Cargo.toml index 3c47324c..5d5555ea 100644 --- a/sim/Cargo.toml +++ b/sim/Cargo.toml @@ -49,13 +49,3 @@ cipher = "0.3" aes = { version = "0.7.4", features = ["ctr"] } base64 = "0.13.0" typenum = "1.13.0" - -# The simulator runs very slowly without optimization. A value of 1 -# compiles in about half the time, but runs about 5-6 times slower. 2 -# and 3 are hardly different in either compile time or performance. -# Use 2 in case that makes the code slightly more debuggable. -[profile.test] -opt-level = 2 - -[profile.dev] -opt-level = 2