From 41e996f182bcd7fa759ecb15f19fb74409e36669 Mon Sep 17 00:00:00 2001 From: Douglas RAILLARD Date: Wed, 24 Apr 2019 10:54:56 +0100 Subject: [PATCH 1/2] lisa-test: Create latest_results symlink Update $LISA_HOME/results_latest symlink to point to exekall artifact folder when running lisa-test. --- shell/lisa_shell | 2 +- tools/exekall/exekall/main.py | 13 +++++++++++++ tools/lisa-test | 10 +++++++--- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/shell/lisa_shell b/shell/lisa_shell index 9ff930c89..fea0e8a32 100755 --- a/shell/lisa_shell +++ b/shell/lisa_shell @@ -25,7 +25,7 @@ # Python binary to use. This allows users to install multiple versions in # parallel, and ease testing -LISA_PYTHON=${LISA_PYTHON:-python3} +export LISA_PYTHON=${LISA_PYTHON:-python3} # By default use internal libraries export LISA_DEVMODE=${LISA_DEVMODE:-1} diff --git a/tools/exekall/exekall/main.py b/tools/exekall/exekall/main.py index 31f55afe7..408da902e 100755 --- a/tools/exekall/exekall/main.py +++ b/tools/exekall/exekall/main.py @@ -259,6 +259,10 @@ please run ``exekall run YOUR_SOURCES --help``. default=os.getenv('EXEKALL_ARTIFACT_DIR'), help="""Folder in which the artifacts will be stored. Defaults to EXEKALL_ARTIFACT_DIR env var.""") + add_argument(run_parser, '--symlink-artifact-dir-to', + type=pathlib.Path, + help="""Create a symlink pointing at the artifact dir.""") + add_argument(run_parser, '--load-db', action='append', default=[], help="""Reload a database to use some of its objects. The DB and its artifact directory will be merged in the produced DB at the end of the execution, to form a self-contained artifact directory.""") @@ -647,6 +651,7 @@ def do_run(args, parser, run_parser, argv): allowed_pattern_set = set(args.allow) allowed_pattern_set.update(restricted_pattern_set) allowed_pattern_set.update(callable_goal_pattern_set) + artifact_dir_link = args.symlink_artifact_dir_to # Setup the artifact_dir so we can create a verbose log in there date = datetime.datetime.now().strftime('%Y%m%d_%H:%M:%S') @@ -665,6 +670,14 @@ def do_run(args, parser, run_parser, argv): info_log = None else: artifact_dir.mkdir(parents=True) + if artifact_dir_link: + if artifact_dir_link.exists() and not artifact_dir_link.is_symlink(): + raise ValueError('This is not a symlink and will not be overwritten: {}'.format( + artifact_dir_link)) + with contextlib.suppress(FileNotFoundError): + artifact_dir_link.unlink() + artifact_dir_link.symlink_to(artifact_dir, target_is_directory=True) + artifact_dir = artifact_dir.resolve() # Update the CLI arguments so the customization module has access to the # correct value diff --git a/tools/lisa-test b/tools/lisa-test index 45b394f01..bd6d70036 100755 --- a/tools/lisa-test +++ b/tools/lisa-test @@ -23,10 +23,14 @@ else conf_opt=() fi +latest_link="$LISA_HOME/$("$LISA_PYTHON" -c 'from lisa.utils import LATEST_LINK; print(LATEST_LINK)')" + cmd=( - exekall run "$LISA_HOME/lisa/tests/" \ - "${conf_opt[@]}" \ - --select-multiple "$@" + exekall run "$LISA_HOME/lisa/tests/" \ + "${conf_opt[@]}" \ + --select-multiple \ + --symlink-artifact-dir-to "$latest_link" \ + "$@" ) # Show the command before running, so --help makes more sense -- GitLab From e610f5388907fbb655bdb7fb728e418013719c47 Mon Sep 17 00:00:00 2001 From: Douglas RAILLARD Date: Wed, 24 Apr 2019 11:09:57 +0100 Subject: [PATCH 2/2] doc: update man page --- doc/man1/exekall.1 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/man1/exekall.1 b/doc/man1/exekall.1 index 3d011d91c..b670b20fa 100644 --- a/doc/man1/exekall.1 +++ b/doc/man1/exekall.1 @@ -70,6 +70,7 @@ subcommands: usage: exekall run [\-h] [\-s ID_PATTERN] [\-\-list] [\-\-log\-level {debug,info,warn,error,critical}] [\-\-verbose] [\-\-artifact\-root ARTIFACT_ROOT | \-\-artifact\-dir ARTIFACT_DIR] + [\-\-symlink\-artifact\-dir\-to SYMLINK_ARTIFACT_DIR_TO] [\-\-load\-db LOAD_DB] [\-\-load\-type TYPE_PATTERN] [\-\-load\-uuid LOAD_UUID | \-\-replay REPLAY] [\-\-restrict CALLABLE_PATTERN] [\-\-forbid TYPE_PATTERN] @@ -109,6 +110,8 @@ optional arguments: \-\-artifact\-dir ARTIFACT_DIR Folder in which the artifacts will be stored. Defaults to EXEKALL_ARTIFACT_DIR env var. + \-\-symlink\-artifact\-dir\-to SYMLINK_ARTIFACT_DIR_TO + Create a symlink pointing at the artifact dir. \-\-load\-db LOAD_DB Reload a database to use some of its objects. The DB and its artifact directory will be merged in the produced DB at the end of the execution, to form a self\-contained artifact directory. -- GitLab