Skip to content

Commit

Permalink
Fix missing cycles features in guest in host command
Browse files Browse the repository at this point in the history
Summary:

Test Plan:

Update `test_sdk.sh` to catch missing feature bugs.
  • Loading branch information
duc-nx committed Aug 21, 2024
1 parent c703c59 commit b90487a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,14 @@ jobs:
- uses: actions/checkout@v4
- run: rustup target add riscv32i-unknown-none-elf
- run: assets/scripts/smoke.sh examples/src/bin/fib3_profiling.rs
- run: assets/scripts/smoke.sh examples/src/bin/hello.rs

test-sdk:
needs: check-build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: rustup target add riscv32i-unknown-none-elf
- run: assets/scripts/test_sdk.sh examples/src/bin/hello.rs
- run: assets/scripts/test_sdk.sh examples/src/bin/fib3_profiling.rs

detect-unused-crate:
runs-on: ubuntu-latest
Expand Down
13 changes: 10 additions & 3 deletions assets/scripts/test_sdk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
set -e

ORIGINAL_DIR=$(pwd)
PROJECT_NAME="/tmp/nexus-host-ci"
PROJECT_NAME="/tmp/nexus-host-ci1"
CARGO_NEXUS="$(pwd)/target/release/cargo-nexus"

function usage() {
echo "Usage: $0 <file.rs>"
Expand Down Expand Up @@ -40,9 +41,9 @@ cargo build --release --package cargo-nexus --bin cargo-nexus

function create_nexus_project() {
if [[ -z "${GITHUB_SHA}" ]]; then
./target/release/cargo-nexus nexus host "$PROJECT_NAME"
$CARGO_NEXUS nexus host "$PROJECT_NAME"
else
./target/release/cargo-nexus nexus host "$PROJECT_NAME" --rev "${GITHUB_SHA}"
$CARGO_NEXUS nexus host "$PROJECT_NAME" --rev "${GITHUB_SHA}"
fi
}

Expand All @@ -52,6 +53,12 @@ cp "$1" "$PROJECT_NAME/src/guest/src/main.rs"

function run_project() {
cargo update

# Test the cycles feature inside the guest project
pushd src/guest
$CARGO_NEXUS nexus run
popd

cargo run --release
}

Expand Down
2 changes: 2 additions & 0 deletions cli/src/command/host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ fn setup_crate(host_path: PathBuf, rev: Option<String>, tag: Option<String>) ->
"# Generated by cargo-nexus, do not remove!\n",
"#\n",
"# This profile is used for generating proofs, as Nexus VM support for compiler optimizations is still under development.\n",
"[features]\n",
"cycles = [] # Enable cycle counting for run command\n",
)
)?;

Expand Down

0 comments on commit b90487a

Please sign in to comment.