Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
e9a70c7
Update dependencies in Cargo.lock and add Cargo.lock to .gitignore
shawhanken Dec 18, 2025
68da611
Merge branch 'main' of https://github.com/yusufyian/RustPython
shawhanken Dec 18, 2025
1bf2bdf
Update dependencies in Cargo.lock and add Cargo.lock to .gitignore
shawhanken Dec 19, 2025
1726b36
Add additional reference files to .gitignore
shawhanken Dec 19, 2025
fd57302
Update .gitignore to exclude additional files and improve dependency …
shawhanken Dec 19, 2025
ecfabb8
Merge branch 'RustPython:main' into main
yusufyian Dec 19, 2025
bc9b80a
Merge branch 'main' of https://github.com/yusufyian/RustPython
shawhanken Dec 19, 2025
1a1c97a
Add checkpoint functionality to VirtualMachine
shawhanken Dec 19, 2025
3997507
Add checkpoint request handling and update checkpoint functionality
shawhanken Dec 19, 2025
551d025
Enhance demo script with additional print statements for debugging
shawhanken Dec 19, 2025
665790f
Update demo user and enhance README with testing instructions
shawhanken Dec 24, 2025
c2edc6b
Update .gitignore to include demo files
shawhanken Dec 24, 2025
4dc6120
Update .gitignore and demo script for type checking
shawhanken Dec 25, 2025
9ac5e54
Rename RustPython binary to "pvm" in Cargo.toml and update demo.py fo…
yusufyian Dec 26, 2025
8ea2822
Rename RustPython binary to 'pvm' in Cargo.toml and update demo.py fo…
yusufyian Dec 26, 2025
66dc584
Update README and test script to reflect binary name change from 'rus…
yusufyian Dec 29, 2025
6c26391
Refactor demo.py for improved clarity and structure in checkpointing …
yusufyian Dec 29, 2025
a1c1891
Update demo.py and README for financial trading scenario simulation
yusufyian Dec 29, 2025
f41b080
Enhance demo.py with additional trading scenario features and update …
yusufyian Dec 29, 2025
5f547a5
Implement PVM host and runtime modules with initial configurations
yusufyian Dec 29, 2025
3ed0799
Update various files for improved functionality and clarity
yusufyian Dec 29, 2025
9704677
Enhance VM functionality and code clarity
yusufyian Dec 29, 2025
965b201
Enhance demo script and update .gitignore
yusufyian Dec 30, 2025
9f354c2
Update .gitignore to include all reference files and remove specific …
yusufyian Dec 30, 2025
b50f1f3
Remove obsolete reference files for PVM integration and continuation …
yusufyian Dec 30, 2025
f8fc889
Remove obsolete demo files for checkpoint/resume functionality
yusufyian Dec 30, 2025
26ac488
Remove obsolete binary snapshot file for demo functionality
yusufyian Dec 30, 2025
b2ba6ea
Remove obsolete test script for checkpoint/resume functionality
yusufyian Dec 30, 2025
2dfed2d
Refactor comments in state_store.py for clarity and consistency
yusufyian Dec 30, 2025
d8aabdd
Enhance checkpoint functionality and update .gitignore
yusufyian Dec 30, 2025
6d54427
Update source location handling in compiler-source
yusufyian Dec 30, 2025
a1a7ec6
Refactor checkpoint and snapshot handling for improved functionality
yusufyian Dec 30, 2025
3620c13
Update version formatting in version.rs to reflect PVM 0.0.2 integration
yusufyian Dec 31, 2025
fe31a3d
Add PVM versioning support and update build script
yusufyian Dec 31, 2025
8eaf89f
Implement multi-frame checkpoint support and enhance stack management
yusufyian Dec 31, 2025
5544761
Enhance checkpoint functionality and update demo scripts
yusufyian Dec 31, 2025
13117d6
Add support for enumerate, zip, map, and filter in snapshot handling
yusufyian Dec 31, 2025
63c44b5
Enhance checkpoint and block stack management in VM
yusufyian Dec 31, 2025
c6806af
Add support for ListIterator and RangeIterator in snapshot handling
yusufyian Jan 3, 2026
9844d0d
Add comprehensive demo snapshot to .gitignore
yusufyian Jan 3, 2026
a07fed6
Remove Cargo.lock file to prevent unnecessary tracking of dependencies
yusufyian Jan 5, 2026
06e9e6a
Add error handling and execution options in PVM runtime
yusufyian Jan 5, 2026
072c0cc
Add determinism support and enhance error handling in PVM runtime
yusufyian Jan 8, 2026
5e01466
Enhance PVM runtime with import tracing and version updates
yusufyian Jan 8, 2026
b9dc39d
Add new business scenario demos to README
yusufyian Jan 8, 2026
d5afdde
Fix formatting issue in escrow_marketplace_demo.py by adding a newlin…
yusufyian Jan 12, 2026
9f3c462
Enhance PVM runtime with continuation support and new features
yusufyian Jan 18, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update demo user and enhance README with testing instructions
- Changed the demo user from "alice" to "Tony" for better context.
- Added a section in the README for running automated tests to verify checkpoint resume functionality.
  • Loading branch information
shawhanken committed Dec 24, 2025
commit 665790f1458dd494531b6ad7001512404705b92b
14 changes: 14 additions & 0 deletions examples/breakpoint_resume_demo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,20 @@
./target/release/rustpython --resume examples/breakpoint_resume_demo/demo.rpsnap examples/breakpoint_resume_demo/demo.py
```

## 测试程序

可直接运行自动化测试脚本验证断点续跑是否正常:

```
./target/release/rustpython examples/breakpoint_resume_demo/test_checkpoint.py
```

如需指定 rustpython 可执行文件路径:

```
./target/release/rustpython examples/breakpoint_resume_demo/test_checkpoint.py --bin /path/to/rustpython
```

## 断点文件

断点状态保存在:
Expand Down
2 changes: 1 addition & 1 deletion examples/breakpoint_resume_demo/demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

# 第一段逻辑:准备变量和上下文
print("[run] phase=init")
user = "alice"
user = "Tony"
amount = 120
items = [f"item_{idx}" for idx in range(3)]
analysis = {"score": 0.6, "summary": "score=0.6"}
Expand Down
119 changes: 119 additions & 0 deletions examples/breakpoint_resume_demo/test_checkpoint.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
from __future__ import annotations

import argparse
import os
import subprocess
import sys
from pathlib import Path


def resolve_bin_path(root: Path, bin_override: str | None) -> Path:
if bin_override:
return Path(bin_override)

bin_path = root / "target" / "release" / "rustpython"
if os.name == "nt":
bin_path = bin_path.with_suffix(".exe")
return bin_path


def run_cmd(args: list[str]) -> subprocess.CompletedProcess[str]:
return subprocess.run(args, capture_output=True, text=True, check=False)


def combined_output(result: subprocess.CompletedProcess[str]) -> str:
return (result.stdout or "") + (result.stderr or "")


def main() -> int:
parser = argparse.ArgumentParser(description="断点续运行功能测试")
parser.add_argument(
"--bin",
help="rustpython 可执行文件路径,默认使用 target/release/rustpython",
)
args = parser.parse_args()

repo_root = Path(__file__).resolve().parents[2]
bin_path = resolve_bin_path(repo_root, args.bin)
demo_path = Path(__file__).with_name("demo.py")
snap_path = demo_path.with_suffix(".rpsnap")

if not bin_path.exists():
print(f"[error] rustpython 不存在: {bin_path}")
return 1

if snap_path.exists():
snap_path.unlink()

# 第一次运行:触发断点并生成快照
result1 = run_cmd([str(bin_path), str(demo_path)])
output1 = combined_output(result1)
if result1.returncode != 0:
print("[error] 第一次运行失败")
print("stdout:")
print(result1.stdout)
print("stderr:")
print(result1.stderr)
return 1
if output1.strip():
if "phase=init" not in output1:
print("[error] 第一次运行输出不符合预期")
print("stdout:")
print(result1.stdout)
print("stderr:")
print(result1.stderr)
return 1
if not snap_path.exists():
print("[error] 断点文件未生成")
return 1

# 第二次运行:从断点 1 续跑到断点 2
result2 = run_cmd([str(bin_path), "--resume", str(snap_path), str(demo_path)])
output2 = combined_output(result2)
if result2.returncode != 0:
print("[error] 第二次运行失败")
print("stdout:")
print(result2.stdout)
print("stderr:")
print(result2.stderr)
return 1
if output2.strip():
if "phase=after_checkpoint_1" not in output2:
print("[error] 第二次运行输出不符合预期")
print("stdout:")
print(result2.stdout)
print("stderr:")
print(result2.stderr)
return 1
if not snap_path.exists():
print("[error] 第二次运行后断点文件消失")
return 1

# 第三次运行:从断点 2 续跑并完成
result3 = run_cmd([str(bin_path), "--resume", str(snap_path), str(demo_path)])
output3 = combined_output(result3)
if result3.returncode != 0:
print("[error] 第三次运行失败")
print("stdout:")
print(result3.stdout)
print("stderr:")
print(result3.stderr)
return 1
if output3.strip():
if "phase=after_checkpoint_2" not in output3 or "done" not in output3:
print("[error] 第三次运行输出不符合预期")
print("stdout:")
print(result3.stdout)
print("stderr:")
print(result3.stderr)
return 1
if snap_path.exists():
print("[error] 第三次运行后断点文件未清理")
return 1

print("[ok] 断点续运行测试通过")
return 0


if __name__ == "__main__":
raise SystemExit(main())