This is an automated email from the ASF dual-hosted git repository.

Seven-Streams pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm-ffi.git


The following commit(s) were added to refs/heads/main by this push:
     new d31d34e1 [TEST][Rust] Run the tests of each binary on one thread (#885)
d31d34e1 is described below

commit d31d34e10378d0e3a0948d760f98466a2e8d27d7
Author: Linzhang Li <[email protected]>
AuthorDate: Wed Oct 28 16:47:56 2026 -0400

    [TEST][Rust] Run the tests of each binary on one thread (#885)
    
    The TVM FFI runtime does not guard its type and global function tables
    against readers on other threads, and the Rust tests register types and
    globals on first use. With the default parallel test harness, a test
    that registers a type can race another test reading the table, as in the
    macOS failure on #884:
    
    ```
    Exception caught during TVMFFIGetTypeInfo:
    Check failed: (entry != nullptr) is false: Cannot find type info for 
type_index=173
    error: test failed, to rerun pass `-p tvm-ffi --test test_object_reflection`
    ```
    
    There `test_duplicate_method_names_fail_the_registration` registers
    `DuplicateMethodObj` (it cannot be pre-registered, since its
    registration panics) while
    `test_cpp_structural_equality_and_hash_see_reflected_fields` reads the
    type table through `ffi.StructuralEqual`.
    
    This adds `rust/.cargo/config.toml`, which sets `RUST_TEST_THREADS=1`,
    so the tests of each binary run one at a time, in CI and locally alike.
    Tests that spawn threads on purpose, such as
    `test_registration_from_threads`, are unaffected. The `register_types()`
    pre-registration helpers can be dropped in a follow-up.
    
    Tested: `cargo test` in `rust/` passes (33 binaries, 361 tests), and the
    test processes see `RUST_TEST_THREADS=1`.
---
 rust/.cargo/config.toml | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/rust/.cargo/config.toml b/rust/.cargo/config.toml
new file mode 100644
index 00000000..62d5ab6e
--- /dev/null
+++ b/rust/.cargo/config.toml
@@ -0,0 +1,22 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+[env]
+# The runtime does not guard its type and global function tables against 
readers
+# on other threads, and the tests register types and globals on first use, so 
the
+# tests of a binary run one at a time.
+RUST_TEST_THREADS = "1"

Reply via email to