def main()

in fuzzing/tools/launcher.py [0:0]


def main(argv):
    # TODO(sbucur): Obtain a target-specific path here.
    target_output_root = os.path.join(FLAGS.fuzzing_output_root)
    print("Using test output root: %s" % target_output_root, file=sys.stderr)
    if FLAGS.clean:
        print("Cleaning up the test output root before starting fuzzing...",
              file=sys.stderr)
        try:
            shutil.rmtree(target_output_root)
        except FileNotFoundError:
            pass
    os.makedirs(target_output_root, exist_ok=True)

    corpus_output_path = os.path.join(target_output_root, 'corpus')
    print('Writing new corpus elements at: %s' % corpus_output_path,
          file=sys.stderr)
    os.makedirs(corpus_output_path, exist_ok=True)

    artifacts_output_path = os.path.join(target_output_root, 'artifacts')
    print('Writing new artifacts at: %s' % artifacts_output_path)
    os.makedirs(artifacts_output_path, exist_ok=True)

    os.environ["FUZZER_BINARY"] = FLAGS.binary_path
    os.environ["FUZZER_TIMEOUT_SECS"] = str(FLAGS.timeout_secs)
    os.environ["FUZZER_IS_REGRESSION"] = "1" if FLAGS.regression else "0"
    os.environ["FUZZER_OUTPUT_ROOT"] = target_output_root
    os.environ["FUZZER_OUTPUT_CORPUS_DIR"] = corpus_output_path
    os.environ["FUZZER_ARTIFACTS_DIR"] = artifacts_output_path
    if FLAGS.dictionary_path:
        os.environ["FUZZER_DICTIONARY_PATH"] = FLAGS.dictionary_path
    if FLAGS.corpus_dir:
        os.environ["FUZZER_SEED_CORPUS_DIR"] = FLAGS.corpus_dir
    os.execv("/bin/bash", ["/bin/bash", FLAGS.engine_launcher] + argv[1:])