Compare commits
No commits in common. "main" and "ayrton/control-flow" have entirely different histories.
main
...
ayrton/con
|
@ -142,17 +142,17 @@ class AstGenerator:
|
||||||
self.current_ast_element.append(element)
|
self.current_ast_element.append(element)
|
||||||
self.current_ast_element = element
|
self.current_ast_element = element
|
||||||
|
|
||||||
# Generate the loop condition increment if we are in a loop
|
if block_type in [GAZ_PROCEDURE_TAG, GAZ_FUNCTION_TAG]:
|
||||||
if block_type == GAZ_LOOP_TAG:
|
|
||||||
self.generate_loop_condition_check(loop_var)
|
|
||||||
self.generate_loop_condition_increment(loop_var)
|
|
||||||
|
|
||||||
if block_type not in [GAZ_PROCEDURE_TAG, GAZ_FUNCTION_TAG]:
|
|
||||||
self.generate_statements()
|
self.generate_statements()
|
||||||
else:
|
else:
|
||||||
self.generate_statements(include='declaration')
|
self.generate_statements(include='declaration')
|
||||||
self.generate_statements(exclude='declaration')
|
self.generate_statements(exclude='declaration')
|
||||||
|
|
||||||
|
# Generate the loop condition increment if we are in a loop
|
||||||
|
if block_type == GAZ_LOOP_TAG:
|
||||||
|
self.generate_loop_condition_check(loop_var)
|
||||||
|
self.generate_loop_condition_increment(loop_var)
|
||||||
|
|
||||||
if return_stmt:
|
if return_stmt:
|
||||||
self.generate_return(return_type=return_type, return_value=return_value)
|
self.generate_return(return_type=return_type, return_value=return_value)
|
||||||
if self.settings['generation-options']['generate-dead-code']:
|
if self.settings['generation-options']['generate-dead-code']:
|
||||||
|
|
|
@ -90,7 +90,7 @@ misc-weights:
|
||||||
type-qualifier-weights:
|
type-qualifier-weights:
|
||||||
const: 10
|
const: 10
|
||||||
var: 60
|
var: 60
|
||||||
truthiness: 0.99 # Probability of conditionals being true
|
truthiness: 0.9 # Probability of conditionals being true
|
||||||
|
|
||||||
block-termination-probability: 0.2 # probability for a block to terminate
|
block-termination-probability: 0.2 # probability for a block to terminate
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,7 @@ class GazpreaFuzzer:
|
||||||
|
|
||||||
def fuzz(self):
|
def fuzz(self):
|
||||||
self.generator.generate_ast()
|
self.generator.generate_ast()
|
||||||
|
self.write_ast() # FIXME sometimes this is none
|
||||||
|
|
||||||
self.gaz_source_gen = GazUnparser(self.generator.ast, True)
|
self.gaz_source_gen = GazUnparser(self.generator.ast, True)
|
||||||
try:
|
try:
|
||||||
|
@ -55,7 +56,6 @@ class GazpreaFuzzer:
|
||||||
pass
|
pass
|
||||||
# exec(str(self.ground_truth))
|
# exec(str(self.ground_truth))
|
||||||
# exec(self.ground_truth, globals(), locals()) # FIXME the exec doesn't actually execute for some reason...
|
# exec(self.ground_truth, globals(), locals()) # FIXME the exec doesn't actually execute for some reason...
|
||||||
self.write_ast() # FIXME sometimes this is none
|
|
||||||
|
|
||||||
self.out = buf.getvalue()
|
self.out = buf.getvalue()
|
||||||
|
|
||||||
|
|
|
@ -129,7 +129,6 @@ class Fuzzer():
|
||||||
with open("{}/{}_{}.out".format(fuzzer_outputs, self.file_name, i), 'r') as y:
|
with open("{}/{}_{}.out".format(fuzzer_outputs, self.file_name, i), 'r') as y:
|
||||||
out = y.read()
|
out = y.read()
|
||||||
if out == "":
|
if out == "":
|
||||||
print("Empty output, skipping", file=sys.stderr)
|
|
||||||
os.system("rm -f {}/{}_{}.py".format(fuzzer_ground_truth, self.file_name, i))
|
os.system("rm -f {}/{}_{}.py".format(fuzzer_ground_truth, self.file_name, i))
|
||||||
os.system("rm -f {}/{}_{}.out".format(fuzzer_outputs, self.file_name, i))
|
os.system("rm -f {}/{}_{}.out".format(fuzzer_outputs, self.file_name, i))
|
||||||
if i - 1 >= min_i:
|
if i - 1 >= min_i:
|
||||||
|
|
Loading…
Reference in a new issue