|
1 | 1 | # Benchmark infrastructure: hybrid analysis on open-source TypeScript |
2 | 2 |
|
3 | 3 | Batch experiments for the hybrid PBT + targeted symbolic execution pipeline |
4 | | -over an open-source TS corpus, using the **native TS parser from jacodb** |
| 4 | +over open-source TS projects, using the **native TS parser from jacodb** |
5 | 5 | (`jacodb-ets/ts-frontend`, jacodb PR #361) as the EtsIR provider. |
6 | 6 |
|
7 | | -## 1. One-time setup |
| 7 | +## TL;DR — one command per project |
8 | 8 |
|
9 | 9 | ```bash |
10 | | -# 1. Build the jacodb ts-frontend (from the jacodb checkout on the PR #361 branch): |
11 | | -cd <jacodb>/jacodb-ets/ts-frontend && npm install && npm run build |
| 10 | +# by URL: clones into corpus/, analyzes, aggregates, writes reports |
| 11 | +./run-project.sh https://github.com/TheAlgorithms/TypeScript.git --include maths |
12 | 12 |
|
13 | | -# 2. Fetch the corpus (defined in corpus.json, pinned commits): |
14 | | -./fetch-corpus.sh # requires git + jq; clones into benchmarks/corpus/ |
| 13 | +# by corpus name (already cloned) or by local path |
| 14 | +./run-project.sh typescript-algorithms --include src |
| 15 | +./run-project.sh ~/work/my-ts-project |
| 16 | + |
| 17 | +# narrower/faster runs |
| 18 | +./run-project.sh <target> --modes PBT_ONLY,HYBRID --max-files 40 --target-timeout 5 |
15 | 19 | ``` |
16 | 20 |
|
17 | | -Until jacodb PR #361 is merged and the usvm dependency pin is bumped, substitute |
18 | | -the local jacodb build via the opt-in composite build flag `-PuseLocalJacodb=<path>`. |
| 21 | +The script does everything end-to-end: |
| 22 | + |
| 23 | +1. resolves the project (clone by URL / corpus name / local path; `--commit <sha>` |
| 24 | + for reproducibility), |
| 25 | +2. builds `ts-frontend` if missing (`JACODB_DIR`, default `~/Programming/jacodb`), |
| 26 | +3. runs the hybrid analyzer over all requested ablation modes |
| 27 | + (default: `PBT_ONLY,SYMBOLIC_ONLY,HYBRID,HYBRID_WITH_HINTS`) with per-file |
| 28 | + fault isolation, |
| 29 | +4. aggregates and writes everything under `results/<name>/`: |
| 30 | + - `<name>-<MODE>.json` — full machine-readable report per mode |
| 31 | + (per-method coverage, coverage timelines, per-target wall time, |
| 32 | + hint/fallback attribution, unsupported-execution counters), |
| 33 | + - `<name>-summary.md` — the mode-comparison table, |
| 34 | + - `<name>.csv` — per-method rows for plotting. |
| 35 | + |
| 36 | +Until jacodb PR #361 is merged and the usvm dependency pin is bumped, the local |
| 37 | +jacodb build is substituted automatically via `-PuseLocalJacodb=$JACODB_DIR`. |
| 38 | + |
| 39 | +## Pinned corpus |
| 40 | + |
| 41 | +`corpus.json` pins reference projects to commits; `./fetch-corpus.sh` clones them |
| 42 | +(requires `git` + `jq`). Preferred projects are algorithm-style repositories |
| 43 | +(self-contained functions, arithmetic- and branch-rich) — analyzable per-file at |
| 44 | +the EtsIR level without cross-module resolution. Cross-file imports resolve to |
| 45 | +honest `Unsupported` at call sites and are reported, never guessed. |
| 46 | + |
| 47 | +## Manual (advanced) invocation |
19 | 48 |
|
20 | | -## 2. Running experiments |
| 49 | +The underlying CLI offers finer control: |
21 | 50 |
|
22 | 51 | ```bash |
23 | 52 | export ETS_IR_PROVIDER=ts-frontend |
24 | 53 | export ETS_FRONTEND_DIR=<jacodb>/jacodb-ets/ts-frontend |
25 | | -export ARKANALYZER_DIR=<pinned-arkanalyzer> # only needed for provider=arkanalyzer |
26 | 54 |
|
27 | 55 | ./gradlew -PuseLocalJacodb=<jacodb> :usvm-ts-pbt:runHybrid --args="\ |
28 | | - usvm-ts-pbt/benchmarks/corpus/TheAlgorithms-TypeScript/maths \ |
29 | | - --recursive \ |
| 56 | + <dir-or-file.ts> --recursive \ |
30 | 57 | --modes PBT_ONLY,SYMBOLIC_ONLY,HYBRID,HYBRID_WITH_HINTS \ |
31 | 58 | --pbt-iterations 1000 --target-timeout 10 \ |
32 | | - --out usvm-ts-pbt/benchmarks/results/maths" |
33 | | -``` |
34 | | - |
35 | | -This produces one `HybridReport` JSON per mode: `<out>-<MODE>.json`. |
36 | | -Paths are resolved relative to the repository root (the `runHybrid` working dir). |
37 | | - |
38 | | -Per-file isolation: frontend/load failures and per-method analysis failures are |
39 | | -counted and logged, never abort the batch (honest-numbers principle: the reports |
40 | | -carry `unsupported`/failure counters). |
| 59 | + --out results/my-run" |
41 | 60 |
|
42 | | -## 3. Aggregation |
43 | | - |
44 | | -```bash |
45 | | -python3 aggregate.py results/maths-*.json --csv results/maths.csv |
| 61 | +python3 aggregate.py results/my-run-*.json --csv results/my-run.csv |
46 | 62 | ``` |
47 | 63 |
|
48 | | -Prints a markdown mode-comparison table (branch/stmt coverage, PBT failures, |
49 | | -targets reached/replay-confirmed/fallbacks, wall time) and optionally a |
50 | | -per-method CSV for plots. Raw JSON reports retain full coverage timelines and |
51 | | -per-target attribution for the paper's ablation analysis. |
| 64 | +See `./gradlew :usvm-ts-pbt:runHybrid --args=""` for the full option list |
| 65 | +(`--class`, `--method`, `--exclude`, `--seed`, `--no-fallback`, ...). |
52 | 66 |
|
53 | | -## 4. Corpus policy |
| 67 | +## Interpreting the numbers |
54 | 68 |
|
55 | | -`corpus.json` pins each project to a commit. Preferred projects: algorithm-style |
56 | | -repositories (self-contained functions, arithmetic- and branch-rich) — analyzable |
57 | | -per-file at the EtsIR level without cross-module resolution. Cross-file imports |
58 | | -resolve to `Unsupported` at call sites and are reported, not guessed. |
| 69 | +- **Branch %** counts covered branch *edges* `(if, successor)` — the handoff |
| 70 | + granularity of the hybrid pipeline. |
| 71 | +- **Unsupported** counts PBT executions that hit constructs the concrete |
| 72 | + interpreter does not model (generators, cross-file imports under per-file |
| 73 | + scenes, exotic intrinsics). They are excluded from pass/fail verdicts. |
| 74 | +- **Reached / Replay OK** — symbolic targets reached, and those whose |
| 75 | + solver-synthesized inputs were *confirmed by concrete replay* (the ground |
| 76 | + truth for crediting a branch to the symbolic phase). |
| 77 | +- **Fallbacks** — hint-free retries after an unsuccessful hinted run: the |
| 78 | + measured price of the (deliberately unsound) type-hint pruning. |
0 commit comments