8000 Add bash script to autotest cpython lib by MegasKomnenos · Pull Request #4870 · RustPython/RustPython · GitHub
[go: up one dir, main page]

Skip to content

Add bash script to autotest cpython lib #4870

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
renaming and LibTest cleanup
  • Loading branch information
youknowone committed Mar 26, 2025
commit de35383c88aa026c38e48a2797520ae8a8a160d4
7 changes: 3 additions & 4 deletions scripts/clib/readme.md → scripts/autocheck/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
To use, open cmd and run clib_test.py with args through python
and check the result in clib_out.txt
To use, open cmd and run run_autotest.py

The script assumes that the script is being run from RustPython/scripts/clib,
and that both RustPython and cpython project directories are located under a same parent directory, aka that they are siblings

If either of those assumptions are false, then you must provide a correct path when running clib_test.py
If either of those assumptions are false, then you must provide a correct path when running run_autotest.py

The script will try to test every component in clib_list.txt
The script will try to test every component in targets.txt
22 changes: 14 additions & 8 deletions scripts/clib/clib_test.py → scripts/autocheck/autocheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@
import os
import shutil
import subprocess
import sys

from dataclasses import dataclass
from pathlib import Path
from typing import List

def subprocess_run(*args, **kwargs):
# print('Process run:', *args, kwargs, file=sys.stderr)
return subprocess.run(*args, **kwargs)

@dataclass
class LibEntry:
name: str
Expand Down Expand Up @@ -41,7 +46,7 @@ def run(self, RUSTEXECPATH: str):
shutil.copyfile(self.path_cpython_lib, self.path_tpython_lib)
shutil.copyfile(self.path_cpython_test, self.path_tpython_test)

result = subprocess.run(
result = subprocess_run(
[RUSTEXECPATH, "-q", self.path_tpython_test],
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
Expand Down Expand Up @@ -111,21 +116,22 @@ def main():

library_list: List[LibEntry] = []

with open(os.path.join(CURRENT_PATH.parent, "clib_list.txt"), 'r') as f:
with open(os.path.join(CURRENT_PATH.parent, "targets.txt"), 'r') as f:
for line in f:
line = line.split('#')[0]
line = line.strip()
if line:
library_list.append(LibEntry(line, CPYTHON_PATH, RPYTHON_PATH))

subprocess.run(["cargo", "build", "--release", "-q"])
subprocess_run(["cargo", "build", "--release", "-q"])
REXECPATH = os.path.join(CURRENT_PATH.parents[2], "target", "release", "rustpython")

for entry in library_list:
entry.run(REXECPATH)
print(entry.to_string())

shutil.rmtree(os.path.join(RPYTHON_PATH, "LibTest"))
try:
for entry in library_list:
entry.run(REXECPATH)
print(entry.to_string())
finally:
shutil.rmtree(os.path.join(RPYTHON_PATH, "LibTest"))

if __name__ == "__main__":
main()
File renamed without changes.
153 changes: 0 additions & 153 deletions 5ACA scripts/clib/clib_out.txt

This file was deleted.

0