aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/test/nist.py
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2017-07-27 11:14:44 +0200
committerEgor Tensin <Egor.Tensin@gmail.com>2017-07-27 11:14:44 +0200
commitc8f695d0a4336016d7fb67475b0c8eebfdc7f806 (patch)
tree80f06ac8256bad73c6a7aee54eeb44e3f0272b2e /test/nist.py
parenttest/all.bat: code style (diff)
downloadaes-tools-c8f695d0a4336016d7fb67475b0c8eebfdc7f806.tar.gz
aes-tools-c8f695d0a4336016d7fb67475b0c8eebfdc7f806.zip
test: support running scripts from other dirs
Diffstat (limited to '')
-rw-r--r--test/nist.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/test/nist.py b/test/nist.py
index d0fd6ce..f7a119f 100644
--- a/test/nist.py
+++ b/test/nist.py
@@ -217,11 +217,15 @@ def run_decryption_test(tools, algorithm, mode, use_boxes=False):
logging.exception(e)
return TestExitCode.ERROR
+_script_dir = os.path.dirname(__file__)
+_script_name = os.path.splitext(os.path.basename(__file__))[0]
+
def _build_default_log_path():
- return datetime.now().strftime('{}_%Y-%m-%d_%H-%M-%S.log').format(
- os.path.splitext(os.path.basename(__file__))[0])
+ timestamp = datetime.now().strftime('%Y-%m-%d_%H-%M-%S')
+ fn = '{}_{}.log'.format(_script_name, timestamp)
+ return os.path.join(_script_dir, fn)
-def run_tests(tools_path=(), use_sde=False, use_boxes=False, log_path=None):
+def _setup_logging(log_path=None):
if log_path is None:
log_path = _build_default_log_path()
@@ -230,6 +234,8 @@ def run_tests(tools_path=(), use_sde=False, use_boxes=False, log_path=None):
format='%(asctime)s | %(module)s | %(levelname)s | %(message)s',
level=logging.DEBUG)
+def run_tests(tools_path=(), use_sde=False, use_boxes=False, log_path=None):
+ _setup_logging(log_path)
tools = Tools(tools_path, use_sde=use_sde)
exit_codes = []