cargo-c icon indicating copy to clipboard operation
cargo-c copied to clipboard

Running `cargo cbuild --test` doesn't seem to build tests

Open thiblahute opened this issue 3 months ago • 3 comments

Just an example:

 ➜  cargo cbuild --version
cargo-c 0.10.16+cargo-0.91.0

# First build, including the tests

gst-plugins-rs/video/gif $ cargo cbuild --tests
   Compiling winnow v0.7.13
   Compiling hashbrown v0.15.5
   Compiling equivalent v1.0.2
   Compiling serde_core v1.0.225
   Compiling serde v1.0.225
   Compiling target-lexicon v0.13.2
   Compiling heck v0.5.0
   Compiling smallvec v1.15.1
   Compiling pkg-config v0.3.32
   Compiling version-compare v0.2.0
   Compiling autocfg v1.5.0
   Compiling proc-macro2 v1.0.101
   Compiling unicode-ident v1.0.19
   Compiling libc v0.2.175
   Compiling toml_datetime v0.7.1
   Compiling futures-core v0.3.31
   Compiling futures-task v0.3.31
   Compiling indexmap v2.11.3
   Compiling cfg-if v1.0.3
   Compiling pin-utils v0.1.0
   Compiling pin-project-lite v0.2.16
   Compiling num-traits v0.2.19
   Compiling slab v0.4.11
   Compiling core-foundation-sys v0.8.7
   Compiling thiserror v2.0.16
   Compiling futures-channel v0.3.31
   Compiling iana-time-zone v0.1.64
   Compiling pastey v0.1.1
   Compiling memchr v2.7.5
   Compiling either v1.15.0
   Compiling static_assertions v1.1.0
   Compiling bitflags v2.9.4
   Compiling itertools v0.14.0
   Compiling toml_parser v1.0.2
   Compiling option-operations v0.6.0
   Compiling kstring v2.0.2
   Compiling muldiv v1.0.1
   Compiling quote v1.0.40
   Compiling toml_edit v0.23.5
   Compiling syn v2.0.106
   Compiling atomic_refcell v0.1.13
   Compiling color_quant v1.1.0
   Compiling cfg-expr v0.18.0
   Compiling weezl v0.1.10
   Compiling proc-macro-crate v3.4.0
   Compiling gif v0.13.3
   Compiling num-integer v0.1.46
   Compiling chrono v0.4.42
   Compiling num-rational v0.4.2
   Compiling toml_datetime v0.6.11
   Compiling serde_spanned v0.6.9
   Compiling gst-plugin-version-helper v0.8.1 (/Users/thiblahute/devel/gstreamer/gstreamer-tmp/subprojects/gst-plugins-rs/version-helper)
   Compiling toml_edit v0.22.27
   Compiling gst-plugin-gif v0.15.0-alpha.1 (/Users/thiblahute/devel/gstreamer/gstreamer-tmp/subprojects/gst-plugins-rs/video/gif)
   Compiling futures-macro v0.3.31
   Compiling thiserror-impl v2.0.16
   Compiling glib-macros v0.22.0 (https://github.com/gtk-rs/gtk-rs-core?branch=main#bbe4d709)
   Compiling futures-util v0.3.31
   Compiling toml v0.8.23
   Compiling system-deps v7.0.5
   Compiling glib-sys v0.22.0 (https://github.com/gtk-rs/gtk-rs-core?branch=main#bbe4d709)
   Compiling gobject-sys v0.22.0 (https://github.com/gtk-rs/gtk-rs-core?branch=main#bbe4d709)
   Compiling gstreamer-sys v0.25.0 (https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#8a41295b)
   Compiling gio-sys v0.22.0 (https://github.com/gtk-rs/gtk-rs-core?branch=main#bbe4d709)
   Compiling gstreamer-base-sys v0.25.0 (https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#8a41295b)
   Compiling gstreamer-video-sys v0.25.0 (https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#8a41295b)
   Compiling futures-executor v0.3.31
   Compiling glib v0.22.0 (https://github.com/gtk-rs/gtk-rs-core?branch=main#bbe4d709)
   Compiling gstreamer v0.25.0 (https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#8a41295b)
   Compiling gstreamer-base v0.25.0 (https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#8a41295b)
   Compiling gstreamer-video v0.25.0 (https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#8a41295b)
    Finished `dev` profile [optimized + debuginfo] target(s) in 15.06s
    Building pkg-config files

# Running the tests, we expect them to run right away

gst-plugins-rs/video/gif $ cargo ctest
   Compiling gst-plugin-gif v0.15.0-alpha.1 (/Users/thiblahute/devel/gstreamer/gstreamer-tmp/subprojects/gst-plugins-rs/video/gif)
    Finished `dev` profile [optimized + debuginfo] target(s) in 1.16s
    Building pkg-config files
   Compiling cfg-if v1.0.3
   Compiling futures-core v0.3.31
   Compiling libc v0.2.175
   Compiling pin-project-lite v0.2.16
   Compiling futures-task v0.3.31
   Compiling slab v0.4.11
   Compiling pin-utils v0.1.0
   Compiling num-traits v0.2.19
   Compiling smallvec v1.15.1
   Compiling bitflags v2.9.4
   Compiling memchr v2.7.5
   Compiling static_assertions v1.1.0
   Compiling either v1.15.0
   Compiling futures-channel v0.3.31
   Compiling kstring v2.0.2
   Compiling option-operations v0.6.0
   Compiling thiserror v2.0.16
   Compiling muldiv v1.0.1
   Compiling futures-util v0.3.31
   Compiling itertools v0.14.0
   Compiling gstreamer-check-sys v0.25.0 (https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#8a41295b)
   Compiling atomic_refcell v0.1.13
   Compiling weezl v0.1.10
   Compiling color_quant v1.1.0
   Compiling glib-sys v0.22.0 (https://github.com/gtk-rs/gtk-rs-core?branch=main#bbe4d709)
   Compiling gif v0.13.3
   Compiling gobject-sys v0.22.0 (https://github.com/gtk-rs/gtk-rs-core?branch=main#bbe4d709)
   Compiling num-integer v0.1.46
   Compiling gstreamer-sys v0.25.0 (https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#8a41295b)
   Compiling gio-sys v0.22.0 (https://github.com/gtk-rs/gtk-rs-core?branch=main#bbe4d709)
   Compiling num-rational v0.4.2
   Compiling gstreamer-base-sys v0.25.0 (https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#8a41295b)
   Compiling gstreamer-video-sys v0.25.0 (https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#8a41295b)
   Compiling futures-executor v0.3.31
   Compiling glib v0.22.0 (https://github.com/gtk-rs/gtk-rs-core?branch=main#bbe4d709)
   Compiling gstreamer v0.25.0 (https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#8a41295b)
   Compiling gstreamer-base v0.25.0 (https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#8a41295b)
   Compiling gstreamer-check v0.25.0 (https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#8a41295b)
   Compiling gstreamer-video v0.25.0 (https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=main#8a41295b)
   Compiling gst-plugin-gif v0.15.0-alpha.1 (/Users/thiblahute/devel/gstreamer/gstreamer-tmp/subprojects/gst-plugins-rs/video/gif)
    Finished `test` profile [optimized + debuginfo] target(s) in 12.15s
     Running unittests src/lib.rs (/Users/thiblahute/devel/gstreamer/gstreamer-tmp/subprojects/gst-plugins-rs/target/aarch64-apple-darwin/debug/deps/gstgif-6adc5411c33270b9)

but we can see it rebuilds

Also re running cargo ctest rebuilds a lot of things, each time.

I wonder if the problem is that it is not building the tests in the right place, maybe?

thiblahute avatar Sep 25 '25 16:09 thiblahute

The cargo ctest tries to build the target with specific rustflags that the tests shouldn't use so the current solution is a bit hacky. If you want to delve in the cargo internals to improve it, help is welcome :)

lu-zero avatar Sep 25 '25 20:09 lu-zero

I don't really feel like it right now, thanks for the information, in that case we better use nextest in our case I think.

thiblahute avatar Sep 25 '25 21:09 thiblahute

I never had the chance to look into it and how it could be integrated, ctest is useful mainly if you want to test your C API using the rust test harness.

lu-zero avatar Sep 26 '25 08:09 lu-zero