[ readding the LO dev list to Cc with the result ]
Hi,
Am 02.11.25 um 01:47 schrieb Mohmed Ali:
Hi Rene,
Let me explain what was happening and what needs to be cleaned up.
Your patch was correct! You identified that we needed -luno_cppu, -luno_sal,
and -luno_salhelpergcc3.
OK, thanks.
The remaining failures were caused by some obsolete test code that’s no longer
relevant to the project. After disabling those old tests (explained below),
everything works:
$ cargo test
running 43 tests
...
test result: ok. 43 passed; 0 failed; 0 ignored
The Background
The rust_uno crate has two distinct types of tests that were unintentionally
mixed together:
1.
Core Tests (We Keep These)
Location: rust_uno/src/core/tests/
Files like type_tests.rs <http://type_tests.rs> and string_tests.rs
<http://string_tests.rs> test our safe Rust wrappers for UNO types.
They cover:
*
OUString creation from multiple sources
*
Type equality, cloning, and assignment
*
Memory safety through Drop and reference counting
*
API correctness and consistency
These are pure Rust unit tests and are valuable for verifying the actual
behavior of the library.
2.
Integration Tests (We Remove These)
Location: rust_uno/src/ffi/tests/integration_tests.rs
<http://integration_tests.rs>
These tests date back to the early experimental phase of the Rust UNO bridge
and rely on functions like xtest_hello() and xtest_getBoolean() from the
embindtest C library.
Interestingly, if I remember correctly I tried linking to the embindtest
library with no avail. But if it's not needed even better.
Why they’re obsolete:
*
They were used for manual testing before we had automated bindings
*
They require linking against embindtest, which isn’t part of the normal
build
*
The current architecture no longer uses that C bridge
*
They test a different layer than what we actually ship
They should be deleted entirely.
Why cargo test Failed
cargo build and cargo test produce different kinds of binaries:
cargo build (library):
Builds librust_uno.so (a shared library).
UNO symbols are resolved dynamically at runtime.
cargo test (executable):
Builds a standalone executable.
All UNO symbols must be resolved at link time.
Ah. I thought it was building the same lib and adds some test stuff on top.
OK, that makes sense.
Even though our tests are written in pure Rust, they indirectly call FFI
functions like rtl_uString_acquire() through OUString and Type, requiring
explicit linkage to:
-luno_cppu -luno_sal -luno_salhelpergcc3
Your patch correctly addressed this. The remaining failures came only from the
outdated integration tests.
Recommendation: Clean Up
We should delete rust_uno/src/ffi/tests/integration_tests.rs
<http://integration_tests.rs> because:
*
It’s no longer relevant to the current design.
*
It depends on external test infrastructure not in the build.
*
It tests an approach (manual C bridge) that’s been replaced.
*
The core tests already cover what we ship.
*
Keeping it causes confusion for new contributors.
Added removal of it in https://gerrit.libreoffice.org/c/core/+/193287, thanks
What Remains After Cleanup
After removing those tests, we retain 43 solid, fast unit tests that verify
real functionality:
OUString Tests
*
Creation from Rust types (str, String, UTF-8, ASCII)
*
Equality, comparison, and length checks
*
Memory safety via reference counting
*
Unicode and multilingual handling
Type Tests
*
Type and interface creation
*
Equality, assignment compatibility, and cloning
*
Consistency across construction methods
All these tests run cleanly and validate our Rust wrappers’ correctness.
Jup, with the removal of the obsolete test this works.
Need to set INSTDIR and LD_LIBRARY_PATH though but that is trivially doable:
rene@frodo:~/LibreOffice/git/master/rust_uno$ export
INSTDIR=/home/rene/LibreOffice/git/master/instdir; /usr/share/cargo/bin/cargo
test --verbose --release
Fresh rust_uno v0.1.0 (/home/rene/LibreOffice/git/master/rust_uno)
Finished `release` profile [optimized] target(s) in 0.07s
Running
`/home/rene/LibreOffice/git/master/rust_uno/target/release/deps/rust_uno-bb2da24176c83c31`
/home/rene/LibreOffice/git/master/rust_uno/target/release/deps/rust_uno-bb2da24176c83c31:
error while loading shared libraries: librust_uno-cpplo.so: cannot open shared
object file: No such file or directory
error: test failed, to rerun pass `--lib`
Caused by:
process didn't exit successfully:
`/home/rene/LibreOffice/git/master/rust_uno/target/release/deps/rust_uno-bb2da24176c83c31`
(exit status: 127)
note: test exited abnormally; to see the full output pass --nocapture to the
harness.
rene@frodo:~/LibreOffice/git/master/rust_uno$ export
INSTDIR=/home/rene/LibreOffice/git/master/instdir; export
LD_LIBRARY_PATH=$INSTDIR/program; /usr/share/cargo/bin/cargo test --verbose
--release
Fresh rust_uno v0.1.0 (/home/rene/LibreOffice/git/master/rust_uno)
Finished `release` profile [optimized] target(s) in 0.07s
Running
`/home/rene/LibreOffice/git/master/rust_uno/target/release/deps/rust_uno-bb2da24176c83c31`
running 43 tests
test core::tests::string_tests::test_oustring_clone ... ok
test core::tests::string_tests::test_oustring_consistency_across_constructors
... ok
test core::tests::string_tests::test_oustring_debug ... ok
test core::tests::string_tests::test_oustring_default ... ok
test core::tests::string_tests::test_oustring_display ... ok
test core::tests::string_tests::test_oustring_from_ascii ... ok
test core::tests::string_tests::test_oustring_from_str ... ok
test core::tests::string_tests::test_oustring_from_string ... ok
test core::tests::string_tests::test_oustring_from_utf8 ... ok
test core::tests::string_tests::test_oustring_is_empty ... ok
test core::tests::string_tests::test_oustring_len ... ok
test core::tests::string_tests::test_oustring_long_strings ... ok
test core::tests::string_tests::test_oustring_memory_from_raw_into_raw ... ok
test core::tests::string_tests::test_oustring_memory_mixed_operations ... ok
test core::tests::string_tests::test_oustring_memory_safety ... ok
test core::tests::string_tests::test_oustring_multilingual ... ok
test core::tests::string_tests::test_oustring_new ... ok
test core::tests::string_tests::test_oustring_partial_eq ... ok
test core::tests::string_tests::test_oustring_reference_counting_behavior ... ok
test core::tests::string_tests::test_oustring_special_characters ... ok
test core::tests::string_tests::test_oustring_memory_release ... ok
test core::tests::type_tests::test_type_clone ... ok
test core::tests::type_tests::test_type_complex_interface_names ... ok
test core::tests::type_tests::test_type_consistency_across_creation_methods ...
ok
test core::tests::type_tests::test_type_default ... ok
test core::tests::type_tests::test_type_equals ... ok
test core::tests::type_tests::test_type_from_tuple_with_oustring ... ok
test core::tests::type_tests::test_type_from_tuple_with_str ... ok
test core::tests::type_tests::test_type_from_tuple_with_string ... ok
test core::tests::type_tests::test_type_from_typelib_typeclass ... ok
test core::tests::type_tests::test_type_get_type_class ... ok
test core::tests::type_tests::test_type_get_typelib_type ... ok
test core::tests::type_tests::test_type_get_type_name ... ok
test core::tests::type_tests::test_type_is_assignable_from ... ok
test core::tests::type_tests::test_type_mixed_operations ... ok
test core::tests::type_tests::test_type_memory_safety ... ok
test core::tests::type_tests::test_type_new ... ok
test core::tests::type_tests::test_type_multiple_references ... ok
test core::tests::type_tests::test_type_new_with_name_oustring ... ok
test core::tests::type_tests::test_type_new_with_name_str ... ok
test core::tests::type_tests::test_type_new_with_name_string ... ok
test core::tests::type_tests::test_type_partial_eq ... ok
test core::tests::type_tests::test_type_primitive_type_classes ... ok
test result: ok. 43 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out;
finished in 0.00s
rene@frodo:~/LibreOffice/git/master/rust_uno$
Thanks for the extensive explanation.
Regards,
Rene