[LTP] [PATCH v1] shmget02: check if CONFIG_HUGETLBFS enabled in kernel
Cyril Hrubis
chrubis@suse.cz
Mon Aug 2 17:32:14 CEST 2021
Hi!
> Thanks a lot for reviewing.
>
> I agree that reading kconfig every time is not fun. But would it be better to read it once into global variable? My concern is that your solution implicitly changes expected values that might confuse people who occasionally don't look at the bottom of program.
>
> How about:
>
> inline void _hugetlbfs_supported()
> {
> struct tst_kconfig_var kconfig = {
> .id = CONFIG_HUGETLBFS,
> .id_len = sizeof(CONFIG_HUGETLBFS)-1,
> };
>
> tst_kconfig_read(&kconfig, 1);
> hugetlbfs_supported = kconfig.choice == 'y';
> }
> ....
>
> static void do_test(unsigned int n)
> {
> struct tcase *tc = &tcases[n];
> pid_t pid;
>
> if (((tc->flags & SHM_HUGETLB) == SHM_HUGETLB) && ! hugetlbfs_supported)
> {
> tst_brk(TCONF,
> "Unsuitable kernel config: CONFIG_HUGETLBFS missing");
> }
> ....
This does not check that we get a proper error when SHM_HUGETLB is not
supported by the kernel though, which is something that should be
checked as well.
--
Cyril Hrubis
chrubis@suse.cz
More information about the ltp
mailing list