[LTP] [PATCH 1/3] syscall/kcmp*: Convert to new API

Cyril Hrubis chrubis@suse.cz
Tue Jul 19 15:53:49 CEST 2016


Hi!
> +static void verify_kcmp(unsigned int n)
>  {
> -	if (fd2 > 0 && close(fd2) < 0)
> -		tst_resm(TWARN | TERRNO, "close fd2 failed");
> -	fd2 = 0;
> -	if (fd3 > 0 && close(fd3) < 0)
> -		tst_resm(TWARN | TERRNO, "close fd3 failed");
> -	fd3 = 0;
> -}
> +	struct test_case *tc = &test_cases[n];
>  
> -static void setup(void)
> -{
> -	if ((tst_kvercmp(3, 5, 0)) < 0) {
> -		tst_brkm(TCONF, NULL,
> -			"This test can only run on kernels that are 3.5. and higher");
> -	}
> +	pid1 = getpid();
>  
> -	tst_tmpdir();
> +	fd1 = SAFE_OPEN(TEST_FILE, O_CREAT | O_RDWR | O_TRUNC);

This SAFE_OPEN() has to be done in the test setup, otherwise it will
start to fail with large enough iteration (-i) parameter once the
maximal number of open files is reached.


The rest looks good.

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list