forked from mtusi2026/mtusi2026lab2
18 lines
810 B
Python
18 lines
810 B
Python
"""Run unchanged make targets in Linux, including the executable restart.sh."""
|
|
import argparse
|
|
from pathlib import Path
|
|
import subprocess
|
|
|
|
root=Path(__file__).resolve().parents[1]
|
|
p=argparse.ArgumentParser()
|
|
p.add_argument('target',choices=['check','test','test-own','test-race','test-persistence'])
|
|
args=p.parse_args()
|
|
command=['docker','run','--rm','--network','mtusi-lab2_default',
|
|
'--mount','type=bind,source='+str(root)+',target=/workspace']
|
|
if args.target=='test-persistence':
|
|
command+=['--mount','type=bind,source=/var/run/docker.sock,target=/var/run/docker.sock']
|
|
command+=['mtusi-messenger:lab2-tests','make',args.target,'BASE_URL=http://api:8080']
|
|
if args.target=='test-persistence':
|
|
command+=['ACTION_SCRIPT=scripts/restart.sh']
|
|
raise SystemExit(subprocess.call(command,cwd=root))
|