You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

24 lines
873 B
Python

import subprocess
from test import MailTest
def run_script(dest, script):
with subprocess.Popen(
["/bin/sh", script],
cwd=dest,
env={"LANG": 'C'},
stdout=subprocess.PIPE,
stderr=subprocess.PIPE
) as p:
p.wait()
err = p.stdout.read().decode('utf-8', 'replace')
err += p.stderr.read().decode('utf-8', 'replace')
if p.returncode == 0:
yield MailTest("Preliminary tests:", details=err.replace(dest, "/rendu/"))
yield dest
elif p.returncode == 124 or p.returncode == 137:
yield MailTest("Preliminary tests aborted for too long execution:", 1, details=err.replace(dest, "/rendu/"))
else:
yield MailTest("An error occured during preliminary tests:", 2, details=err.replace(dest, "/rendu/"))
yield dest