[PATCH RFC i-g-t] lib/igt_kmemleak: library to interact with kmemleak

Peter Senna Tschudin peter.senna at linux.intel.com
Thu Jan 9 18:21:45 UTC 2025


Dear Bala,

Thank you for your review!

[...]

>>> +static void test_igt_kmemleak_cp_leaks_file(void)
>>> +{
>>> +	char dst_file_path[256] = "/tmp/igt_kmemleak_dstfile_XXXXXX";
>>> +	int fd;
>>> +	unsigned long crc;
>>> +
>>> +	fd = mkstemp(dst_file_path);
>>> +	close(fd);
>>> +
>>> +	igt_assert(igt_kmemleak_cp_leaks_file(dst_file_path));
>>> +
>>> +	/* Test that both files have the same size */
>>> +	fd = open(dst_file_path, O_RDONLY);
>>> +	igt_assert(fd >= 0);
>>> +	igt_assert(lseek(fd, 0, SEEK_END) == strlen(kmemleak_file_example));
>>> +	close(fd);
>>> +
>>> +	/* Test that both files have the same content */
>>> +	crc = crc32(0, Z_NULL, 0);
>>> +	crc = crc32(crc,
>>> +		    (const Bytef *)kmemleak_file_example,
>>> +		    strlen(kmemleak_file_example));
> 
> Did you miss the changes to compare the CRC?

Not only that, but I did not use crc32_file()... Thank you for catching this!
Fixed on V1.

> 
> Regards,
> Bala
> 

[...]


More information about the igt-dev mailing list