Skip to content

Commit 3e93a31

Browse files
committed
Include config in error output
Signed-off-by: Ivan Kanakarakis <ivan.kanak@gmail.com>
1 parent 6f45475 commit 3e93a31

2 files changed

Lines changed: 15 additions & 6 deletions

File tree

src/xmlsec/test/__init__.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ def run_cmd(args, softhsm_conf=None):
3030
logging.debug(out)
3131
rv = proc.wait()
3232
if rv:
33-
msg = '[exit-code: {code}] [stdout: {out}] [stderr: {err}]'.format(
34-
code=rv, out=out.strip(), err=err.strip(),
33+
with open(softhsm_conf) as f:
34+
conf = f.read()
35+
msg = '[code: {code}] [stdout: {out}] [stderr: {err}] [config: {conf}]'
36+
msg = msg.format(
37+
code=rv, out=out.strip(), err=err.strip(), conf=conf,
3538
)
3639
raise RuntimeError(msg)

src/xmlsec/test/p11_test.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
'P11_MODULE': [
4040
'/usr/lib/softhsm/libsofthsm2.so',
4141
'/usr/lib/softhsm/libsofthsm.so',
42-
'/usr/lib/libsofthsm.so',
4342
],
4443
'P11_ENGINE': [
4544
'/usr/lib/ssl/engines/libpkcs11.so',
@@ -114,11 +113,18 @@ def setup():
114113
with open(softhsm_conf, "w") as f:
115114
if softhsm_version == 2:
116115
softhsm_db = _td()
117-
f.write("#Generated by pyXMLSecurity test\ndirectories.tokendir = %s\nobjectstore.backend = file\nlog.level = DEBUG\n"%softhsm_db)
118-
116+
f.write("""
117+
# Generated by pyXMLSecurity test
118+
directories.tokendir = %s
119+
objectstore.backend = file
120+
log.level = DEBUG
121+
""" % softhsm_db)
119122
else:
120123
softhsm_db = _tf()
121-
f.write("#Generated by pyXMLSecurity test\n0:%s\n" % softhsm_db)
124+
f.write("""
125+
# Generated by pyXMLSecurity test
126+
0:%s
127+
""" % softhsm_db)
122128

123129
logging.debug("Initializing the token")
124130
run_cmd([component_path['SOFTHSM'],

0 commit comments

Comments
 (0)