-
Notifications
You must be signed in to change notification settings - Fork 282
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove cyclic dependency between
main_common.pm
and main_ltp.pm
Having a cyclic dependency is generally wrong. It now finally leads to problems when trying to use `repo_tools.pm` from `LTP/utils.pm` which on its own should be fine. Instead of relying on `main_ltp.pm` being loaded implicitly via `main_common.pm` (which `main_ltp.pm` itself depends on) this change simply loads `main_ltp.pm` where it is needed. This change preserves the error handling. To avoid duplication the error handling was moved in the separate module `main_ltp_loader.pm` which is used instead of using `main_ltp.pm` directly. It still works (tested by putting `use foo;` in `main_ltp.pm` and running the compile check).
- Loading branch information
Showing
5 changed files
with
31 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Copyright SUSE LLC | ||
# SPDX-License-Identifier: GPL-2.0-or-later | ||
|
||
package main_ltp_loader; | ||
use strict; | ||
use warnings; | ||
use base 'Exporter'; | ||
use Exporter; | ||
|
||
our @EXPORT_OK = qw(load_kernel_tests); | ||
|
||
# Isolate the loading of LTP tests because they often rely on newer features | ||
# not present on all workers. If they are isolated then only the LTP tests | ||
# will fail to load when there is a version mismatch instead of all tests. | ||
local $@; | ||
eval "use main_ltp 'load_kernel_tests'"; | ||
if ($@) { | ||
bmwqemu::fctwarn("Failed to load main_ltp.pm:\n$@", 'main_ltp.pm'); | ||
eval q%{ | ||
sub load_kernel_tests { | ||
die "Can not run kernel tests because evaluating main_ltp.pm failed" | ||
if is_kernel_test; | ||
return 0; | ||
} | ||
%; | ||
} | ||
|
||
1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters