Subject: Re: [net-next v4 3/3] selftests/sysctl: add sysctl macro test

From: Jakub Kicinski <[email-masked]>
Date: Mon, 25 Apr 2022 12:58:28 -0700

On Fri, 22 Apr 2022 15:01:41 +0800 [email-masked] wrote:
>  static int __init test_sysctl_init(void)
>  {
> +	test_data.match_int[0] = *(int *)SYSCTL_ZERO,
> +	test_data.match_int[1] = *(int *)SYSCTL_ONE,
> +	test_data.match_int[2] = *(int *)SYSCTL_TWO,
> +	test_data.match_int[3] = *(int *)SYSCTL_THREE,
> +	test_data.match_int[4] = *(int *)SYSCTL_FOUR,
> +	test_data.match_int[5] = *(int *)SYSCTL_ONE_HUNDRED,
> +	test_data.match_int[6] = *(int *)SYSCTL_TWO_HUNDRED,
> +	test_data.match_int[7] = *(int *)SYSCTL_ONE_THOUSAND,
> +	test_data.match_int[8] = *(int *)SYSCTL_THREE_THOUSAND,
> +	test_data.match_int[9] = *(int *)SYSCTL_INT_MAX,
> +	test_data.match_int[10] = *(int *)SYSCTL_MAXOLDUID,
> +	test_data.match_int[11] = *(int *)SYSCTL_NEG_ONE,

> +	local VALUES=(0 1 2 3 4 100 200 1000 3000 $INT_MAX 65535 -1)

How does this test work? Am I reading it right that it checks if this
bash array is in sync with the kernel code?

I'd be better if we were checking the values of the constants against
literals / defines.