Skip to content

gi-test: Fix gir file tests

Chun-wei Fan requested to merge fix-gi-test into master

Hi,

The gi-tester script may construct the path for where to find the reference *.gir files incorrectly as os.path.splitext(targetname)[0] may return the full path of the target file, so that the gir tests will fail as the reference gir files could not be located. This attempts to fix the tests by going further to acquire only the file name of the target file, so that we can construct the path of the reference gir files correctly. This will apply for both the master and gnome-3-32 branches.

From the commit message:

The os.path.splitext(targetname)[0] may return the fullpath of the target gir, which subsequently may make the path constructed to locate the *-expected.gir to be incorrect, causing the gir tests to fail.

For example, the sources might reside in d:\git_repos\gi and the build is carried out in d:\gi.build, and when the TypeDefs gir test is run, the script would construct the path for the reference gir to be at:

D:\gi.build\tests\scanner\Typedefs-1.0-expected.gir

instead of

D:\git_repos\gi\tests\scanner\Typedefs-1.0-expected.gir

Fix this by going further to get only the filename of the targetname so that we can construct the path to the reference gir files correctly.

With blessings, thank you!

Merge request reports