def seq1(keys, values, repeat): if PRINT_SEQUENCES: print( "--- SEQUENCE 1 repeat %-3s -----------------------------------------------------" % repeat) kv_pairs = [] for key in keys: for value in values: kv_pairs.append(memlib.kv_pair(key, value, "EFBEADDE", 42)) requests = [] responses = [] for kv_pair in kv_pairs: if PRINT_SEQUENCES: print("Set [%d -> %d]: %s -> %s" % (len(kv_pair['key']), len( kv_pair['value']), kv_pair['key'], kv_pair['value'])) requests.append(memlib.binarySetRequest(kv_pair, "00000000")) responses.append(memlib.binarySetResponse(kv_pair, "00000000")) for _ in range(repeat): if PRINT_SEQUENCES: print("Get [%d -> %d]: %s -> %s" % (len(kv_pair['key']), len( kv_pair['value']), kv_pair['key'], kv_pair['value'])) requests.append(memlib.binaryGetRequest(kv_pair, "00000000")) responses.append(memlib.binaryGetResponse(kv_pair, "00000000")) return (requests, responses)
def get_pairs(keys, value_chars): value_pairs = zip(valueSizes, value_chars) values_use = map(lambda (size, char): char * size, value_pairs) pairs = [] for i in range(0,27): pairs.append( memlib.kv_pair(keys[i], values_use[i], "08080808", 42) ) return pairs
def seq1(keys, values, repeat): kv_pairs = [] key = keys[0] value = values[0] for flags in asciiVals: kv_pairs.append(memlib.kv_pair(key, value, "%08x" % flags, 42)) for key in keys: for value in values: flags = asciiVals[0] kv_pairs.append(memlib.kv_pair(key, value, "%08x" % flags, 42)) testset = memlib.newTestset() for kv_pair in kv_pairs: memlib.setSuccess(kv_pair, testset) for _ in range(repeat): memlib.getSuccess(kv_pair, testset) return testset
def seq1(keys, values, repeat): if PRINT_SEQUENCES: print "--- SEQUENCE 1 repeat %-3s -----------------------------------------------------" % repeat kv_pairs = [] for key in keys: for value in values: kv_pairs.append( memlib.kv_pair(key, value, "EFBEADDE", 42) ) requests = [] responses = [] for kv_pair in kv_pairs: if PRINT_SEQUENCES: print "Set [%d -> %d]: %s -> %s" % (len(kv_pair['key']), len(kv_pair['value']), kv_pair['key'], kv_pair['value']) requests.append( memlib.binarySetRequest( kv_pair , "00000000" ) ) responses.append( memlib.binarySetResponse( kv_pair, "00000000" ) ) for _ in range(repeat): if PRINT_SEQUENCES: print "Get [%d -> %d]: %s -> %s" % (len(kv_pair['key']), len(kv_pair['value']), kv_pair['key'], kv_pair['value']) requests.append( memlib.binaryGetRequest( kv_pair , "00000000" ) ) responses.append( memlib.binaryGetResponse( kv_pair , "00000000" ) ) return (requests, responses)
def pair2kvpair(pair): return memlib.kv_pair(pair[0], pair[1], "EFBEADDE", 42)
#!/usr/bin/python import memlib ## FORMATTING A KV-PAIR ####################################################### # V1 ShortTest = memlib.kv_pair("k", "v", "DEADBEEF", 42) # V2 Integration1 = { "key": "this-is-the-key-that-i'll-be-using-for-the-next-time-to-test-the-longest-of-all-keys", "value": "aaaaaaaabbbbbbbbccccccccddddddddeeeeeeeeffffffffgggggggghhhhhhhhiiiiiiiijjjjjjjjkkkkkkkkllllllllmmmmmmmmnnnnnnnnooooooooppppppppqqqqqqqqrrrrrrrrssssssssttttttttuuuuuuuuvvvvvvvvwwwwwwwwxxxxxxxxyyyyyyyyzzzzzzzz", "flags": "0000002a", # 32bit, hex-encoded "expiration": 13 } ## CREATING SINGLE REQUESTS #################################################### print "Binary Set Request" rq = memlib.binarySetRequest(Integration1, "aabbccdd") print memlib.simulationInput(rq) print "Binary Set Response" rq = memlib.binarySetResponse(Integration1, "aabbccdd") print memlib.simulationOutput(rq) print "Binary Get Request" rq = memlib.binaryGetRequest(Integration1, "aabbccdd")
def pair2kvpair(pair): return memlib.kv_pair(pair[0], pair[1], "%08x" % pair[2], 42)
#!/usr/bin/python import memlib testset = memlib.newTestset() for i in range(300): pair = memlib.kv_pair("K%03d" % i, "V%03d" % i, "ABCDEF01", 0) memlib.set(pair, testset) memlib.generate("MANYKEYS", testset) memlib.generate_hls("MANYKEYS", testset)
if len(keySizes) > len(keyChars): sys.exit("Error: Not enough key characters.") if len(valueSizes) > len(valueChars): sys.exit("Error: Not enough value characters.") keyPairs = zip(keySizes, keyChars) valuePairs = zip(valueSizes, valueChars) keys = map(lambda (size, char): char * size, keyPairs) values = map(lambda (size, char): char * size, valuePairs) kv_pairs = [] for key in keys: for value in values: for flag in flags: kv_pairs.append( memlib.kv_pair(key, value, "%08x" % flag, 42) ) kv_pairs_last = [] for key in keys: v = values[-1] f = flags[-1] kv_pairs_last.append( memlib.kv_pair(key, v, "%08x" % f, 42) ) testset = memlib.newTestset() for pair in kv_pairs_last: memlib.getFail(pair, testset) for pair in kv_pairs: memlib.setSuccess(pair, testset) for pair in kv_pairs_last: memlib.getSuccess(pair, testset) for pair in kv_pairs_last: