From b90487a46bb37e4295329731ee1dc6f6743982be Mon Sep 17 00:00:00 2001 From: duc-nx <> Date: Wed, 21 Aug 2024 15:46:13 -0400 Subject: [PATCH] Fix missing `cycles` features in guest in host command Summary: Test Plan: Update `test_sdk.sh` to catch missing feature bugs. --- .github/workflows/ci.yml | 3 +-- assets/scripts/test_sdk.sh | 13 ++++++++++--- cli/src/command/host.rs | 2 ++ 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d615e1d2..fe3a910b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -57,7 +57,6 @@ 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 @@ -65,7 +64,7 @@ jobs: 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 diff --git a/assets/scripts/test_sdk.sh b/assets/scripts/test_sdk.sh index a7016bd0..133622d4 100755 --- a/assets/scripts/test_sdk.sh +++ b/assets/scripts/test_sdk.sh @@ -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 " @@ -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 } @@ -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 } diff --git a/cli/src/command/host.rs b/cli/src/command/host.rs index 7d2013af..565fbb4c 100644 --- a/cli/src/command/host.rs +++ b/cli/src/command/host.rs @@ -140,6 +140,8 @@ fn setup_crate(host_path: PathBuf, rev: Option, tag: Option) -> "# 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", ) )?;