Re: [PATCH v5 7/7] lib: Add 2 basic tests for .min_kver && .max_kver

Andrea Cervesato via ltp <[email protected]>
Newsgroups gmane.linux.ltp
Message-ID <[email protected]>
Hi Petr,

> +// SPDX-License-Identifier: GPL-2.0-or-later
> +/*
> + * Copyright (c) 2026 Petr Vorel <[email protected]>
> + */
> +
> +/*
> + * Basic test to test that .min_kver and .max_kver can be used together.
> + * Test should TCONF or TPASS.
> + */
> +
> +#include "tst_test.h"
> +
> +static void do_test(void)
> +{
> +	tst_res(TPASS, "Test has sufficient kernel version");
> +}
> +
> +static struct tst_test test = {
> +	.min_kver = "4.4",
> +	.max_kver = "7.2",
> +	.test_all = do_test,
> +};

this test is a bit weird, it's system dependent and it will TPASS or
TCONF according to the kernel version. Is there a way to test this
in a different way? I know it's hacky, but maybe we can use
__attribute__((constructor)) and fetch uname() info before running
the maximum kernel version check.

--
Andrea Cervesato
SUSE QE Automation Engineer Linux
andrea.cervesato-IBi9RG/[email protected]

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.