Skip to content

Commit

Permalink
feat(nouveau): change path handling on Windows (and *nix) for tests (
Browse files Browse the repository at this point in the history
…#4998)

and terminate all processes (and child processes) after the test runs.
  • Loading branch information
big-r81 committed Mar 1, 2024
1 parent f53e70b commit b222951
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions dev/run
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ def generate_nouveau_config(ctx):
content = handle.read()

for key in config:
content = re.sub("{{%s}}" % key, str(config[key]), content)
content = content.replace("{{%s}}" % key, f"'{config[key]}'")

with open(tgt, "w") as handle:
handle.write(content)
Expand Down Expand Up @@ -540,17 +540,18 @@ def maybe_boot_nouveau(ctx):

def boot_nouveau(ctx):
config = os.path.join(ctx["devdir"], "lib", "nouveau.yaml")
gradle = "gradlew.bat" if os.name == "nt" else "gradlew"
cmd = [
"./gradlew",
os.path.join(ctx["rootdir"], "nouveau", gradle),
"run",
"--args",
"server {}".format(config),
f"server '{config}'",
]
logfname = os.path.join(ctx["devdir"], "logs", "nouveau.log")
log = open(logfname, "w")
return sp.Popen(
cmd,
cwd="nouveau",
cwd=os.path.join(ctx["rootdir"], "nouveau"),
stdin=sp.PIPE,
stdout=log,
stderr=sp.STDOUT,
Expand Down Expand Up @@ -878,7 +879,12 @@ def startup(ctx):
def kill_processes(ctx):
for proc in ctx["procs"]:
if proc and proc.returncode is None:
proc.terminate()
if os.name == "nt":
sp.call(
["taskkill", "/F", "/T", "/PID", str(proc.pid)], stdout=sp.DEVNULL
)
else:
proc.terminate()
ctx["procs"] = []


Expand Down

0 comments on commit b222951

Please sign in to comment.