From cf68d1384ff2630e6c4cd8a7998b779ca71be295 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Tue, 20 Sep 2022 08:49:51 +0200 Subject: tst_license.pl: Fix test for excluded branches in CI The test for excluded branches didn't work in the CI for Qt modules, because the source directories are no proper git repositories. Check first the CI environment variable TESTED_MODULE_BRANCH_COIN and the git branch as fallback. Change-Id: I30442b26c356422bc3f9a8d7950cb86887abdeea Reviewed-by: Alexandru Croitor (cherry picked from commit 293bc86c16c5f25ca30e0854836cb1f518f95577) Reviewed-by: Qt Cherry-pick Bot --- tests/prebuild/license/tst_licenses.pl | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/prebuild/license/tst_licenses.pl b/tests/prebuild/license/tst_licenses.pl index 3812d7f..6c5cf27 100755 --- a/tests/prebuild/license/tst_licenses.pl +++ b/tests/prebuild/license/tst_licenses.pl @@ -303,6 +303,15 @@ sub gitBranch return ''; } +sub moduleBranch +{ + my $branch = $ENV{TESTED_MODULE_BRANCH_COIN}; + if (!defined($branch)) { + $branch = gitBranch(); + } + return $branch; +} + sub loadLicense { my $licenseFile = shift; @@ -751,7 +760,7 @@ sub run my $excludedBranches = $excludedModules{$moduleName}; if (defined($excludedBranches)) { if (scalar(@$excludedBranches) > 0) { - my $branch = gitBranch(); + my $branch = moduleBranch(); my $quotedBranch = quotemeta($branch); if ($branch ne '' && grep(/$quotedBranch/, @$excludedBranches)) { plan skip_all => 'Branch ' . $branch . ' of ' . $moduleName -- cgit v1.2.1