Skip to content

Commit

Permalink
started writing test runner
Browse files Browse the repository at this point in the history
  • Loading branch information
EtomicBomb committed Dec 2, 2024
1 parent 341687a commit b504f1f
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Dockerfile.infrastructure
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM ubuntu:24.04

RUN apt update && apt install -y cloc sysstat sudo vim git wget curl

WORKDIR /benchmarks
COPY . .

CMD ["bash"]
44 changes: 44 additions & 0 deletions infrastructure/run_dynamic.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/usr/bin/env python3

from pathlib import Path
from typing import Optional
import json
from subprocess import check_output
from collections import Counter
import os

from all_scripts import get_all_scripts
from syntax_analysis import parse_shell_script, count_nodes
from project_root import get_project_root

def get_parser():
parser = argparse.ArgumentParser(
prog='run_dynamic',
description='runs the dynamic analysis')
parser.add_argument('--bench', type=Path)
parser.add_argument('--run-input', action=argparse.BooleanOptionalAction)
parser.add_argument('--run-deps', action=argparse.BooleanOptionalAction)
return parser

def get_environment(root):
my_env = os.environ.copy()
dynamic_shell = root / 'infrastructure' / 'run_dynamic_shell.py'
my_env['BENCHMARK_SHELL'] = str(dynamic_shell)

def run_analysis(root: Path, bench: Path, run_input: bool, run_deps: bool):
env = get_environment(root)

if run_deps:
run([bench / 'deps.sh'], env=env)
if run_input:
run([bench / 'input.sh'], env=env)
run([bench / 'run.sh'], env=env)

# run([bench / 'verify.sh'])


if __name__ == '__main__':
parser = get_parser()
args = parser.parse_args()
root = get_project_root()
run_analysis(root, bench=args.bench, run_input=args.run_input, run_deps=args.run_deps)
14 changes: 14 additions & 0 deletions infrastructure/run_dynamic_shell.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env python3

from pathlib import Path
from typing import Optional
import json
from subprocess import check_output
from collections import Counter
import sys

from all_scripts import get_all_scripts
from syntax_analysis import parse_shell_script, count_nodes
from project_root import get_project_root

run(['bash', *sys.argv[1:]])

0 comments on commit b504f1f

Please sign in to comment.