web-concurrency-tester-rs

Crates.ioweb-concurrency-tester-rs
lib.rsweb-concurrency-tester-rs
version0.1.0
created_at2026-01-02 02:26:41.705007+00
updated_at2026-01-02 02:26:41.705007+00
descriptionA deterministic concurrency testing tool for Web/JavaScript environments using DPOR and PCT.
homepage
repositoryhttps://github.com/nkwork9999/web-concurrency-tester-rs
max_upload_size
id2017832
size196,850
nk(Enuke) (nkwork9999)

documentation

README

web-concurrency-tester-rs πŸ¦€πŸ•ΈοΈ

Crates.io License: MPL 2.0 Rust

web-concurrency-tester-rs is a deterministic concurrency testing tool for Web/JavaScript environments, written entirely in Rust.

It helps developers find hard-to-reproduce race conditions in DOM operations by using advanced scheduling algorithms like Shuttle-style scheduling, DPOR (Dynamic Partial Order Reduction), and PCT (Probabilistic Concurrency Testing).

✨ Features

  • Deterministic Execution: Controls the order of async operations and events to reliably reproduce bugs.
  • Advanced Race Detection:
    • FastTrack / Vector Clocks: Efficiently tracks happens-before relationships.
    • DPOR: Prunes the search space to test only meaningful interleavings.
    • PCT: Mathematically guaranteed bug detection probabilities for depth-bounded races.
  • Embedded JS Engine: Powered by boa_engine and oxc_parser for direct analysis and execution in Rust.

πŸ“¦ Installation

You can install the tool directly from crates.io:

cargo install web-concurrency-tester-rs

πŸš€ Usage

1. Create a Test Case

Create an HTML file (e.g., test.html) containing the JavaScript logic you want to verify.

<button onclick="inc()">Increment</button>
<script>
  let count = 0;

  // A function with a potential race condition
  async function inc() {
    let temp = count;
    // Context switch point
    await new Promise((r) => setTimeout(r, 10));
    count = temp + 1;
  }
</script>

2. Run the Test

If you installed via cargo:

web-concurrency-tester-rs test.html

Or if you are running from the source code:

cargo run --release -- test.html

Output Example

The tool explores multiple execution schedules and reports any detected races:

  DETECTED RACES:
  [Write-Write] 'count': Task 0 vs Task 1
  ...

πŸ“„ License

This project is licensed under the Mozilla Public License 2.0 (MPL-2.0). See the LICENSE file for details.


Commit count: 0

cargo fmt