Skip to content
Snippets Groups Projects
Commit 6e4e7566 authored by Jan Včelák's avatar Jan Včelák :rocket:
Browse files

tests: log interesting environment variables

parent b94f5947
Branches
Tags
No related merge requests found
......@@ -26,6 +26,20 @@ def create_log(logger, filename="", level=logging.NOTSET):
logger.addHandler(handler)
return handler
def log_environment(filename):
def want_log(key):
return key in [ "CC", "CPP", "CFLAGS", "CPPFLAGS",
"LDFLAGS", "LIBS",
"PKG_CONFIG", "PKG_CONFIG_PATH", "PKG_CONFIG_LIBDIR",
"YAAC", "YFLAGS",
"MALLOC_PERTURB_", "MALLOC_CHECK_" ] or \
re.match(r'.+_(CFLAGS|LIBS)$', key) or \
re.match(r'^KNOT_TEST_', key)
with open(filename, "w") as log:
lines = ["%s=%s\n" % (k, v) for (k, v) in os.environ.items() if want_log(k)]
log.writelines(lines)
def parse_args(cmd_args):
parser = argparse.ArgumentParser()
parser.add_argument("-d", dest="debug", action="store_true", \
......@@ -95,6 +109,9 @@ def main(args):
except:
pass
# Write down environment
log_environment(os.path.join(outs_dir, "environment.log"))
# Set up logging.
log = logging.getLogger()
log.setLevel(logging.NOTSET)
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment