Skip to content

Commit cb787e8

Browse files
committed
xfstests: get XFSTESTS_BLACKLIST from file
set known issue file url to XFSTESTS_BLACKLIST if it starts with http:// or https:// For instance: XFSTESTS_BLACKLIST=http://example.com/blacklist.yaml
1 parent 208d333 commit cb787e8

File tree

3 files changed

+28
-3
lines changed

3 files changed

+28
-3
lines changed

lib/filesystem_utils.pm

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ use utils;
1818
use testapi;
1919

2020
use Mojo::JSON 'decode_json';
21+
use Mojo::UserAgent;
22+
use YAML::PP;
2123

2224
our @EXPORT = qw(
2325
str_to_mb
@@ -35,6 +37,7 @@ our @EXPORT = qw(
3537
validate_lsblk
3638
get_partition_table_via_blkid
3739
is_lsblk_able_to_display_mountpoints
40+
fetch_xfstests_blacklist_from_url
3841
generate_xfstests_list);
3942

4043
=head2 str_to_mb
@@ -513,6 +516,23 @@ sub validate_lsblk {
513516
return $errors;
514517
}
515518

519+
=head2 fetch_xfstests_blacklist_from_url
520+
521+
Fetch the xfstests blacklist YAML file from a specified URL.
522+
523+
Returns hash mapping of the YAML.
524+
525+
=cut
526+
527+
sub fetch_xfstests_blacklist_from_url {
528+
my $url = shift;
529+
my $ua = Mojo::UserAgent->new;
530+
my $res = $ua->get($url)->result;
531+
my $body = $res->body;
532+
my $yp = YAML::PP->new;
533+
return $yp->load_string($body);
534+
}
535+
516536
=head2
517537
518538
Generate xfstests subtests list

tests/xfstests/run.pm

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use utils;
2525
use Utils::Backends 'is_pvm';
2626
use serial_terminal 'select_serial_terminal';
2727
use power_action_utils qw(power_action prepare_system_shutdown);
28-
use filesystem_utils qw(format_partition generate_xfstests_list);
28+
use filesystem_utils qw(format_partition fetch_xfstests_blacklist_from_url generate_xfstests_list);
2929
use lockapi;
3030
use mmapi;
3131
use version_utils 'is_public_cloud';
@@ -118,11 +118,16 @@ sub run {
118118
}
119119

120120
# Generate xfstests blacklist
121-
my %black_list = (generate_xfstests_list($BLACKLIST), exclude_grouplist($TEST_RANGES, $GROUPLIST, $FSTYPE));
122121
my $whitelist;
123122
if (my $issues = get_var('XFSTESTS_KNOWN_ISSUES')) {
124123
$whitelist = LTP::WhiteList->new($issues);
125124
}
125+
if ($BLACKLIST =~ m{^https?://}i) {
126+
my $data = fetch_xfstests_blacklist_from_url($BLACKLIST);
127+
my $joined = join(',', map { $_->{items} } @{$data->{$TEST_SUITE}{xfstests_blacklist}}) if grep { defined $_->{items} } @{$data->{$TEST_SUITE}{xfstests_blacklist}};
128+
$BLACKLIST = $joined;
129+
}
130+
my %black_list = (generate_xfstests_list($BLACKLIST), exclude_grouplist($TEST_RANGES, $GROUPLIST, $FSTYPE));
126131

127132
my $subtest_num = scalar @tests;
128133
foreach my $index (0 .. $#tests) {

variables.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ Variable | Type | Default value | Details
436436
XFSTESTS | string | --- | Determines the action to be taken. If set to "installation", it runs xfstests installation and then shuts down. If set to <FS_TYPE> (e.g., "btrfs," "xfs," or "ext4"), the test will be executed on the specified file system.
437437
XFSTESTS_RANGES | string | | sub-tests ranges. This setting is mandatory. Support using "-" to define a range, or use "," to list separate subtests(e.g. xfs/001-999,generic/001). But the final test range will also count subtests defined in XFSTESTS_GROUPLIST, a skill to set subtests only by XFSTESTS_GROUPLIST is to set a minimal XFSTESTS_RANGES with XFSTESTS_GROUPLIST
438438
NO_SHUFFLE | boolean | 0 | the default sequence to run all subtests is a random sequence, it's designed to reduce the influence between each subtest. Set NO_SHUFFLE=1 to run in order
439-
XFSTESTS_BLACKLIST | string | | set the sub-tests will not run. Mostly use in the feature not supported, and exclude some critical issues to make whole tests stable. The final skip test list will also count those defined in XFSTESTS_GROUPLIST. It's also support "-" and "," to set skip range
439+
XFSTESTS_BLACKLIST | string | | set the sub-tests will not run. Mostly use in the feature not supported, and exclude some critical issues to make whole tests stable. The final skip test list will also count those defined in XFSTESTS_GROUPLIST. It's also support "-" and "," to set skip range. Or set the blacklist file url if starts with http:// or https://. For instance: XFSTESTS_BLACKLIST=http://example.com/blacklist.yaml
440440
XFSTESTS_GROUPLIST | string | | it's an efficient way to set XFSTESTS_RANGES. Most likely use in test whole range in a single test, such as test special mount option. The range is supported in xfstests upstream, to know the whole range of group names could take a look at xfstests upstream README file. This parameter in openqa supports not only "include" tests, but also "exclude" tests. To add a "!" before a group name to exclude all subtests in that group. Here is an example: e.g. XFSTESTS_GROUPLIST=quick,!fuzz,!fuzzers,!realtime (Add all subtests in quick group, and exclude all dangerous subtests in fuzz, fuzzers, realtime groups)
441441
XFSTESTS_KNOWN_ISSUES | string | | Used to specify a url for a json file with well known xfstests issues. If an error occur which is listed, then the result is overwritten with softfailure.
442442

0 commit comments

Comments
 (0)