[gobject-introspection/fix-gi-test] gi-test: Fix gir file tests



commit 4bef7765cf90955fa655da150ce3839b966b9612
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Tue Apr 30 17:46:54 2019 +0800

    gi-test: Fix gir file tests
    
    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.

 tests/gi-tester | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/tests/gi-tester b/tests/gi-tester
index 1c92fe3a..da09ff1d 100755
--- a/tests/gi-tester
+++ b/tests/gi-tester
@@ -92,8 +92,9 @@ def main(argv):
         # For example, on OSX, shared libraries have the extension .dylib.
         # Ignore this field when determining whether the output succeeded.
         ignore = ['shared-library=".*"$']
+        target_basename = os.path.splitext(targetname)[0].split(os.sep)[-1]
         expected = os.path.join(
-            srcdir, os.path.splitext(targetname)[0] + "-expected.gir")
+            srcdir, target_basename + "-expected.gir")
         actual = os.path.join(builddir, targetname)
         assert_no_diff(expected, actual, ignore=ignore)
     elif targetname.rsplit("-")[-1] in ("C", "Python", "Gjs"):


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]