# Path: afl_utils/afl_multicore.py
# def find_fuzzer_binary(fuzzer_bin):
# def show_info():
# def read_config(config_file):
# def afl_cmdline_from_config(config_settings, instance_number):
# def check_screen():
# def setup_screen_env(env_list):
# def setup_screen(windows, env_list):
# def sigint_handler(signal, frame):
# def build_target_cmd(conf_settings):
# def build_master_cmd(conf_settings, master_index, target_cmd):
# def build_slave_cmd(conf_settings, slave_index, target_cmd):
# def write_pgid_file(conf_settings):
# def get_master_count(conf_settings):
# def get_started_instance_count(command, conf_settings):
# def get_job_counts(jobs_arg):
# def has_master(conf_settings, jobs_offset):
# def startup_delay(conf_settings, instance_num, command, startup_delay):
# def auto_startup_delay(config_settings, instance_num, resume=True):
# def main(argv):
#     N = len(sample_list)
#     T = float(config_settings["timeout"].strip(" +")) if "timeout" in config_settings else 1000.0
#     O = N**(-1/2)


from afl_utils import afl_multicore
    import simplejson as json
    import json
import shutil
import os
import unittest


class AflMulticoreTestCase(unittest.TestCase):
    def setUp(self):
        # Use to set up test environment prior to test case
        # invocation

        os.makedirs('testdata/auto_delay_sync', exist_ok=True)
        os.makedirs('testdata/auto_delay_sync/fuzz000', exist_ok=True)
        os.makedirs('testdata/auto_delay_sync/fuzz000/queue', exist_ok=True)
        os.makedirs('testdata/auto_delay_sync/fuzz000/queue/sample0', exist_ok=True)
        os.makedirs('testdata/auto_delay_sync/fuzz000/queue/sample1', exist_ok=True)
        os.makedirs('testdata/auto_delay_sync/fuzz000/queue/sample2', exist_ok=True)

    def tearDown(self):
        # Use for clean up after tests have run
        self.clean_remove('/tmp/afl_multicore.PGID.unittest_sess_01')
        self.clean_remove_dir('testdata/auto_delay_sync')

    def clean_remove(self, file):
        if os.path.exists(file):
            os.remove(file)

    def clean_remove_dir(self, dir):
        if os.path.exists(dir):
            shutil.rmtree(dir)

    @unittest.skipUnless(shutil.which('afl-fuzz') == os.path.abspath(os.path.expanduser('~/.local/bin/afl-fuzz')),
                         'afl-fuzz binary not found in expected location.')
    def test_find_fuzzer_binary(self):

# Path: afl_utils/afl_multicore.py
# def find_fuzzer_binary(fuzzer_bin):
# def show_info():
# def read_config(config_file):
# def afl_cmdline_from_config(config_settings, instance_number):
# def check_screen():
# def setup_screen_env(env_list):
# def setup_screen(windows, env_list):
# def sigint_handler(signal, frame):
# def build_target_cmd(conf_settings):
# def build_master_cmd(conf_settings, master_index, target_cmd):
# def build_slave_cmd(conf_settings, slave_index, target_cmd):
# def write_pgid_file(conf_settings):
# def get_master_count(conf_settings):
# def get_started_instance_count(command, conf_settings):
# def get_job_counts(jobs_arg):
# def has_master(conf_settings, jobs_offset):
# def startup_delay(conf_settings, instance_num, command, startup_delay):
# def auto_startup_delay(config_settings, instance_num, resume=True):
# def main(argv):
#     N = len(sample_list)
#     T = float(config_settings["timeout"].strip(" +")) if "timeout" in config_settings else 1000.0
#     O = N**(-1/2)


# Path: tests/test_afl_multicore.py
from afl_utils import afl_multicore
    import simplejson as json
    import json
import shutil
import os
import unittest



class AflMulticoreTestCase(unittest.TestCase):
    def setUp(self):
        # Use to set up test environment prior to test case
        # invocation

        os.makedirs('testdata/auto_delay_sync', exist_ok=True)
        os.makedirs('testdata/auto_delay_sync/fuzz000', exist_ok=True)
        os.makedirs('testdata/auto_delay_sync/fuzz000/queue', exist_ok=True)
        os.makedirs('testdata/auto_delay_sync/fuzz000/queue/sample0', exist_ok=True)
        os.makedirs('testdata/auto_delay_sync/fuzz000/queue/sample1', exist_ok=True)
        os.makedirs('testdata/auto_delay_sync/fuzz000/queue/sample2', exist_ok=True)

    def tearDown(self):
        # Use for clean up after tests have run
        self.clean_remove('/tmp/afl_multicore.PGID.unittest_sess_01')
        self.clean_remove_dir('testdata/auto_delay_sync')

    def clean_remove(self, file):
        if os.path.exists(file):
            os.remove(file)

    def clean_remove_dir(self, dir):
        if os.path.exists(dir):
            shutil.rmtree(dir)

    @unittest.skipUnless(shutil.which('afl-fuzz') == os.path.abspath(os.path.expanduser('~/.local/bin/afl-fuzz')),
                         'afl-fuzz binary not found in expected location.')
    def test_find_fuzzer_binary(self):

        self.assertEqual(afl_multicore.find_fuzzer_binary('afl-fuzz'),