Skip to content

Commit a54f9e8

Browse files
committed
feat(devtool): specify wanted artifacts for test command
Add `--artifacts` option to `devtool test` to simplify changing between different sets of artifacts. Signed-off-by: Egor Lazarchuk <[email protected]>
1 parent 7f4186b commit a54f9e8

File tree

1 file changed

+33
-6
lines changed

1 file changed

+33
-6
lines changed

tools/devtool

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -460,9 +460,10 @@ cmd_help() {
460460
echo " like `download_ci_artifacts` cmd. Alternatively it is possible to manually write local "
461461
echo " path to artifacts directory into $LOCAL_ARTIFACTS_CURRENT_DIR_FILE file"
462462
echo ""
463-
echo " ensure_current_artifacts_are_set_up"
464-
echo " Makes sure there are some artifacts setup as current ones. If no current artifacts are setup"
465-
echo " downloads latest artifacts and sets them up as current."
463+
echo " ensure_current_artifacts_are_set_up s3_uri/directory name"
464+
echo " Makes sure the $LOCAL_ARTIFACTS_CURRENT_DIR_FILE file contains a path to current artifacts."
465+
echo " If file already exist, change it to point to specified artifacts. If file does not exist,"
466+
echo " try to download artifacts from S3 and sets them as current."
466467
echo ""
467468

468469
cat <<EOF
@@ -638,10 +639,26 @@ cmd_set_current_artifacts() {
638639
}
639640

640641
cmd_ensure_current_artifacts_are_set_up() {
642+
local artifacts=$1
641643
if [ -f $LOCAL_ARTIFACTS_CURRENT_DIR_FILE ]; then
642-
say "Current artifacts already setup at " $(cat $LOCAL_ARTIFACTS_CURRENT_DIR_FILE)
644+
local current_local_artifacts_path=$(cat $LOCAL_ARTIFACTS_CURRENT_DIR_FILE)
645+
if [ -z $artifacts ]; then
646+
say "Current artifacts already setup at " $current_local_artifacts_path
647+
else
648+
local local_artifacts_path=$(get_local_artifacts_path $artifacts)/$(uname -m)
649+
if [ $current_local_artifacts_path == $local_artifacts_path ]; then
650+
say "Current artifacts already setup at " $current_local_artifacts_path
651+
else
652+
echo $local_artifacts_path > $LOCAL_ARTIFACTS_CURRENT_DIR_FILE
653+
say "Current artifacts setup at " $local_artifacts_path
654+
fi
655+
fi
643656
else
644-
download_ci_artifacts
657+
if [ -z $artifacts ]; then
658+
download_ci_artifacts
659+
else
660+
download_ci_artifacts $artifacts
661+
fi
645662
echo $LOCAL_ARTIFACTS_PATH > $LOCAL_ARTIFACTS_CURRENT_DIR_FILE
646663
say "Current artifacts downloaded and setup at " $LOCAL_ARTIFACTS_PATH
647664
fi
@@ -794,6 +811,10 @@ cmd_test() {
794811
shift
795812
local cpuset_mems="$1"
796813
;;
814+
"--artifacts")
815+
shift
816+
local artifacts="$1"
817+
;;
797818
"--performance")
798819
local performance_tweaks=1;
799820
;;
@@ -824,7 +845,13 @@ cmd_test() {
824845
[ $do_kvm_check != 0 ] && ensure_kvm
825846
ensure_devctr
826847
ensure_build_dir
827-
[ $do_artifacts_check != 0 ] && cmd_ensure_current_artifacts_are_set_up
848+
if [ $do_artifacts_check != 0 ]; then
849+
if [ -z $artifacts ]; then
850+
cmd_ensure_current_artifacts_are_set_up
851+
else
852+
cmd_ensure_current_artifacts_are_set_up $artifacts
853+
fi
854+
fi
828855

829856
if [ $do_build != 0 ]; then
830857
cmd_build --release

0 commit comments

Comments
 (0)