feat(plugins): add managed runtime SDK and release 2.4.5
This commit is contained in:
1 parent
506e3bf1c5
commit
2a3bbaa3fb
45 files changed
+3348
-98
No files matched your search
@@ -0,0 +1,40 @@
|
||||
"""Synthetic tool used only by the opt-in SDK fault suite. No device/network I/O."""
|
||||
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
|
||||
|
||||
def main():
|
||||
mode = sys.argv[1]
|
||||
if mode == "sleep":
|
||||
time.sleep(60)
|
||||
elif mode == "tree":
|
||||
child = subprocess.Popen(
|
||||
[sys.executable, "-I", "-B", __file__, "sleep"],
|
||||
stdin=subprocess.DEVNULL,
|
||||
stdout=subprocess.DEVNULL,
|
||||
stderr=subprocess.DEVNULL,
|
||||
creationflags=subprocess.CREATE_NO_WINDOW if os.name == "nt" else 0,
|
||||
)
|
||||
Path(sys.argv[2]).write_text(json.dumps({"pid": child.pid}), encoding="utf-8")
|
||||
if sys.argv[3] == "linger":
|
||||
time.sleep(60)
|
||||
elif mode == "echo":
|
||||
data = sys.stdin.buffer.read()
|
||||
sys.stdout.buffer.write(data)
|
||||
sys.stderr.buffer.write(b"synthetic-stderr")
|
||||
elif mode == "overflow":
|
||||
while True:
|
||||
os.write(1, b"x" * 65536)
|
||||
elif mode == "failure":
|
||||
raise SystemExit(7)
|
||||
else:
|
||||
raise SystemExit(2)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in new issue
Block a user