MCPcopy Create free account
hub / github.com/apple/foundationdb / run

Method run

bindings/python/tests/tester.py:333–657  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

331 self.new_transaction()
332
333 def run(self):
334 for idx, i in enumerate(self.instructions):
335 op_tuple = fdb.tuple.unpack(i.value)
336 op = op_tuple[0]
337
338 # print("Stack is %r" % self.stack)
339 # if op != "PUSH" and op != "SWAP":
340 # print("%d. Instruction is %s" % (idx, op))
341
342 isDatabase = op.endswith(six.u('_DATABASE'))
343 isTenant = op.endswith(six.u('_TENANT'))
344 isSnapshot = op.endswith(six.u('_SNAPSHOT'))
345
346 if isDatabase:
347 op = op[:-9]
348 obj = self.db
349 elif isTenant:
350 op = op[:-7]
351 obj = self.tenant if self.tenant else self.db
352 elif isSnapshot:
353 op = op[:-9]
354 obj = self.current_transaction().snapshot
355 else:
356 obj = self.current_transaction()
357
358 inst = Instruction(obj, self.stack, op, idx, isDatabase, isTenant, isSnapshot)
359
360 try:
361 if inst.op == six.u("PUSH"):
362 inst.push(op_tuple[1])
363 elif inst.op == six.u("DUP"):
364 inst.stack.push(*self.stack[0])
365 elif inst.op == six.u("EMPTY_STACK"):
366 self.stack = Stack()
367 elif inst.op == six.u("SWAP"):
368 idx = inst.pop()
369 self.stack[0], self.stack[idx] = self.stack[idx], self.stack[0]
370 elif inst.op == six.u("POP"):
371 inst.pop()
372 elif inst.op == six.u("SUB"):
373 a, b = inst.pop(2)
374 inst.push(a - b)
375 elif inst.op == six.u("CONCAT"):
376 a, b = inst.pop(2)
377 inst.push(a + b)
378 elif inst.op == six.u("WAIT_FUTURE"):
379 old_idx, item = inst.pop(with_idx=True)
380 inst.stack.push(old_idx, item)
381 elif inst.op == six.u("NEW_TRANSACTION"):
382 self.new_transaction()
383 elif inst.op == six.u("USE_TRANSACTION"):
384 self.switch_transaction(inst.pop())
385 elif inst.op == six.u("ON_ERROR"):
386 inst.push(inst.tr.on_error(inst.pop()))
387 elif inst.op == six.u("GET"):
388 key = inst.pop()
389 num = random.randint(0, 2)
390 if num == 0:

Callers

nothing calls this directly

Calls 15

current_transactionMethod · 0.95
pushMethod · 0.95
popMethod · 0.95
new_transactionMethod · 0.95
switch_transactionMethod · 0.95
push_rangeMethod · 0.95
log_stackMethod · 0.95
strincFunction · 0.90
test_cancellationFunction · 0.90
test_retry_limitsFunction · 0.90
test_db_retry_limitsFunction · 0.90
test_timeoutsFunction · 0.90

Tested by

no test coverage detected