mirror of
https://gitlab.nic.cz/knot/knot-dns.git
synced 2026-02-03 18:49:28 -05:00
The addresses must be configured in advance, e.g.:
for i in {1..32}; do sudo ip address add 127.0.1.$i/32 dev lo; done
for i in {1..32}; do sudo ip address add ::1$i/128 dev lo; done
33 lines
1 KiB
Python
33 lines
1 KiB
Python
#!/usr/bin/env python3
|
|
|
|
class Context(object):
|
|
class _Context(object):
|
|
def __init__(self):
|
|
# Current job id (counted from 1)
|
|
self.job_id = None
|
|
# Current module name.
|
|
self.module = ""
|
|
# Current case relative directory.
|
|
self.test_dir = ""
|
|
# Current case absolute output directory.
|
|
self.out_dir = ""
|
|
# Current case log file.
|
|
self.case_log = None
|
|
# Current test object (for stopping it from the main script).
|
|
self.test = None
|
|
|
|
# Indication for failed test.
|
|
self.err = False
|
|
# What is wrong.
|
|
self.err_msg = ""
|
|
|
|
_INSTANCE = None
|
|
|
|
def __new__(cls):
|
|
if not Context._INSTANCE:
|
|
Context._INSTANCE = Context._Context()
|
|
return Context._INSTANCE
|
|
def __getattribute__(self, name):
|
|
return getattr(self._INSTANCE, name)
|
|
def __setattr__(self, name, val):
|
|
return setattr(self._INSTANCE, name, val)
|