Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run simtest code coverage without --config flags #16134

Merged
merged 3 commits into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 8 additions & 14 deletions .github/workflows/cargo-llvm-cov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,20 +60,14 @@ jobs:
uses: codecov/codecov-action@v3
with:
files: lcov.info
fail_ci_if_error: true

# TODO: Will enable this once we get this work
#
# - name: Run code coverage for simtest
# run: |
# ./scripts/simtest/install.sh
# CODECOV=1 ./scripts/simtest/cargo-simtest simtest

# - name: Upload report to Codecov for simtest
# uses: codecov/codecov-action@v3
# with:
# files: lcov.info
# fail_ci_if_error: true

- name: Run code coverage for simtest
run: ./scripts/simtest/codecov.sh

- name: Upload report to Codecov for simtest
uses: codecov/codecov-action@v3
with:
files: lcov-simtest.info

notify:
name: Notify
Expand Down
4 changes: 0 additions & 4 deletions scripts/simtest/cargo-simtest
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,6 @@ if [ "$1" = "build" ]; then
CARGO_COMMAND=(build --profile simulator)
fi

if [ -n "$CODECOV" ]; then
CARGO_COMMAND=(llvm-cov --ignore-run-fail --lcov --output-path lcov.info nextest --cargo-profile simulator)
fi

# Must supply a new temp dir - the test is deterministic and can't choose one randomly itself.
export TMPDIR=$(mktemp -d)

Expand Down
17 changes: 17 additions & 0 deletions scripts/simtest/codecov.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash -e
# Copyright (c) Mysten Labs, Inc.
# SPDX-License-Identifier: Apache-2.0

# verify that git repo is clean
if [[ -n $(git status -s) ]]; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mystenmark, why do we need this? This workflow is going to be run on ubuntu-ghcloud GH runner. So there should never be the case when repo is not clean

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

someone could run the script locally (e.g. to test it) and it could clobber local files

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mystenmark

  ./scripts/simtest/codecov.sh
  shell: /usr/bin/bash -e {0}
  env:
    CARGO_TERM_COLOR: always
    CARGO_INCREMENTAL: 0
    CARGO_NET_RETRY: 10
    RUSTUP_MAX_RETRIES: 10
    RUST_BACKTRACE: short
    RUSTDOCFLAGS: -D warnings
    CACHE_ON_FAILURE: false
Working directory is not clean. Please commit all changes before running this script.  ./scripts/simtest/codecov.sh
  shell: /usr/bin/bash -e {0}
  env:
    CARGO_TERM_COLOR: always
    CARGO_INCREMENTAL: 0
    CARGO_NET_RETRY: 10
    RUSTUP_MAX_RETRIES: 10
    RUST_BACKTRACE: short
    RUSTDOCFLAGS: -D warnings
    CACHE_ON_FAILURE: false
Working directory is not clean. Please commit all changes before running this script.

Is what I was afraid of when this script gets run. I feel like these are two different cases here

echo "Working directory is not clean. Please commit all changes before running this script."
exit 1
fi

# apply git patch
git apply ./scripts/simtest/config-patch

MSIM_WATCHDOG_TIMEOUT_MS=60000 MSIM_TEST_SEED=1 cargo llvm-cov --ignore-run-fail --lcov --output-path lcov-simtest.info nextest --cargo-profile simulator

# remove the patch
git checkout .cargo/config Cargo.toml Cargo.lock
36 changes: 36 additions & 0 deletions scripts/simtest/config-patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
diff --git a/.cargo/config b/.cargo/config
index 7369a2afce..5254870044 100644
--- a/.cargo/config
+++ b/.cargo/config
@@ -20,11 +20,11 @@ move-clippy = [
"-Aclippy::upper_case_acronyms",
"-Aclippy::type_complexity",
# Remove after https://github.com/rust-lang/rust-clippy/pull/11792 is released.
"-Aclippy::map_identity",
"-Aclippy::new_without_default",
"-Aclippy::box_default",
"-Aclippy::manual_slice_size_calculation",
]

[build]
-rustflags = ["-C", "force-frame-pointers=yes", "-C", "force-unwind-tables=yes"]
+rustflags = ["-C", "force-frame-pointers=yes", "-C", "force-unwind-tables=yes", "--cfg", "msim"]
diff --git a/Cargo.toml b/Cargo.toml
index 3b1ca4591c..e4ff4d61d2 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -672,10 +672,14 @@ semver = "1.0.16"
spinners = "4.1.0"
include_dir = "0.7.3"


# Using the workspace-hack via this patch directive means that it only applies
# while building within this workspace. If another workspace imports a crate
# from here via a git dependency, it will not have the workspace-hack applied
# to it.
[patch.crates-io.workspace-hack]
path = "crates/workspace-hack"
+
+[patch.crates-io]
+tokio = { git = "https://github.com/MystenLabs/mysten-sim.git", rev = "1a52783d6600ecc22e15253a982f77881bd47c77" }
+futures-timer = { git = "https://github.com/MystenLabs/mysten-sim.git", rev = "1a52783d6600ecc22e15253a982f77881bd47c77" }
Loading