diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 35eb985..0090fb0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,8 +8,7 @@ on: env: CARGO_TERM_COLOR: always - QT_BUILD_VERSION: 6.2.2 - + QT_BUILD_VERSION: 6.10.0 jobs: build: @@ -17,15 +16,16 @@ jobs: fail-fast: false matrix: variants: + # - {os: ubuntu-22.04, config: release, compiler: gcc_64, aqt_os: linux, aqt_compiler: gcc_64} - {os: ubuntu-24.04, config: release, compiler: gcc_64, aqt_os: linux, aqt_compiler: gcc_64} # - {os: ubuntu-24.04-arm, config: release, compiler: linux_gcc_arm64, aqt_os: linux_arm64, aqt_compiler: linux_gcc_arm64} - - {os: windows-2019, config: release, compiler: msvc2019_64, aqt_os: windows, aqt_compiler: win64_msvc2019_64} - - {os: macos-13, config: release, compiler: clang_64, aqt_os: mac, aqt_compiler: clang_64} + # - {os: windows-2022, config: release, compiler: msvc2022_64, aqt_os: windows, aqt_compiler: win64_msvc2022_64} + - {os: windows-2025, config: release, compiler: msvc2022_64, aqt_os: windows, aqt_compiler: win64_msvc2022_64} - {os: macos-14, config: release, compiler: clang_64, aqt_os: mac, aqt_compiler: clang_64} - - {os: macos-15, config: release, compiler: clang_64, aqt_os: mac, aqt_compiler: clang_64} + # - {os: macos-15, config: release, compiler: clang_64, aqt_os: mac, aqt_compiler: clang_64} runs-on: ${{ matrix.variants.os }} steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - uses: actions/cache@v4 with: path: | @@ -38,49 +38,33 @@ jobs: target/ key: ${{ matrix.variants.os }}-${{ runner.arch }}-cargo-${{ hashFiles('**/Cargo.lock') }} - - name: Build (Linux) - if: startsWith(matrix.variants.os, 'ubuntu-') - run: | - python -m pip install aqtinstall --user --upgrade - python -m aqt install-qt -O libdie++/build ${{ matrix.variants.aqt_os }} desktop ${{ env.QT_BUILD_VERSION }} ${{ matrix.variants.aqt_compiler }} - export QT6_LIB_PATH="`pwd`/libdie++/build/${{ env.QT_BUILD_VERSION }}/${{ matrix.variants.compiler }}/lib" - cargo build -vv --tests --examples - echo QT6_LIB_PATH=${QT6_LIB_PATH} >> $GITHUB_ENV - - - name: Build (macOS) - if: startsWith(matrix.variants.os, 'macos-') - run: | - python -m pip install aqtinstall --user --upgrade - python -m aqt install-qt -O libdie++/build ${{ matrix.variants.aqt_os }} desktop ${{ env.QT_BUILD_VERSION }} ${{ matrix.variants.aqt_compiler }} - export QT6_LIB_PATH="`pwd`/libdie++/build/${{ env.QT_BUILD_VERSION }}/macos/lib" - cargo build -vv --tests --examples - echo QT6_LIB_PATH=${QT6_LIB_PATH} >> $GITHUB_ENV - - name: Build (Windows) if: startsWith(matrix.variants.os, 'windows-') run: | - python -m pip install aqtinstall --user --upgrade - python -m aqt install-qt -O libdie++/build ${{ matrix.variants.aqt_os }} desktop ${{ env.QT_BUILD_VERSION }} ${{ matrix.variants.aqt_compiler }} $env:QT6_LIB_PATH="./libdie++/build/${{ env.QT_BUILD_VERSION }}/${{ matrix.variants.compiler }}/lib" - cargo build -vv --tests --examples + $env:DIE_DB_PATH="./libdie++/install/die/db/db" + cargo build -vv --tests --examples --release + cp ./libdie++/install/die/*.dll . + cargo test -vv --release + cargo run --release --example scan_file -- -vv C:\Windows\System32\winver.exe - - name: Tests (Linux) + - name: Build (Linux) if: startsWith(matrix.variants.os, 'ubuntu-') run: | export QT6_LIB_PATH="`pwd`/libdie++/build/${{ env.QT_BUILD_VERSION }}/${{ matrix.variants.compiler }}/lib" - export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${QT6_LIB_PATH} + export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:`pwd`/libdie++/build/${{ env.QT_BUILD_VERSION }}/${{ matrix.variants.compiler }}/lib" + export DIE_DB_PATH="`pwd`/libdie++/install/die/db/db" + cargo build -vv --tests --examples cargo test -vv + cargo run --example scan_file -- -vv /bin/ls --database-path ${DIE_DB_PATH} - - name: Tests (macOS) + - name: Build (macOS) if: startsWith(matrix.variants.os, 'macos-') run: | export QT6_LIB_PATH="`pwd`/libdie++/build/${{ env.QT_BUILD_VERSION }}/macos/lib" - export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${QT6_LIB_PATH} + export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:`pwd`/libdie++/build/${{ env.QT_BUILD_VERSION }}/macos/lib" + export DIE_DB_PATH="`pwd`/libdie++/install/die/db/db" + cargo build -vv --tests --examples cargo test -vv + cargo run --example scan_file -- -vv /bin/ls --database-path ${DIE_DB_PATH} - - name: Tests (Windows) - if: startsWith(matrix.variants.os, 'windows-') - run: | - $env:QT6_LIB_PATH="./libdie++/build/${{ env.QT_BUILD_VERSION }}/${{ matrix.variants.compiler }}/lib" - cp -v ./libdie++/install/die/*.dll . - cargo test -vv diff --git a/.gitignore b/.gitignore index 4e52b77..3aa78e6 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ libdie++/build libdie++/install .vscode aqtinstall.log +*.dll diff --git a/Cargo.lock b/Cargo.lock index 188c353..06c1ab3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -114,18 +114,18 @@ checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" [[package]] name = "derive_more" -version = "1.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a9b99b9cbbe49445b21764dc0625032a89b145a2642e67603e1c936f5458d05" +checksum = "093242cf7570c207c83073cf82f79706fe7b8317e98620a47d5be7c3d8497678" dependencies = [ "derive_more-impl", ] [[package]] name = "derive_more-impl" -version = "1.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb7330aeadfbe296029522e6c40f315320aba36fc43a5b3632f3795348f3bd22" +checksum = "bda628edc44c4bb645fbe0f758797143e4e07926f7ebf4e9bdfbd3d2ce621df3" dependencies = [ "proc-macro2", "quote", @@ -135,7 +135,7 @@ dependencies = [ [[package]] name = "die" -version = "0.1.0" +version = "0.2.0" dependencies = [ "bitflags", "clap", diff --git a/Cargo.toml b/Cargo.toml index 70cec87..1914c50 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "die" -version = "0.1.0" -edition = "2021" +version = "0.2.0" +edition = "2024" authors = ["Christophe Alladoum"] description = "Native Rust bindings for @horsicq's Detect-It-Easy" homepage = "https://github.com/elastic/die-rust" @@ -21,7 +21,7 @@ name = "scan_file" [dependencies] bitflags = "2.6.0" -derive_more = { version = "1.0.0", features = ["from", "display"] } +derive_more = { version = "2.0.1", features = ["from", "display"] } [dev-dependencies] clap = { version = "4.5.23", features = ["derive"] } diff --git a/README.md b/README.md index f52cfd0..c5cc923 100644 --- a/README.md +++ b/README.md @@ -12,20 +12,8 @@ This module provides Rust bindings for the [Detect-It-Easy](https://github.com/h ### Build -> [!IMPORTANT] -> [**Qt6**](https://qt.io) libraries must be installed for Detect-it-Easy to work. -> On Linux and macOS, `die-rust` can be built using the Qt6 provided by the typical package management systems (`apt`, `dnf`, `brew`, etc.). -> If you do not wish to install those packages system-wide, if you are running Windows, or if you wish/need to use a specific version of Qt6, it is possible to build `die-rust` by installing those libraries in a specific folder, using [`aqtinstall`](https://github.com/miurahr/aqtinstall) - (see below). Then build `die-rust` by passing the paths to the Qt6 libraries with the `QT6_LIB_PATH` environment. - -### As a dependency - -Use `cargo` to add `die-rust` as a dependency to your project: - -```console -cargo add --git https://github.com/elastic/die-rust.git -``` - -### On the terminal +> [!Warning] +> `Detect-It-Easy` has a hard requirement for Qt6 libraries. `cargo build` will manage the entire building process in an automated, but to be able to link against Qt6, it will use the library [`aqtinstall`](). Therefore `python` must be installed on the system. Note that downloading the Qt libraries may take some time, depending on your Internet connection. The installation can be done using `cargo`. @@ -35,40 +23,6 @@ cd die-rust cargo build ``` -The build requires Qt6 libraries. On Linux/macOS they can usually be obtained from the system's package manager. To use a specific Qt6 version, it is possible to use `aqtinstall` as follow - -### Linux - -```bash -export QT_BUILD_VERSION=6.2.2 -git clone https://github.com/elastic/die-rust.git && cd die-rust -python -m pip install aqtinstall -python -m aqt install-qt -O ./libdie++/build/ linux desktop ${QT_BUILD_VERSION} gcc_64 -export QT6_LIB_PATH=./libdie++/build/6.2.2/gcc_64/lib -``` - -### macOS - -```bash -export QT_BUILD_VERSION=6.2.2 -git clone https://github.com/calladoum-elastic/die-rust.git && cd die-rust -python -m pip install aqtinstall -python -m aqt install-qt -O ./libdie++/build/ mac desktop ${QT_BUILD_VERSION} clang_64 -export QT6_LIB_PATH=./libdie++/build/6.2.2/clang_64/lib # macos -``` - -### Windows - -```pwsh -$env:QT_BUILD_VERSION="6.2.2" -git clone https://github.com/calladoum-elastic/die-rust.git && cd die-rust -python -m pip install aqtinstall -python -m aqt install-qt -O ./libdie++/build/ windows desktop $env:QT_BUILD_VERSION win64_msvc2019_64 -$env:QT6_LIB_PATH="./libdie++/build/6.2.2/msvc2019_64/lib" -``` - - - ## Examples diff --git a/build.rs b/build.rs index 859304c..facd36d 100644 --- a/build.rs +++ b/build.rs @@ -1,10 +1,13 @@ +#[allow(dead_code)] // build.rs // https://doc.rust-lang.org/cargo/reference/build-scripts.html +use std::env; -const BASE_DIR: &'static str = "./libdie++"; -#[allow(dead_code)] -const BUILD_DIR: &'static str = "./libdie++/build"; -const INSTALL_DIR: &'static str = "./libdie++/install"; +const QT_VERSION: &'static str = "6.10.0"; +const BASE_DIR: &'static str = "."; +const LIBDIE_BASE_DIR: &'static str = "./libdie++"; +const LIBDIE_BUILD_DIR: &'static str = "./libdie++/build"; +const LIBDIE_INSTALL_DIR: &'static str = "./libdie++/install"; const LIB_DIE_PATH: &'static str = "./libdie++/build/_deps/dielibrary-build/src"; #[cfg(target_os = "windows")] @@ -15,52 +18,115 @@ const BUILD_TYPE: &'static str = "Debug"; #[cfg(not(debug_assertions))] const BUILD_TYPE: &'static str = "Release"; +fn get_qt_libs_path() -> String { + #[cfg(target_os = "windows")] + return format!("./{LIBDIE_BUILD_DIR}/{QT_VERSION}/msvc2022_64/lib"); + + #[cfg(target_os = "macos")] + return format!("./{LIBDIE_BUILD_DIR}/{QT_VERSION}/macos/lib"); + + #[cfg(target_os = "linux")] + return format!("./{LIBDIE_BUILD_DIR}/{QT_VERSION}/gcc_64/lib"); +} + +fn qt_download() { + // Install AQT + { + assert!( + std::process::Command::new("python") + .current_dir(BASE_DIR) + .args(["-m", "pip", "install", "--user", "--upgrade", "aqtinstall"]) + .spawn() + .unwrap() + .wait() + .expect("failed to install AQT") + .success() + ); + } + + // Install QT using AQT + { + let mut cmd = std::process::Command::new("python"); + cmd.current_dir(BASE_DIR) + .args(["-m", "aqt", "install-qt", "-O", LIBDIE_BUILD_DIR]); + + #[cfg(target_os = "linux")] + cmd.args(["linux", "desktop", QT_VERSION]); + #[cfg(target_os = "macos")] + cmd.args(["mac", "desktop", QT_VERSION, "clang_64"]); + #[cfg(target_os = "windows")] + cmd.args(["windows", "desktop", QT_VERSION, "win64_msvc2022_64"]); + + assert!( + cmd.spawn() + .unwrap() + .wait() + .expect(format!("failed to install Qt {QT_VERSION} using AQT").as_str()) + .success() + ); + } + + // Add to env var + { + let fpath = get_qt_libs_path(); + + println!("cargo:rustc-env=QT6_LIB_PATH=\"{fpath}\""); + unsafe { + env::set_var("QT6_LIB_PATH", fpath.as_str()); + env::set_var("Qt6_DIR", fpath.as_str()); + } + } +} + fn cmake_build_die() { // CMake configure { - assert!(std::process::Command::new("cmake") - .current_dir(BASE_DIR) - .args(["-S", "."]) - .args(["-B", "build"]) - .spawn() - .unwrap() - .wait() - .expect("failed to configure cmake") - .success()); + assert!( + std::process::Command::new("cmake") + .args(["-S", LIBDIE_BASE_DIR]) + .args(["-B", LIBDIE_BUILD_DIR]) + .spawn() + .unwrap() + .wait() + .expect("failed to configure cmake") + .success() + ); } // CMake build { let nb_cpu = "4"; - assert!(std::process::Command::new("cmake") - .args(["--build", "build"]) - .args(["-j", nb_cpu]) - .args(["--config", BUILD_TYPE]) - .current_dir(BASE_DIR) - .spawn() - .unwrap() - .wait() - .expect("failed to build with cmake") - .success()); + assert!( + std::process::Command::new("cmake") + .args(["--build", LIBDIE_BUILD_DIR]) + .args(["--parallel", nb_cpu]) + .args(["--config", BUILD_TYPE]) + .spawn() + .unwrap() + .wait() + .expect("failed to build with cmake") + .success() + ); } // CMake install { - assert!(std::process::Command::new("cmake") - .args(["--install", "build"]) - .args(["--config", BUILD_TYPE]) - .args(["--prefix", "install"]) - .current_dir(BASE_DIR) - .spawn() - .unwrap() - .wait() - .expect("failed to install with cmake") - .success()); + assert!( + std::process::Command::new("cmake") + .args(["--install", LIBDIE_BUILD_DIR]) + .args(["--config", BUILD_TYPE]) + .args(["--prefix", LIBDIE_INSTALL_DIR]) + .spawn() + .unwrap() + .wait() + .expect("failed to install with cmake") + .success() + ); } } -fn install_common() { +fn setup_common() { // die & die++ println!("cargo:rustc-link-lib=static=die++"); println!("cargo:rustc-link-lib=static=die"); @@ -81,7 +147,6 @@ fn install_common() { println!("cargo:rustc-link-lib=static=Qt6Core"); println!("cargo:rustc-link-lib=static=Qt6Qml"); println!("cargo:rustc-link-lib=static=Qt6Network"); - println!("cargo:rustc-link-lib=dylib=Qt6Core"); println!("cargo:rustc-link-lib=dylib=Qt6Qml"); println!("cargo:rustc-link-lib=dylib=Qt6Network"); @@ -89,9 +154,12 @@ fn install_common() { } #[cfg(target_os = "linux")] -fn install_linux() { - println!("cargo:rustc-link-search=native={}/die", INSTALL_DIR); - println!("cargo:rustc-link-search=native={}/die/lib", INSTALL_DIR); +fn install() { + println!("cargo:rustc-link-search=native={}/die", LIBDIE_INSTALL_DIR); + println!( + "cargo:rustc-link-search=native={}/die/lib", + LIBDIE_INSTALL_DIR + ); println!("cargo:rustc-link-lib=dylib=stdc++"); println!("cargo:rustc-link-lib=dylib=Qt6Core"); println!("cargo:rustc-link-lib=dylib=Qt6Qml"); @@ -108,9 +176,12 @@ fn install_linux() { } #[cfg(target_os = "macos")] -fn install_macos() { - println!("cargo:rustc-link-search=native={}/die", INSTALL_DIR); - println!("cargo:rustc-link-search=native={}/die/lib", INSTALL_DIR); +fn install() { + println!("cargo:rustc-link-search=native={}/die", LIBDIE_INSTALL_DIR); + println!( + "cargo:rustc-link-search=native={}/die/lib", + LIBDIE_INSTALL_DIR + ); println!("cargo:rustc-link-lib=dylib=c++"); if let Some(qt_lib_path) = option_env!("QT6_LIB_PATH") { @@ -132,15 +203,45 @@ fn install_macos() { } #[cfg(target_os = "windows")] -fn install_windows() { - println!("cargo:rustc-link-search=native={}/die/dielib", INSTALL_DIR); +fn install() { + match BUILD_TYPE { + "Release" => { + println!("cargo:rustc-link-lib=static=Qt6Core"); + println!("cargo:rustc-link-lib=static=Qt6Qml"); + println!("cargo:rustc-link-lib=static=Qt6Network"); + println!("cargo:rustc-link-lib=dylib=Qt6Core"); + println!("cargo:rustc-link-lib=dylib=Qt6Qml"); + println!("cargo:rustc-link-lib=dylib=Qt6Network"); + } + "Debug" => { + println!("cargo:rustc-link-lib=static=Qt6Cored"); + println!("cargo:rustc-link-lib=static=Qt6Qmld"); + println!("cargo:rustc-link-lib=static=Qt6Networkd"); + println!("cargo:rustc-link-lib=dylib=Qt6Cored"); + println!("cargo:rustc-link-lib=dylib=Qt6Qmld"); + println!("cargo:rustc-link-lib=dylib=Qt6Networkd"); + println!("cargo:rustc-link-search=native={}/ucrt/x64", MSVC_PATH); + println!("cargo:rustc-link-lib=static=ucrtd"); + } + _ => { + unimplemented!() + } + }; + + println!("cargo:rustc-link-search=native={}/die", LIBDIE_INSTALL_DIR); + + println!( + "cargo:rustc-link-search=native={}/die/dielib", + LIBDIE_INSTALL_DIR + ); + println!( "cargo:rustc-link-search=native={}/{}", - BUILD_DIR, BUILD_TYPE + LIBDIE_BUILD_DIR, BUILD_TYPE ); println!( "cargo:rustc-link-search=native={}/_deps/dielibrary-build/src/dielib/{}", - BUILD_DIR, BUILD_TYPE + LIBDIE_BUILD_DIR, BUILD_TYPE ); for _mod in ["bzip2", "lzma", "zlib"].iter() { println!( @@ -154,37 +255,53 @@ fn install_windows() { ); println!("cargo:rustc-link-lib=dylib=Crypt32"); println!("cargo:rustc-link-lib=dylib=Wintrust"); +} + +fn is_qt_missing() -> bool { + std::path::Path::new(get_qt_libs_path().as_str()).exists() == false +} - if BUILD_TYPE == "Debug" { - println!("cargo:rustc-link-lib=static=Qt6Cored"); - println!("cargo:rustc-link-lib=static=Qt6Qmld"); - println!("cargo:rustc-link-lib=static=Qt6Networkd"); - println!("cargo:rustc-link-lib=dylib=Qt6Cored"); - println!("cargo:rustc-link-lib=dylib=Qt6Qmld"); - println!("cargo:rustc-link-lib=dylib=Qt6Networkd"); +fn should_rebuild_libdie() -> bool { + for _mod in ["bzip2", "lzma", "zlib"].iter() { + #[cfg(target_os = "windows")] + let path_str = format!("{}/XArchive/3rdparty/{}/{}", LIB_DIE_PATH, _mod, BUILD_TYPE); - println!("cargo:rustc-link-search=native={}/ucrt/x64", MSVC_PATH); - println!("cargo:rustc-link-lib=static=ucrtd"); + #[cfg(not(target_os = "windows"))] + let path_str = format!("{}/XArchive/3rdparty/{}", LIB_DIE_PATH, _mod); + + if !std::path::Path::new(path_str.as_str()).exists() { + return true; + } } + + let mut fpath = std::path::PathBuf::from(LIBDIE_INSTALL_DIR); + + #[cfg(target_os = "windows")] + fpath.push("die.lib"); + + #[cfg(target_os = "linux")] + fpath.push("lib/libdie.a"); + + #[cfg(target_os = "macos")] + fpath.push("lib/libdie.a"); + + return fpath.exists() == false; } fn main() { - cmake_build_die(); + #[cfg(not(any(target_os = "windows", target_os = "macos", target_os = "linux")))] + unimplemented!(); - install_common(); + if is_qt_missing() { + qt_download(); + } - if cfg!(target_os = "linux") { - #[cfg(target_os = "linux")] - install_linux(); - } else if cfg!(target_os = "macos") { - #[cfg(target_os = "macos")] - install_macos(); - } else if cfg!(target_os = "windows") { - #[cfg(target_os = "windows")] - install_windows(); - } else { - unimplemented!(); + if should_rebuild_libdie() { + cmake_build_die(); } + setup_common(); + install(); + println!("cargo:rerun-if-changed=src/lib.rs"); } diff --git a/examples/scan_file.rs b/examples/scan_file.rs index fd13ad6..2daf3ac 100644 --- a/examples/scan_file.rs +++ b/examples/scan_file.rs @@ -1,11 +1,11 @@ type Error = Box; type Result = std::result::Result; -use std::path::PathBuf; +use std::{env, path::PathBuf}; use clap::{Parser, ValueEnum}; use derive_more::derive::Display; -use log::{debug, error, info, LevelFilter}; +use log::{LevelFilter, debug, error, info, trace}; #[derive(Default, Clone, Debug, Display, ValueEnum)] enum OutputFormat { @@ -42,29 +42,39 @@ fn main() -> Result<()> { }; env_logger::Builder::new().filter(None, log_level).init(); + trace!("env_logger initialized"); debug!("Starting at log level {:?}", &log_level); let mut scan_flags = die::ScanFlags::DEEP_SCAN; if log_level >= LevelFilter::Debug { + trace!("Setting VERBOSE scan flag"); scan_flags |= die::ScanFlags::VERBOSE; } + debug!("Scanning with flags {:?}", scan_flags,); + let res = match args.database { Some(db) => { - debug!( - "Scanning with flags {:?} and database path {}", - scan_flags, + trace!( + "Using database path {} from command line", args.filepath.as_path().to_string_lossy() ); die::scan_file_with_db(args.filepath.as_path(), scan_flags, db.as_path()) } - None => { - debug!("Scanning with flags {:?}", scan_flags); - die::scan_file(args.filepath.as_path(), scan_flags) - } + None => match env::var("DIE_DB_PATH") { + Ok(db_str) => { + let db_path = PathBuf::from(db_str); + trace!("Using database path from environment {:?}", &db_path); + die::scan_file_with_db(args.filepath.as_path(), scan_flags, db_path.as_path()) + } + Err(_) => { + trace!("Scanning without database"); + die::scan_file(args.filepath.as_path(), scan_flags) + } + }, }; match res { diff --git a/libdie++/cmake/FindDieLibrary.cmake b/libdie++/cmake/FindDieLibrary.cmake index 69cb6af..33141d6 100644 --- a/libdie++/cmake/FindDieLibrary.cmake +++ b/libdie++/cmake/FindDieLibrary.cmake @@ -1,10 +1,10 @@ include(FetchContent) set(ROOT_DIR "${CMAKE_CURRENT_LIST_DIR}/..") -set(QT_BUILD_VERSION "6.2.2") +set(QT_BUILD_VERSION "6.10.0") if(WIN32) - set(QT_BUILD_COMPILER "msvc2019_64") + set(QT_BUILD_COMPILER "msvc2022_64") elseif(LINUX) set(QT_BUILD_COMPILER "gcc_64") elseif(APPLE) diff --git a/src/lib.rs b/src/lib.rs index b31e7ca..eb3acfd 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -319,9 +319,11 @@ mod tests { let fname = default_test_file(); let expected_type = default_test_file_type(); - let flags = ScanFlags::DEEP_SCAN; + let flags = ScanFlags::DEEP_SCAN | ScanFlags::VERBOSE; if let Ok(db_path) = std::env::var("DIE_DB_PATH") { let res = scan_file_with_db(&fname, flags, Path::new(&db_path)).unwrap(); + assert_ne!(res.len(), 0); + #[cfg(not(target_os = "macos"))] assert!( res.starts_with(expected_type), "unexpected result: got {:?}, expected {:?}", @@ -357,12 +359,14 @@ mod tests { let fname = default_test_file(); let expected_type = default_test_file_type(); - let flags = ScanFlags::DEEP_SCAN; + let flags = ScanFlags::DEEP_SCAN | ScanFlags::VERBOSE; let file = File::open(fname).unwrap(); let mem = unsafe { Mmap::map(&file).unwrap() }; if let Ok(db_path) = std::env::var("DIE_DB_PATH") { let res = scan_memory_with_db(mem.as_ref(), flags, Path::new(&db_path)).unwrap(); + assert_ne!(res.len(), 0); + #[cfg(not(target_os = "macos"))] assert!( res.starts_with(expected_type), "unexpected result: got {:?}, expected {:?}",