Skip to content

Commit

Permalink
ci
Browse files Browse the repository at this point in the history
  • Loading branch information
vanhauser-thc committed Sep 25, 2023
1 parent e394141 commit 1579bfe
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions fuzzers/aflplusplus_fishfuzz/fuzzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,24 @@ def get_uninstrumented_build_directory(target_directory):
"""Return path to CmpLog target directory."""
return os.path.join(target_directory, 'uninstrumented')


def prepare_tmp_files(tmp_dir):
""" Prepare tmp files."""
if not os.path.isdir(tmp_dir) or os.path.exists(tmp_dir):
os.mkdir(tmp_dir)
os.mkdir('%s/idlog' % (tmp_dir))
os.mkdir('%s/cg' % (tmp_dir))
os.mkdir('%s/fid' % (tmp_dir))
os.system('touch %s/idlog/fid %s/idlog/targid' % (tmp_dir, tmp_dir))
os.mkdir(f'%s/idlog' % (tmp_dir))
os.mkdir(f'%s/cg' % (tmp_dir))
os.mkdir(f'%s/fid' % (tmp_dir))
os.system(f'touch %s/idlog/fid %s/idlog/targid' % (tmp_dir, tmp_dir))


def set_ff_env():
# set FishFuzz Env before build
os.environ['TMP_DIR'] = os.environ['OUT'] + '/TEMP'
os.environ['FF_TMP_DIR'] = os.environ['OUT'] + '/TEMP'
prepare_tmp_files(os.environ['TMP_DIR'])


def build(*args): # pylint: disable=too-many-branches,too-many-statements
"""Build benchmark."""
# BUILD_MODES is not already supported by fuzzbench, meanwhile we provide
Expand Down Expand Up @@ -173,7 +177,7 @@ def build(*args): # pylint: disable=too-many-branches,too-many-statements
if 'eclipser' in build_modes:
os.environ['FUZZER_LIB'] = '/libStandaloneFuzzTarget.a'
else:
os.environ['FUZZER_LIB'] = '/FishFuzz/afl_driver.o' # '/libAFLDriver.a'
os.environ['FUZZER_LIB'] = '/FishFuzz/afl_driver.o'

# Some benchmarks like lcms. (see:
# https://github.com/mm2/Little-CMS/commit/ab1093539b4287c233aca6a3cf53b234faceb792#diff-f0e6d05e72548974e852e8e55dffc4ccR212)
Expand Down Expand Up @@ -252,12 +256,12 @@ def build(*args): # pylint: disable=too-many-branches,too-many-statements

tmp_dir_dst = os.environ['OUT'] + '/TEMP'
print('[post_build] generating distance files')
# python3 /Fish++/distance/match_function.py -i $FF_TMP_DIR
# python3 /Fish++/distance/merge_callgraph.py -i $FF_TMP_DIR
# python3 /Fish++/distance/calculate_distance.py -i $FF_TMP_DIR
os.system('python3 /FishFuzz/distance/match_function.py -i %s' % (tmp_dir_dst))
os.system('python3 /FishFuzz/distance/merge_callgraph.py -i %s' % (tmp_dir_dst))
os.system('python3 /FishFuzz/distance/calculate_distance.py -i %s' % (tmp_dir_dst))
os.system('python3 /FishFuzz/distance/match_function.py -i %s' %
(tmp_dir_dst))
os.system('python3 /FishFuzz/distance/merge_callgraph.py -i %s' %
(tmp_dir_dst))
os.system('python3 /FishFuzz/distance/calculate_distance.py -i %s' %
(tmp_dir_dst))


# pylint: disable=too-many-arguments
Expand Down

0 comments on commit 1579bfe

Please sign in to comment.