#!/usr/bin/env python

import argparse
import subprocess

if __name__ == '__main__':
    parser = argparse.ArgumentParser()
    parser.add_argument(
        "directory", help="The directory containing the Dockerfile.")
    parser.add_argument(
        "--no-cache", action='store_true',
        help="Disables the cache when building the attack image.")
    parser.add_argument(
        "--gpu", type=int, default=0, help="GPU number to run container on")
    parser.add_argument(
        "--samples", type=int, default=100, help="Number of samples for testing.")
    args = parser.parse_args()
    if args.no_cache:
        subprocess.Popen("avc-test-attack --no-cache --gpu {gpu} --mode targeted --samples {samples} {directory}".format(gpu=args.gpu, directory=args.directory, samples=args.samples), shell=True).wait()
    else:
        subprocess.Popen("avc-test-attack --gpu {gpu} --mode targeted --samples {samples} {directory}".format(gpu=args.gpu, directory=args.directory, samples=args.samples), shell=True).wait()