Search is not available for this dataset
text stringlengths 75 104k |
|---|
def set_fee_asset(self, fee_asset):
""" Set asset to fee
"""
if isinstance(fee_asset, self.amount_class):
self.fee_asset_id = fee_asset["id"]
elif isinstance(fee_asset, self.asset_class):
self.fee_asset_id = fee_asset["id"]
elif fee_asset:
self... |
def add_required_fees(self, ops, asset_id="1.3.0"):
""" Auxiliary method to obtain the required fees for a set of
operations. Requires a websocket connection to a witness node!
"""
ws = self.blockchain.rpc
fees = ws.get_required_fees([i.json() for i in ops], asset_id)
... |
def constructTx(self):
""" Construct the actual transaction and store it in the class's dict
store
"""
ops = list()
for op in self.ops:
if isinstance(op, ProposalBuilder):
# This operation is a proposal an needs to be deal with
# di... |
def get_block_params(self):
""" Auxiliary method to obtain ``ref_block_num`` and
``ref_block_prefix``. Requires a websocket connection to a
witness node!
"""
ws = self.blockchain.rpc
dynBCParams = ws.get_dynamic_global_properties()
ref_block_num = dynBCPar... |
def sign(self):
""" Sign a provided transaction with the provided key(s)
:param dict tx: The transaction to be signed and returned
:param string wifs: One or many wif keys to use for signing
a transaction. If not present, the keys will be loaded
from the ... |
def verify_authority(self):
""" Verify the authority of the signed transaction
"""
try:
if not self.blockchain.rpc.verify_authority(self.json()):
raise InsufficientAuthorityError
except Exception as e:
raise e |
def broadcast(self):
""" Broadcast a transaction to the blockchain network
:param tx tx: Signed transaction to broadcast
"""
# Sign if not signed
if not self._is_signed():
self.sign()
# Cannot broadcast an empty transaction
if "operations" not in... |
def clear(self):
""" Clear the transaction builder and start from scratch
"""
self.ops = []
self.wifs = set()
self.signing_accounts = []
# This makes sure that _is_constructed will return False afterwards
self["expiration"] = None
dict.__init__(self, {}) |
def addSigningInformation(self, account, permission):
""" This is a private method that adds side information to a
unsigned/partial transaction in order to simplify later
signing (e.g. for multisig or coldstorage)
FIXME: Does not work with owner keys!
"""
sel... |
def appendMissingSignatures(self):
""" Store which accounts/keys are supposed to sign the transaction
This method is used for an offline-signer!
"""
missing_signatures = self.get("missing_signatures", [])
for pub in missing_signatures:
wif = self.blockchain.walle... |
def as_base(self, base):
""" Returns the price instance so that the base asset is ``base``.
Note: This makes a copy of the object!
"""
if base == self["base"]["symbol"]:
return self.copy()
elif base == self["quote"]["symbol"]:
return self.copy().inver... |
def as_quote(self, quote):
""" Returns the price instance so that the quote asset is ``quote``.
Note: This makes a copy of the object!
"""
if quote == self["quote"]["symbol"]:
return self.copy()
elif quote == self["base"]["symbol"]:
return self.copy()... |
def invert(self):
""" Invert the price (e.g. go from ``USD/BTS`` into ``BTS/USD``)
"""
tmp = self["quote"]
self["quote"] = self["base"]
self["base"] = tmp
if "for_sale" in self and self["for_sale"]:
self["for_sale"] = self.amount_class(
self["f... |
def json(self):
"""
return {
"base": self["base"].json(),
"quote": self["quote"].json()
}
"""
quote = self["quote"]
base = self["base"]
frac = Fraction(int(quote) / int(base)).limit_denominator(
10 ** base["asset"]["precision"]
... |
def wipe(self):
""" Wipe the store
"""
keys = list(self.keys()).copy()
for key in keys:
self.delete(key) |
def connect(self, node="", rpcuser="", rpcpassword="", **kwargs):
""" Connect to blockchain network (internal use only)
"""
if not node:
if "node" in self.config:
node = self.config["node"]
else:
raise ValueError("A Blockchain node needs to... |
def finalizeOp(self, ops, account, permission, **kwargs):
""" This method obtains the required private keys if present in
the wallet, finalizes the transaction, signs it and
broadacasts it
:param operation ops: The operation (or list of operaions) to
broadcas... |
def sign(self, tx=None, wifs=[]):
""" Sign a provided transaction witht he provided key(s)
:param dict tx: The transaction to be signed and returned
:param string wifs: One or many wif keys to use for signing
a transaction. If not present, the keys will be loaded
... |
def broadcast(self, tx=None):
""" Broadcast a transaction to the Blockchain
:param tx tx: Signed transaction to broadcast
"""
if tx:
# If tx is provided, we broadcast the tx
return self.transactionbuilder_class(
tx, blockchain_instance=self
... |
def proposal(self, proposer=None, proposal_expiration=None, proposal_review=None):
""" Return the default proposal buffer
... note:: If any parameter is set, the default proposal
parameters will be changed!
"""
if not self._propbuffer:
return self.new_prop... |
def new_tx(self, *args, **kwargs):
""" Let's obtain a new txbuffer
:returns int txid: id of the new txbuffer
"""
builder = self.transactionbuilder_class(
*args, blockchain_instance=self, **kwargs
)
self._txbuffers.append(builder)
return builder |
def detail(self, *args, **kwargs):
prefix = kwargs.pop("prefix", default_prefix)
# remove dublicates
kwargs["votes"] = list(set(kwargs["votes"]))
""" This is an example how to sort votes prior to using them in the
Object
"""
# # Sort votes
# kwargs["vo... |
def id(self):
""" The transaction id of this transaction
"""
# Store signatures temporarily since they are not part of
# transaction id
sigs = self.data["signatures"]
self.data.pop("signatures", None)
# Generage Hash of the seriliazed version
h = hashlib.... |
def sign(self, wifkeys, chain=None):
""" Sign the transaction with the provided private keys.
:param array wifkeys: Array of wif keys
:param str chain: identifier for the chain
"""
if not chain:
chain = self.get_default_prefix()
self.deriveDigest(cha... |
def store(self, data, key=None, *args, **kwargs):
""" Cache the list
:param list data: List of objects to cache
"""
list.__init__(self, data)
self._store_items(self._cache_key(key)) |
def store(self, data, key="id"):
""" Cache the list
:param list data: List of objects to cache
"""
dict.__init__(self, data)
self._store_item(key) |
def objectid_valid(i):
""" Test if a string looks like a regular object id of the
form:::
xxxx.yyyyy.zzzz
with those being numbers.
"""
if "." not in i:
return False
parts = i.split(".")
if len(parts) == 3:
try:
... |
def refresh(self):
""" This is the refresh method that overloads the prototype in
BlockchainObject.
"""
dict.__init__(
self,
self.blockchain.rpc.get_object(self.identifier),
blockchain_instance=self.blockchain,
) |
def _encrypt_xor(a, b, aes):
""" Returns encrypt(a ^ b). """
a = unhexlify("%0.32x" % (int((a), 16) ^ int(hexlify(b), 16)))
return aes.encrypt(a) |
def encrypt(privkey, passphrase):
""" BIP0038 non-ec-multiply encryption. Returns BIP0038 encrypted privkey.
:param privkey: Private key
:type privkey: Base58
:param str passphrase: UTF-8 encoded passphrase for encryption
:return: BIP0038 non-ec-multiply encrypted wif key
:rtype: Base58
""... |
def decrypt(encrypted_privkey, passphrase):
"""BIP0038 non-ec-multiply decryption. Returns WIF privkey.
:param Base58 encrypted_privkey: Private key
:param str passphrase: UTF-8 encoded passphrase for decryption
:return: BIP0038 non-ec-multiply decrypted key
:rtype: Base58
:raises SaltException... |
def setKeys(self, loadkeys):
""" This method is strictly only for in memory keys that are
passed to Wallet with the ``keys`` argument
"""
log.debug("Force setting of private keys. Not using the wallet database!")
if isinstance(loadkeys, dict):
loadkeys = list(load... |
def unlock(self, pwd):
""" Unlock the wallet database
"""
if self.store.is_encrypted():
return self.store.unlock(pwd) |
def newWallet(self, pwd):
""" Create a new wallet database
"""
if self.created():
raise WalletExists("You already have created a wallet!")
self.store.unlock(pwd) |
def addPrivateKey(self, wif):
""" Add a private key to the wallet database
"""
try:
pub = self.publickey_from_wif(wif)
except Exception:
raise InvalidWifError("Invalid Key format!")
if str(pub) in self.store:
raise KeyAlreadyInStoreException("K... |
def getPrivateKeyForPublicKey(self, pub):
""" Obtain the private key for a given public key
:param str pub: Public Key
"""
if str(pub) not in self.store:
raise KeyNotFound
return self.store.getPrivateKeyForPublicKey(str(pub)) |
def removeAccount(self, account):
""" Remove all keys associated with a given account
"""
accounts = self.getAccounts()
for a in accounts:
if a["name"] == account:
self.store.delete(a["pubkey"]) |
def getOwnerKeyForAccount(self, name):
""" Obtain owner Private Key for an account from the wallet database
"""
account = self.rpc.get_account(name)
for authority in account["owner"]["key_auths"]:
key = self.getPrivateKeyForPublicKey(authority[0])
if key:
... |
def getMemoKeyForAccount(self, name):
""" Obtain owner Memo Key for an account from the wallet database
"""
account = self.rpc.get_account(name)
key = self.getPrivateKeyForPublicKey(account["options"]["memo_key"])
if key:
return key
return False |
def getActiveKeyForAccount(self, name):
""" Obtain owner Active Key for an account from the wallet database
"""
account = self.rpc.get_account(name)
for authority in account["active"]["key_auths"]:
try:
return self.getPrivateKeyForPublicKey(authority[0])
... |
def getAccountFromPrivateKey(self, wif):
""" Obtain account name from private key
"""
pub = self.publickey_from_wif(wif)
return self.getAccountFromPublicKey(pub) |
def getAccountsFromPublicKey(self, pub):
""" Obtain all accounts associated with a public key
"""
names = self.rpc.get_key_references([str(pub)])[0]
for name in names:
yield name |
def getAccountFromPublicKey(self, pub):
""" Obtain the first account name from public key
"""
# FIXME, this only returns the first associated key.
# If the key is used by multiple accounts, this
# will surely lead to undesired behavior
names = list(self.getAccountsFromPub... |
def getKeyType(self, account, pub):
""" Get key type
"""
for authority in ["owner", "active"]:
for key in account[authority]["key_auths"]:
if str(pub) == key[0]:
return authority
if str(pub) == account["options"]["memo_key"]:
re... |
def getAccounts(self):
""" Return all accounts installed in the wallet database
"""
pubkeys = self.getPublicKeys()
accounts = []
for pubkey in pubkeys:
# Filter those keys not for our network
if pubkey[: len(self.prefix)] == self.prefix:
ac... |
def getPublicKeys(self, current=False):
""" Return all installed public keys
:param bool current: If true, returns only keys for currently
connected blockchain
"""
pubkeys = self.store.getPublicKeys()
if not current:
return pubkeys
pubs = ... |
def rpcexec(self, payload):
""" Execute a call by sending the payload
:param json payload: Payload data
:raises ValueError: if the server does not respond in proper JSON
format
"""
if not self.ws: # pragma: no cover
self.connect()
lo... |
def unlock_wallet(self, *args, **kwargs):
""" Unlock the library internal wallet
"""
self.blockchain.wallet.unlock(*args, **kwargs)
return self |
def encrypt(self, message):
""" Encrypt a memo
:param str message: clear text memo message
:returns: encrypted message
:rtype: str
"""
if not message:
return None
nonce = str(random.getrandbits(64))
try:
memo_wif = sel... |
def decrypt(self, message):
""" Decrypt a message
:param dict message: encrypted memo message
:returns: decrypted message
:rtype: str
"""
if not message:
return None
# We first try to decode assuming we received the memo
try:
... |
def get_shared_secret(priv, pub):
""" Derive the share secret between ``priv`` and ``pub``
:param `Base58` priv: Private Key
:param `Base58` pub: Public Key
:return: Shared secret
:rtype: hex
The shared secret is generated such that::
Pub(Alice) * Priv(Bob) = P... |
def init_aes(shared_secret, nonce):
""" Initialize AES instance
:param hex shared_secret: Shared Secret to use as encryption key
:param int nonce: Random nonce
:return: AES instance
:rtype: AES
"""
" Shared Secret "
ss = hashlib.sha512(unhexlify(shared_secret)).digest()... |
def encode_memo(priv, pub, nonce, message):
""" Encode a message with a shared secret between Alice and Bob
:param PrivateKey priv: Private Key (of Alice)
:param PublicKey pub: Public Key (of Bob)
:param int nonce: Random nonce
:param str message: Memo message
:return: Encry... |
def decode_memo(priv, pub, nonce, message):
""" Decode a message with a shared secret between Alice and Bob
:param PrivateKey priv: Private Key (of Bob)
:param PublicKey pub: Public Key (of Alice)
:param int nonce: Nonce used for Encryption
:param bytes message: Encrypted Memo messa... |
def sign(self, account=None, **kwargs):
""" Sign a message with an account's memo key
:param str account: (optional) the account that owns the bet
(defaults to ``default_account``)
:raises ValueError: If not account for signing is provided
:returns: the sign... |
def verify(self, **kwargs):
""" Verify a message with an account's memo key
:param str account: (optional) the account that owns the bet
(defaults to ``default_account``)
:returns: True if the message is verified successfully
:raises InvalidMessageSignature ... |
def sign(self, account=None, **kwargs):
""" Sign a message with an account's memo key
:param str account: (optional) the account that owns the bet
(defaults to ``default_account``)
:raises ValueError: If not account for signing is provided
:returns: the sign... |
def verify(self, **kwargs):
""" Verify a message with an account's memo key
:param str account: (optional) the account that owns the bet
(defaults to ``default_account``)
:returns: True if the message is verified successfully
:raises InvalidMessageSignature ... |
def env():
"""Verify IPMI environment"""
ipmi = cij.env_to_dict(PREFIX, REQUIRED)
if ipmi is None:
ipmi["USER"] = "admin"
ipmi["PASS"] = "admin"
ipmi["HOST"] = "localhost"
ipmi["PORT"] = "623"
cij.info("ipmi.env: USER: %s, PASS: %s, HOST: %s, PORT: %s" % (
... |
def cmd(command):
"""Send IPMI 'command' via ipmitool"""
env()
ipmi = cij.env_to_dict(PREFIX, EXPORTED + REQUIRED)
command = "ipmitool -U %s -P %s -H %s -p %s %s" % (
ipmi["USER"], ipmi["PASS"], ipmi["HOST"], ipmi["PORT"], command)
cij.info("ipmi.command: %s" % command)
return cij.ut... |
def regex_find(pattern, content):
"""Find the given 'pattern' in 'content'"""
find = re.findall(pattern, content)
if not find:
cij.err("pattern <%r> is invalid, no matches!" % pattern)
cij.err("content: %r" % content)
return ''
if len(find) >= 2:
cij.err("pattern <%r> i... |
def execute(cmd=None, shell=True, echo=True):
"""
Execute the given 'cmd'
@returns (rcode, stdout, stderr)
"""
if echo:
cij.emph("cij.util.execute: shell: %r, cmd: %r" % (shell, cmd))
rcode = 1
stdout, stderr = ("", "")
if cmd:
if shell:
cmd = " ".join(cmd)... |
def env():
"""Verify BOARD variables and construct exported variables"""
if cij.ssh.env():
cij.err("board.env: invalid SSH environment")
return 1
board = cij.env_to_dict(PREFIX, REQUIRED) # Verify REQUIRED variables
if board is None:
cij.err("board.env: invalid BOARD environm... |
def cat_file(path):
"""Cat file and return content"""
cmd = ["cat", path]
status, stdout, _ = cij.ssh.command(cmd, shell=True, echo=True)
if status:
raise RuntimeError("cij.nvme.env: cat %s failed" % path)
return stdout.strip() |
def env():
"""Verify NVME variables and construct exported variables"""
if cij.ssh.env():
cij.err("cij.nvme.env: invalid SSH environment")
return 1
nvme = cij.env_to_dict(PREFIX, REQUIRED)
nvme["DEV_PATH"] = os.path.join("/dev", nvme["DEV_NAME"])
# get version, chunks, luns and c... |
def fmt(lbaf=3):
"""Do format for NVMe device"""
if env():
cij.err("cij.nvme.exists: Invalid NVMe ENV.")
return 1
nvme = cij.env_to_dict(PREFIX, EXPORTED + REQUIRED)
cmd = ["nvme", "format", nvme["DEV_PATH"], "-l", str(lbaf)]
rcode, _, _ = cij.ssh.command(cmd, shell=True)
ret... |
def get_meta(offset, length, output):
"""Get chunk meta of NVMe device"""
if env():
cij.err("cij.nvme.meta: Invalid NVMe ENV.")
return 1
nvme = cij.env_to_dict(PREFIX, EXPORTED + REQUIRED)
max_size = 0x40000
with open(output, "wb") as fout:
for off in range(offset, length,... |
def comp_meta(file_bef, file_aft, mode="pfail"):
"""Compare chunk meta, mode=[pfail, power, reboot]"""
if env():
cij.err("cij.nvme.comp_meta: Invalid NVMe ENV.")
return 1
nvme = cij.env_to_dict(PREFIX, EXPORTED + REQUIRED)
num_chk = int(nvme["LNVM_TOTAL_CHUNKS"])
meta_bef = cij.bin... |
def get_sizeof_descriptor_table(version="Denali"):
"""
Get sizeof DescriptorTable
"""
if version == "Denali":
return sizeof(DescriptorTableDenali)
elif version == "Spec20":
return sizeof(DescriptorTableSpec20)
elif version == "Spec12":
return 0
else:
... |
def env():
"""Verify LNVM variables and construct exported variables"""
if cij.ssh.env():
cij.err("cij.lnvm.env: invalid SSH environment")
return 1
lnvm = cij.env_to_dict(PREFIX, REQUIRED)
nvme = cij.env_to_dict("NVME", ["DEV_NAME"])
if "BGN" not in lnvm.keys():
cij.err("c... |
def create():
"""Create LNVM device"""
if env():
cij.err("cij.lnvm.create: Invalid LNVM ENV")
return 1
nvme = cij.env_to_dict("NVME", ["DEV_NAME"])
lnvm = cij.env_to_dict(PREFIX, EXPORTED + REQUIRED)
cij.emph("lnvm.create: LNVM_DEV_NAME: %s" % lnvm["DEV_NAME"])
cmd = ["nvme ln... |
def dump(buf, indent=0, skip=""):
"""Dump UnionType/StructType to STDOUT"""
if not isinstance(type(buf), (type(Union), type(Structure))):
raise RuntimeError("Error type(%s)" % type(buf))
for field in getattr(buf, '_fields_'):
name, types = field[0], field[1]
if name in skip:
... |
def compare(buf_a, buf_b, ignore):
"""Compare of two Buffer item"""
for field in getattr(buf_a, '_fields_'):
name, types = field[0], field[1]
if name in ignore:
continue
val_a = getattr(buf_a, name)
val_b = getattr(buf_b, name)
if isinstance(types, (type(Un... |
def memcopy(self, stream, offset=0, length=float("inf")):
"""Copy stream to buffer"""
data = [ord(i) for i in list(stream)]
size = min(length, len(data), self.m_size)
buff = cast(self.m_buf, POINTER(c_uint8))
for i in range(size):
buff[offset + i] = data[i] |
def write(self, path):
"""Write buffer to file"""
with open(path, "wb") as fout:
fout.write(self.m_buf) |
def read(self, path):
"""Read file to buffer"""
with open(path, "rb") as fout:
memmove(self.m_buf, fout.read(self.m_size), self.m_size) |
def dump(self, offset=0, length=1):
"""Dump item"""
for i in range(offset, offset + length):
if "ctypes" in str(self.m_types):
cij.info("Buff[%s]: %s" % (i, self.m_buf[i]))
else:
cij.info("Buff[%s]:" % i)
dump(self.m_buf[i], 2) |
def compare(self, buf, offset=0, length=1, ignore=""):
"""Compare buffer"""
for i in range(offset, offset + length):
if isinstance(self.m_types, (type(Union), type(Structure))):
if compare(self.m_buf[i], buf[i], ignore=ignore):
return 1
elif s... |
def power_on(self, interval=200):
"""230v power on"""
if self.__power_on_port is None:
cij.err("cij.usb.relay: Invalid USB_RELAY_POWER_ON")
return 1
return self.__press(self.__power_on_port, interval=interval) |
def power_off(self, interval=200):
"""230v power off"""
if self.__power_off_port is None:
cij.err("cij.usb.relay: Invalid USB_RELAY_POWER_OFF")
return 1
return self.__press(self.__power_off_port, interval=interval) |
def power_btn(self, interval=200):
"""TARGET power button"""
if self.__power_btn_port is None:
cij.err("cij.usb.relay: Invalid USB_RELAY_POWER_BTN")
return 1
return self.__press(self.__power_btn_port, interval=interval) |
def get_chunk_information(self, chk, lun, chunk_name):
"""Get chunk information"""
cmd = ["nvm_cmd rprt_lun", self.envs,
"%d %d > %s" % (chk, lun, chunk_name)]
status, _, _ = cij.ssh.command(cmd, shell=True)
return status |
def is_bad_chunk(self, chk, yml):
"""Check the chunk is offline or not"""
cs = self.get_chunk_status(chk, yml)
if cs >= 8:
return True
return False |
def is_free_chunk(self, chk):
"""Check the chunk is free or not"""
cs = self.get_chunk_status(chk)
if cs & 0x1 != 0:
return True
return False |
def is_closed_chunk(self, chk):
"""Check the chunk is free or not"""
cs = self.get_chunk_status(chk)
if cs & 0x2 != 0:
return True
return False |
def is_open_chunk(self, chk):
"""Check the chunk is free or not"""
cs = self.get_chunk_status(chk)
if cs & 0x4 != 0:
return True
return False |
def vblk_erase(self, address):
"""nvm_vblk erase"""
cmd = ["nvm_vblk erase", self.envs, "0x%x" % address]
status, _, _ = cij.ssh.command(cmd, shell=True)
return status |
def slc_erase(self, address, BE_ID=0x1, PMODE=0x0100):
"""slc erase"""
cmd = ["NVM_CLI_BE_ID=0x%x" % BE_ID, "NVM_CLI_PMODE=0x%x" % PMODE, "nvm_cmd erase", self.envs, "0x%x" % address]
status, _, _ = cij.ssh.command(cmd, shell=True)
return status |
def env():
"""Verify BLOCK variables and construct exported variables"""
if cij.ssh.env():
cij.err("cij.block.env: invalid SSH environment")
return 1
block = cij.env_to_dict(PREFIX, REQUIRED)
block["DEV_PATH"] = "/dev/%s" % block["DEV_NAME"]
cij.env_export(PREFIX, EXPORTED, block... |
def script_run(trun, script):
"""Execute a script or testcase"""
if trun["conf"]["VERBOSE"]:
cij.emph("rnr:script:run { script: %s }" % script)
cij.emph("rnr:script:run:evars: %s" % script["evars"])
launchers = {
".py": "python",
".sh": "source"
}
ext = os.path.spl... |
def hook_setup(parent, hook_fpath):
"""Setup hook"""
hook = copy.deepcopy(HOOK)
hook["name"] = os.path.splitext(os.path.basename(hook_fpath))[0]
hook["name"] = hook["name"].replace("_enter", "").replace("_exit", "")
hook["res_root"] = parent["res_root"]
hook["fpath_orig"] = hook_fpath
hook[... |
def hooks_setup(trun, parent, hnames=None):
"""
Setup test-hooks
@returns dict of hook filepaths {"enter": [], "exit": []}
"""
hooks = {
"enter": [],
"exit": []
}
if hnames is None: # Nothing to do, just return the struct
return hooks
for hname in hnames:... |
def trun_to_file(trun, fpath=None):
"""Dump the given trun to file"""
if fpath is None:
fpath = yml_fpath(trun["conf"]["OUTPUT"])
with open(fpath, 'w') as yml_file:
data = yaml.dump(trun, explicit_start=True, default_flow_style=False)
yml_file.write(data) |
def trun_emph(trun):
"""Print essential info on"""
if trun["conf"]["VERBOSE"] > 1: # Print environment variables
cij.emph("rnr:CONF {")
for cvar in sorted(trun["conf"].keys()):
cij.emph(" % 16s: %r" % (cvar, trun["conf"][cvar]))
cij.emph("}")
if trun["con... |
def tcase_setup(trun, parent, tcase_fname):
"""
Create and initialize a testcase
"""
#pylint: disable=locally-disabled, unused-argument
case = copy.deepcopy(TESTCASE)
case["fname"] = tcase_fname
case["fpath_orig"] = os.sep.join([trun["conf"]["TESTCASES"], case["fname"]])
if not os.pat... |
def tsuite_exit(trun, tsuite):
"""Triggers when exiting the given testsuite"""
if trun["conf"]["VERBOSE"]:
cij.emph("rnr:tsuite:exit")
rcode = 0
for hook in reversed(tsuite["hooks"]["exit"]): # EXIT-hooks
rcode = script_run(trun, hook)
if rcode:
break
if t... |
def tsuite_enter(trun, tsuite):
"""Triggers when entering the given testsuite"""
if trun["conf"]["VERBOSE"]:
cij.emph("rnr:tsuite:enter { name: %r }" % tsuite["name"])
rcode = 0
for hook in tsuite["hooks"]["enter"]: # ENTER-hooks
rcode = script_run(trun, hook)
if rcode:
... |
def tsuite_setup(trun, declr, enum):
"""
Creates and initialized a TESTSUITE struct and site-effects such as creating
output directories and forwarding initialization of testcases
"""
suite = copy.deepcopy(TESTSUITE) # Setup the test-suite
suite["name"] = declr.get("name")
if suite["name"... |
def tcase_exit(trun, tsuite, tcase):
"""..."""
#pylint: disable=locally-disabled, unused-argument
if trun["conf"]["VERBOSE"]:
cij.emph("rnr:tcase:exit { fname: %r }" % tcase["fname"])
rcode = 0
for hook in reversed(tcase["hooks"]["exit"]): # tcase EXIT-hooks
rcode = script_run(t... |
def tcase_enter(trun, tsuite, tcase):
"""
setup res_root and aux_root, log info and run tcase-enter-hooks
@returns 0 when all hooks succeed, some value othervise
"""
#pylint: disable=locally-disabled, unused-argument
if trun["conf"]["VERBOSE"]:
cij.emph("rnr:tcase:enter")
cij.e... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.