From 355507e58d7bef378377913052aebcdfe6f48fa7 Mon Sep 17 00:00:00 2001 From: Wabri <12409541+Wabri@users.noreply.github.com> Date: Fri, 17 Jan 2025 17:38:40 +0100 Subject: [PATCH] Extract os-autoinst basepath using enviromental variable --- Makefile | 3 +++ t/lib/OpenQA/Test/Utils.pm | 10 ++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index e370a597a23..708ede79093 100644 --- a/Makefile +++ b/Makefile @@ -49,6 +49,9 @@ OPENQA_SCHEDULER_HOST = OPENQA_WEB_SOCKETS_HOST = OPENQA_SCHEDULER_STARVATION_PROTECTION_PRIORITY_OFFSET = +# change if os-autoinst project root is different from '../os-autoinst' +OS_AUTOINST_BASEDIR = + .PHONY: help help: @echo Call one of the available targets: diff --git a/t/lib/OpenQA/Test/Utils.pm b/t/lib/OpenQA/Test/Utils.pm index a66ca623647..6a71b604bd3 100644 --- a/t/lib/OpenQA/Test/Utils.pm +++ b/t/lib/OpenQA/Test/Utils.pm @@ -44,6 +44,7 @@ BEGIN { require OpenQA::Utils; $ENV{MOJO_HOME} = Mojo::Home->new->detect('OpenQA::Utils'); } + $ENV{OS_AUTOINST_BASEDIR} //= '../os-autoinst'; } our (@EXPORT, @EXPORT_OK); @@ -353,13 +354,14 @@ sub setup_share_dir { path($sharedir, 'factory', 'iso')->make_path; - my $iso_file_path = abs_path('../os-autoinst/t/data/Core-7.2.iso') or die 'Core-7.2.iso not found'; + my $iso_file_path = abs_path($ENV{OS_AUTOINST_BASEDIR}, '/t/data/Core-7.2.iso') or die 'Core-7.2.iso not found'; my $iso_link_path = path($sharedir, 'factory', 'iso')->child('Core-7.2.iso')->to_string(); symlink($iso_file_path, $iso_link_path) || die "can't symlink $iso_link_path -> $iso_file_path: $!"; path($sharedir, 'tests')->make_path; - my $tests_dir_path = abs_path('../os-autoinst/t/data/tests/') or die 'tests dir not found'; + my $tests_dir_path = abs_path($ENV{OS_AUTOINST_BASEDIR}, '/t/data/tests/') + or die 'tests dir not found'; my $tests_link_path = path($sharedir, 'tests')->child('tinycore'); symlink $tests_dir_path, $tests_link_path or die "can't symlink '$tests_link_path' -> '$tests_dir_path': $!"; note "using tests and needles from $tests_dir_path"; @@ -405,7 +407,7 @@ sub setup_worker { # uncoverable statement } sub start_worker ($connect_args) { - my $os_autoinst_path = '../os-autoinst'; + my $os_autoinst_path = $ENV{OS_AUTOINST_BASEDIR}; my $isotovideo_path = $os_autoinst_path . '/isotovideo'; # save testing time as we do not test a webUI host being down for @@ -413,7 +415,7 @@ sub start_worker ($connect_args) { $ENV{OPENQA_WORKER_CONNECT_RETRIES} = 1; # enable additional diagnostics for serialization errors $ENV{DEBUG_JSON} = 1; - my @cmd = qw(perl ./script/worker --isotovideo=../os-autoinst/isotovideo --verbose); + my @cmd = ("perl", "./script/worker", "--isotovideo=$isotovideo_path", "--verbose"); push @cmd, @$connect_args; start \@cmd; }