diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e839d191..fe8251d2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -362,7 +362,7 @@ jobs: alsa-lib atk clang clang-libs clang-resource-filesystem \ clang-tools-extra cmake cups curl dosfstools g++ gcc git \ git-lfs glibc-devel glibc-devel.i686 glibc-static \ - glibc-static.i686 gtk3 lld lld-devel lld-libs llvm llvm-libs \ + glibc-static.i686 gtk3 jq lld lld-devel lld-libs llvm llvm-libs \ llvm-static make mesa-libgbm mtools ninja-build openssl \ openssl-devel openssl-libs python3 python3-pip yamllint @@ -465,10 +465,21 @@ jobs: - name: CT39 - Clippy Check Project run: | - cargo clippy \ + cargo clippy > clippy.log \ || ( echo "❗ [CT39 (1/2)] Failed clippy static analysis checks" && exit 1 ) + cargo clippy --message-format=json 2> /dev/null | jq 'select(.reason == "compiler-message")' 2>/dev/null > clippy.json + cargo clippy --message-format=json > clippy-full.json 2>&1 echo "✅ [CT39 (1/2)] Passed clippy static analysis checks" + - name: Upload Clippy Check Results + uses: actions/upload-artifact@v4 + with: + name: clippy-json + path: | + clippy.json + clippy-full.json + clippy.log + - name: Test Project run: | SIMICS_TEST_CLEANUP_EACH=1 SIMICS_TEST_LOCAL_PACKAGES_ONLY=1 cargo test --no-fail-fast -r _latest || ( echo "❗ Tests failed" && exit 1 ) diff --git a/simics-rs/cargo-simics-build/Cargo.toml b/simics-rs/cargo-simics-build/Cargo.toml index 3c7cd1f2..56a57b67 100644 --- a/simics-rs/cargo-simics-build/Cargo.toml +++ b/simics-rs/cargo-simics-build/Cargo.toml @@ -30,6 +30,6 @@ clap = { version = "4.5.1", features = ["derive"] } cargo-subcommand = { version = "0.12.0", features = ["clap"] } command-ext = "0.1.2" simics-package = { version = "0.1.0", path = "../simics-package" } -itertools = "0.12.1" +itertools = "0.13.0" ispm-wrapper = { version = "0.1.0", path = "../ispm-wrapper" } thiserror = "1.0.57" diff --git a/simics-rs/cargo-simics-build/src/lib.rs b/simics-rs/cargo-simics-build/src/lib.rs index d9cd66f0..3128c138 100644 --- a/simics-rs/cargo-simics-build/src/lib.rs +++ b/simics-rs/cargo-simics-build/src/lib.rs @@ -285,7 +285,7 @@ impl App { .and_then(|n| n.to_str().map(|n| (p, n.to_string()))) }) .sorted_by(|(_, a), (_, b)| a.cmp(b)) - .group_by(|(_, n)| n.clone()) + .chunk_by(|(_, n)| n.clone()) // Get the newest one .into_iter() .filter_map(|(_, g)| { diff --git a/simics-rs/simics-api-sys/build.rs b/simics-rs/simics-api-sys/build.rs index 72de0a93..5ba7f385 100644 --- a/simics-rs/simics-api-sys/build.rs +++ b/simics-rs/simics-api-sys/build.rs @@ -174,7 +174,7 @@ pub mod common { match p.path().canonicalize() { Ok(p) => p.strip_prefix(&include_path).map_or_else( |e| { - eprintln!( + println!( "cargo:warning=Failed to strip prefix {} from {}: {}", include_path.as_ref().display(), p.display(), @@ -185,7 +185,7 @@ pub mod common { |p| Some(p.to_path_buf()), ), Err(e) => { - eprintln!( + println!( "cargo:warning=Failed to canonicalize path {}: {}", p.path().display(), e @@ -194,7 +194,7 @@ pub mod common { } } } else { - eprintln!( + println!( "cargo:warning=Ignoring path {}, no '.h' extension", p.path().display() ); @@ -202,7 +202,7 @@ pub mod common { } } None => { - eprintln!( + println!( "cargo:warning=Ignoring path {}, no extension", p.path().display() ); diff --git a/simics-rs/simics-build-utils/src/lib.rs b/simics-rs/simics-build-utils/src/lib.rs index f8e62aaa..e245556e 100644 --- a/simics-rs/simics-build-utils/src/lib.rs +++ b/simics-rs/simics-build-utils/src/lib.rs @@ -32,6 +32,22 @@ where .ok_or_else(|| anyhow!("No sub-directories found")) } +/// Emit expected CFG directives for check-cfg feature tests +pub fn emit_expected_cfg_directives() { + println!("cargo:rustc-check-cfg=cfg(simics_version_6)"); + println!("cargo:rustc-check-cfg=cfg(simics_version_7)"); + + // We emit all the way up to 9.99.999 as expected CFG directives + for i in 6_00_000..7_99_999 { + println!( + "cargo:rustc-check-cfg=cfg(simics_version_{}_{}_{})", + i / 100_000, + i / 1_000 % 100, + i % 1_000 + ); + } +} + /// Emit CFG directives for the version of the Simics API being compiled against. For example, /// simics_version_6_0_185 and simics_version_6. Both a full triple version and a major version /// directive is emitted. @@ -43,6 +59,8 @@ pub fn emit_cfg_directives() -> Result<()> { // compatible with all supported SIMICS versions, based on the SIMICS version of the // low level bindings. + emit_expected_cfg_directives(); + let simics_api_version = versions::Versioning::new(simics_api_sys::SIMICS_VERSION) .ok_or_else(|| anyhow!("Invalid version {}", simics_api_sys::SIMICS_VERSION))?;