From d2c841d1dfa4bb5551bb38f9f794675062248f9c Mon Sep 17 00:00:00 2001 From: Kyle Marsh Date: Fri, 19 Aug 2011 15:40:16 -0700 Subject: [PATCH] S3 Fuzzer: PRNG Seed and decisiong graph fixes - Change random seed generator to always spit out ints between 0 and 100,000 - Fix seeds so randomly generated seeds are *actually* the same as those seeds read from a file. - Tweaks to decision graph Remaining Bugs: - Single } encountered in format string - _mexe complains about "BadStatusLine" --- request_decision_graph.yml | 14 ++++++++------ s3tests/fuzz_headers.py | 10 +++++----- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/request_decision_graph.yml b/request_decision_graph.yml index 443b37c..06dffd7 100644 --- a/request_decision_graph.yml +++ b/request_decision_graph.yml @@ -13,17 +13,19 @@ bucket: - 13 bucket_get - 8 bucket_put - 5 bucket_delete - - garbage_method + - bucket_garbage_method -garbage_method: +bucket_garbage_method: set: method: - '{random 1-100 printable}' - '{random 10-100 binary}' - urlpath: - - '/{bucket}' - - '/{bucket}/{object}' - - '{random 10-1000 binary}' + bucket: + - '{bucket_readable}' + - '{bucket_not_readable}' + - '{bucket_writable}' + - '{bucket_not_writable}' + - '2 {garbage}' choices: - bucket_get_simple - bucket_get_filtered diff --git a/s3tests/fuzz_headers.py b/s3tests/fuzz_headers.py index c23ebc6..facfbb0 100644 --- a/s3tests/fuzz_headers.py +++ b/s3tests/fuzz_headers.py @@ -215,7 +215,7 @@ def randomlist(seed=None): """ rng = random.Random(seed) while True: - yield rng.random() + yield rng.randint(0,100000) #100,000 seeds is enough, right? def populate_buckets(conn, alt): @@ -275,7 +275,7 @@ def _main(): request_seeds = None if options.seedfile: FH = open(options.seedfile, 'r') - request_seeds = [float(line) for line in FH.readlines()] + request_seeds = [int(line) for line in FH if line != '\n'] print>>OUT, 'Seedfile: %s' %options.seedfile print>>OUT, 'Number of requests: %d' %len(request_seeds) else: @@ -298,7 +298,7 @@ def _main(): print>>OUT, "Begin Fuzzing..." print>>VERBOSE, '='*80 for request_seed in request_seeds: - print>>OUT, request_seed + print>>OUT, '%r' %request_seed prng = random.Random(request_seed) decision = assemble_decision(decision_graph, prng) @@ -317,13 +317,13 @@ def _main(): except KeyError: headers = {} - response = s3_connection.make_request(method, path, data=body, headers=headers, override_num_retries=0) - print>>VERBOSE, "%s %s" %(method[:100], path[:100]) for h, v in headers.iteritems(): print>>VERBOSE, "%s: %s" %(h[:50], v[:50]) print>>VERBOSE, "%s\n" % body[:100] + response = s3_connection.make_request(method, path, data=body, headers=headers, override_num_retries=0) + print>>DEBUG, 'FULL REQUEST' print>>DEBUG, 'Method: %r' %method print>>DEBUG, 'Path: %r' %path