summaryrefslogtreecommitdiff
path: root/indra/cmake/run_build_test.py
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2019-11-23 22:16:39 -0500
committerNat Goodspeed <nat@lindenlab.com>2020-03-25 15:28:17 -0400
commit70a0b52039a75c2c482224c9b4a6c133cac0ae76 (patch)
tree9789886f0186c1668a28ab227bc210f96cfc99ac /indra/cmake/run_build_test.py
parent328329fceab6b18dd7dda6f7ce9a3d4788fd7c54 (diff)
DRTVWR-494: Show copy-paste-friendly env vars and test command.
Moderately often I want to copy the (long) integration test program path from build output and rerun the test program by hand. But typically we need environment variables set as well so it can find its dynamic libraries. This has resulted in my copying parts of several lines of build output, then pasting to a command prompt, then hand-tweaking the pasted text so it makes sense as a command. Streamline run_build_test.py output so less hand-tweaking is needed.
Diffstat (limited to 'indra/cmake/run_build_test.py')
-rwxr-xr-xindra/cmake/run_build_test.py19
1 files changed, 13 insertions, 6 deletions
diff --git a/indra/cmake/run_build_test.py b/indra/cmake/run_build_test.py
index 210e43b232..ec5d33f902 100755
--- a/indra/cmake/run_build_test.py
+++ b/indra/cmake/run_build_test.py
@@ -87,7 +87,6 @@ def main(command, arguments=[], libpath=[], vars={}):
# might not exist; instead of KeyError, just use an empty string.
dirs = os.environ.get(var, "").split(os.pathsep)
# Append the sequence in libpath
- log.info("%s += %r" % (var, libpath))
for dir in libpath:
# append system paths at the end
if dir in ('/lib', '/usr/lib'):
@@ -105,16 +104,21 @@ def main(command, arguments=[], libpath=[], vars={}):
# Now rebuild the path string. This way we use a minimum of separators
# -- and we avoid adding a pointless separator when libpath is empty.
os.environ[var] = os.pathsep.join(clean_dirs)
- log.info("%s = %r" % (var, os.environ[var]))
+ # This output format is intended to make it straightforward to copy
+ # the variable settings and the command itself from the build output
+ # and paste the whole thing at a command prompt to rerun it manually.
+ log.info("%s='%s' \\" % (var, os.environ[var]))
# Now handle arbitrary environment variables. The tricky part is ensuring
# that all the keys and values we try to pass are actually strings.
if vars:
- log.info("Setting: %s" % ("\n".join(["%s=%s" % (key, value) for key, value in vars.iteritems()])))
+ for key, value in vars.items():
+ # As noted a few lines above, facilitate copy-paste rerunning.
+ log.info("%s='%s' \\" % (key, value))
os.environ.update(dict([(str(key), str(value)) for key, value in vars.iteritems()]))
# Run the child process.
command_list = [command]
command_list.extend(arguments)
- log.info("Running: %s" % " ".join(command_list))
+ log.info(" ".join((("'%s'" % w) if ' ' in w else w) for w in command_list))
# Make sure we see all relevant output *before* child-process output.
sys.stdout.flush()
try:
@@ -305,8 +309,11 @@ def get_windows_table():
return _windows_table
-log=logging.getLogger(__name__)
-logging.basicConfig()
+# Use this instead of logging.basicConfig() because the latter prefixes
+# every line of output with INFO:__main__:...
+log=logging.getLogger()
+log.setLevel(logging.INFO)
+log.addHandler(logging.StreamHandler())
if __name__ == "__main__":
import argparse