[PATCH i-g-t 1/2] tests/kms_3d: "1080p-left.png": No such file or directory fix

Naladala, Ramanaidu ramanaidu.naladala at intel.com
Wed Jun 19 04:51:52 UTC 2024


Hi Kamil,

This changes did part of VLK-35999.

Problem: In Ci infrastructure, CI Compile  igt tests and stored build asserts in somewhere. While testing CI will download the asserts from that place to DUT. Due to this .png files are getting missed from source directory and datadir directory. 

New Change to fix:
1. All PNG files are not source/executable files so created a data directory and copy all the .png files to data directory.
2. Added meson.build to install .png files to build/tests/data/ directory. 
2. Exported the data directory path to imgdir.
3. Changed the file open function according to it.

Thanks & Regards,
Ramanaidu N.

-----Original Message-----
From: Kamil Konieczny <kamil.konieczny at linux.intel.com> 
Sent: Tuesday, June 18, 2024 11:31 PM
To: igt-dev at lists.freedesktop.org
Cc: Naladala, Ramanaidu <ramanaidu.naladala at intel.com>; Joshi, Kunal1 <kunal1.joshi at intel.com>
Subject: Re: [PATCH i-g-t 1/2] tests/kms_3d: "1080p-left.png": No such file or directory fix

Hi Naladala,,
On 2024-06-18 at 17:46:37 +0530, Naladala, Ramanaidu wrote:

describe here what you did and why

> Signed-off-by: Naladala, Ramanaidu <ramanaidu.naladala at intel.com>
---------------- ^ ------- ^

This should be:
Signed-off-by: Ramanaidu Naladala <ramanaidu.naladala at intel.com>

imho the best place is to put it into your git config.

Regards,
Kamil

> ---
>  lib/igt_core.c                   |   9 +++++++--
>  lib/igt_core.h                   |   4 ++--
>  lib/meson.build                  |   1 +
>  meson.build                      |   1 +
>  tests/{ => data}/1080p-left.png  | Bin  tests/{ => 
> data}/1080p-right.png | Bin
>  tests/data/meson.build           |   8 ++++++++
>  tests/{ => data}/pass.png        | Bin
>  tests/meson.build                |   8 ++------
>  9 files changed, 21 insertions(+), 10 deletions(-)  rename tests/{ => 
> data}/1080p-left.png (100%)  rename tests/{ => data}/1080p-right.png 
> (100%)  create mode 100644 tests/data/meson.build  rename tests/{ => 
> data}/pass.png (100%)
> 
> diff --git a/lib/igt_core.c b/lib/igt_core.c index 
> 3ff3e0392..daef37c64 100644
> --- a/lib/igt_core.c
> +++ b/lib/igt_core.c
> @@ -3237,7 +3237,7 @@ void igt_reset_timeout(void)  }
>  
>  FILE *__igt_fopen_data(const char* igt_srcdir, const char* igt_datadir,
> -		       const char* filename)
> +		       const char* igt_imgdir,const char* filename)
>  {
>  	char path[PATH_MAX];
>  	FILE *fp;
> @@ -3249,7 +3249,12 @@ FILE *__igt_fopen_data(const char* igt_srcdir, const char* igt_datadir,
>  		fp = fopen(path, "r");
>  	}
>  	if (!fp) {
> -		snprintf(path, sizeof(path), "./%s", filename);
> +                snprintf(path, sizeof(path), "%s/%s", igt_imgdir, filename);
> +                fp = fopen(path, "r");
> +        }
> +
> +	if (!fp) {
> +		snprintf(path, sizeof(path), "./data/%s", filename);
>  		fp = fopen(path, "r");
>  	}
>  
> diff --git a/lib/igt_core.h b/lib/igt_core.h index 
> 084d94da7..c13711902 100644
> --- a/lib/igt_core.h
> +++ b/lib/igt_core.h
> @@ -1427,7 +1427,7 @@ static inline uint32_t 
> igt_seconds_elapsed(struct timespec *start)  void 
> igt_reset_timeout(void);
>  
>  FILE *__igt_fopen_data(const char* igt_srcdir, const char* igt_datadir,
> -		       const char* filename);
> +		       const char* igt_imgdir, const char* filename);
>  /**
>   * igt_fopen_data:
>   * @filename: filename to open.
> @@ -1436,7 +1436,7 @@ FILE *__igt_fopen_data(const char* igt_srcdir, const char* igt_datadir,
>   * then from build directory, and finally from current directory.
>   */
>  #define igt_fopen_data(filename) \
> -	__igt_fopen_data(IGT_SRCDIR, IGT_DATADIR, filename)
> +	__igt_fopen_data(IGT_SRCDIR, IGT_DATADIR,IGT_IMGDIR, filename)
>  
>  int igt_system(const char *command);
>  int igt_system_quiet(const char *command); diff --git 
> a/lib/meson.build b/lib/meson.build index e2f740c11..9e210f26c 100644
> --- a/lib/meson.build
> +++ b/lib/meson.build
> @@ -226,6 +226,7 @@ foreach f: lib_sources
>  	    '-DIGT_DATADIR="@0@"'.format(join_paths(prefix, datadir)),
>  	    '-DIGT_SRCDIR="@0@"'.format(srcdir),
>  	    '-DIGT_LOG_DOMAIN="@0@"'.format(f.split('.')[0]),
> +            '-DIGT_IMGDIR="@0@"'.format(imgdir),
>  	])
>  
>      lib_intermediates += lib
> diff --git a/meson.build b/meson.build index ab44aadb1..20fd70632 
> 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -282,6 +282,7 @@ vmwgfxdir = join_paths(libexecdir, 'vmwgfx')  
> mandir = get_option('mandir')  pkgconfigdir = join_paths(libdir, 
> 'pkgconfig')
>  python3 = find_program('python3', required : true)
> +imgdir = join_paths(build_root,'tests','data')
>  
>  if get_option('use_rpath')
>  	# Set up runpath for the test executables towards libigt.so.
> diff --git a/tests/1080p-left.png b/tests/data/1080p-left.png 
> similarity index 100% rename from tests/1080p-left.png rename to 
> tests/data/1080p-left.png diff --git a/tests/1080p-right.png 
> b/tests/data/1080p-right.png similarity index 100% rename from 
> tests/1080p-right.png rename to tests/data/1080p-right.png diff --git 
> a/tests/data/meson.build b/tests/data/meson.build new file mode 100644 
> index 000000000..01af4b48c
> --- /dev/null
> +++ b/tests/data/meson.build
> @@ -0,0 +1,8 @@
> +image_files = [
> +  '1080p-left.png',
> +  '1080p-right.png',
> +  'pass.png',
> +]
> +install_data(sources : image_files, install_dir : imgdir) 
> +install_data(sources : image_files, install_dir : datadir)
> +
> diff --git a/tests/pass.png b/tests/data/pass.png similarity index 
> 100% rename from tests/pass.png rename to tests/data/pass.png diff 
> --git a/tests/meson.build b/tests/meson.build index 
> 758ae090c..b4a92e997 100644
> --- a/tests/meson.build
> +++ b/tests/meson.build
> @@ -467,6 +467,8 @@ subdir('vc4')
>  
>  subdir('vmwgfx')
>  
> +subdir('data')
> +
>  gen_testlist = find_program('generate_testlist.sh')
>  test_list_target = custom_target('testlist',
>  	      output : 'test-list.txt',
> @@ -505,11 +507,5 @@ if not meson.is_cross_build()
>  			output : 'gem_stress.testlist')
>  endif
>  
> -image_files = [
> -  '1080p-left.png',
> -  '1080p-right.png',
> -  'pass.png',
> -]
> -install_data(sources : image_files, install_dir : datadir)
>  
>  subdir('intel-ci')
> --
> 2.43.0
> 


More information about the igt-dev mailing list