Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

meson: add tests #3176

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft

meson: add tests #3176

wants to merge 4 commits into from

Conversation

neheb
Copy link
Collaborator

@neheb neheb commented Feb 19, 2025

Localization is not implemented.

Let's see if this works...

@neheb
Copy link
Collaborator Author

neheb commented Feb 19, 2025

MSYS2 and MSVC:

 subprocess.CalledProcessError: Command '['D:/a/exiv2/exiv2/build/exiv2', '--verbose', '--version']' returned non-zero exit status 3221225781.

That is an rpath problem. One way to fix is to just build static.

FreeBSD:

env: python3: No such file or directory

Now this is interesting. I assume it's just called python there. But runner.py uses python3 as the binary name. And I guess meson's find_program doesn't rewrite it.

@eli-schwartz any thoughts?

Ubuntu:

test_run (test_config_file.TestLensConfigFile) ... FAIL

======================================================================
FAIL: test_run (test_config_file.TestLensConfigFile)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/runner/work/exiv2/exiv2/tests/system_tests.py", line 650, in test_run
    self.compare_stdout(i, command, processed_stdout, stdout)
  File "/home/runner/work/exiv2/exiv2/tests/system_tests.py", line 763, in compare_stdout
    self._compare_output(
  File "/home/runner/work/exiv2/exiv2/tests/system_tests.py", line 742, in _compare_output
    self.assertMultiLineEqual(
AssertionError: 'Exif[30 chars]           Byte        1  Sigma 120-300mm F2.8 DG OS HSM | S\n' != 'Exif[30 chars]           Byte        1  TEST CONFIGURATION FILE!\n'
- Exif.NikonLd3.LensIDNumber                   Byte        1  Sigma 120-300mm F2.8 DG OS HSM | S
+ Exif.NikonLd3.LensIDNumber                   Byte        1  TEST CONFIGURATION FILE!
 : Standard output does not match

I wonder what's going on here.

@eli-schwartz
Copy link
Contributor

Now this is interesting. I assume it's just called python there. But runner.py uses python3 as the binary name. And I guess meson's find_program doesn't rewrite it.

@eli-schwartz any thoughts?

On FreeBSD, they consider it "sneaky" and bad behavior for any software to try to run python without installing as a port. So there is no "python" program and no "python3" program either, you have to invoke it as "python3.11" or whatever.

I think there may be a non-default package you can install that provides a symlink for you.

@neheb
Copy link
Collaborator Author

neheb commented Feb 19, 2025

======================================================================
FAIL: test_run (redmine.test_issue_662.UnicodeEncodingOfExifUserCommentTag.test_run)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "D:/a/exiv2/exiv2/tests/system_tests.py", line 650, in test_run
    self.compare_stdout(i, command, processed_stdout, stdout)
  File "D:/a/exiv2/exiv2/tests/system_tests.py", line 763, in compare_stdout
    self._compare_output(
  File "D:/a/exiv2/exiv2/tests/system_tests.py", line 742, in _compare_output
    self.assertMultiLineEqual(
AssertionError: 'Exif[202 chars]09 00 54 00 61 00 62 00                          \t.T.a.b.\n\n' != 'Exif[202 chars]09 00 54 00 61 00 62 00                          ..T.a.b.\n\n'
  ExifTag                    
    0000  1a 00 00 00                                      ....
  
  UserComment                
    0000  55 4e 49 43 4f 44 45 00 57 00 69 00 74 00 68 00  UNICODE.W.i.t.h.
-   0010  09 00 54 00 61 00 62 00                          	.T.a.b.
?                                                          ^
+   0010  09 00 54 00 61 00 62 00                          ..T.a.b.
?                                                          ^
  
 : Standard output does not match

 ======================================================================
FAIL: test_run (redmine.test_issue_922.AddMinusPSOption.test_run)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "D:/a/exiv2/exiv2/tests/system_tests.py", line 650, in test_run
    self.compare_stdout(i, command, processed_stdout, stdout)
  File "D:/a/exiv2/exiv2/tests/system_tests.py", line 763, in compare_stdout
    self._compare_output(
  File "D:/a/exiv2/exiv2/tests/system_tests.py", line 742, in _compare_output
    self.assertMultiLineEqual(
AssertionError: 'STRU[468 chars]..i8.\t......af\\...w_3.. | 0x363e2409\n   130[1325 chars]82\n' != 'STRU[468 chars]..i8........af\\...w_3.. | 0x363e2409\n   1304[1324 chars]82\n'
  STRUCTURE OF PNG FILE: D:/a/exiv2/exiv2/test/data/exiv2-bug922.png
   address | chunk |  length | data                           | checksum
         8 | IHDR  |      13 | ...@........                   | 0x7f775da4
        33 | zTXt  |    8769 | Raw profile type exif..x...[r. | 0x4a89d860
      8814 | zTXt  |     270 | Raw profile type iptc..x.=QKn. | 0x29f9e2d3
      9096 | iTXt  |    2524 | XML:com.adobe.xmp.....<?xpacke | 0x1df4a351
-    11632 | iCCP  |    1404 | icc..x...i8.	......af\...w_3.. | 0x363e2409
?                                          ^
+    11632 | iCCP  |    1404 | icc..x...i8........af\...w_3.. | 0x363e2409
?                                          ^
     13048 | sBIT  |       3 | ...                            | 0xdbe14fe0
     13063 | zTXt  |      87 | Software..x...A.. ......B....} | 0xcd30861a
     13162 | IDAT  |    8192 | x...Y.$Wv&v.{.{l.T.......[w.=m | 0x1b2c97be
     21366 | IDAT  |    8192 | .4X.y.AR...4....:Ue..U.|1..:.. | 0xb3fecb3e
     29570 | IDAT  |    8192 | 'g.!... ...n...s..Jdz......... | 0xd040336d
     37774 | IDAT  |    8192 | ........k....CY/75I..u;.. .z.. | 0xf42a2c7d
     45978 | IDAT  |    8192 | .f>..]....UKqD2s.(.q....=x.l.\ | 0xc177fe83
     54182 | IDAT  |    8192 | .i.{!!B0...C!4.p..`D g`....... | 0x0e276268
     62386 | IDAT  |    8192 | .*.].4..Q..}(9...S0&.......T.9 | 0x297bb2db
     70590 | IDAT  |    8192 | ..k...6....g.1..}.].&.H....... | 0x05f6f4ef
     78794 | IDAT  |    8192 | .j..S.........z..!U.G0*.m%..09 | 0xe0946eb5
     86998 | IDAT  |    8192 | .....t.>!.....6^.<..;..?.$I..M | 0x843ecce0
     95202 | IDAT  |    8192 | W.&5.5J........FW`....3.N.9Pk; | 0x3a3dfeee
    103406 | IDAT  |    8192 | .....d.z".`...v=g-..-.c8...Z.5 | 0x65d6df49
    111610 | IDAT  |    8192 | .."...o<&."....1M....1&. ..5.. | 0x700b8cde
    119814 | IDAT  |    8192 | k........!..B*.....\*.(!..0.s. | 0x9b33b5b7
    128018 | IDAT  |    3346 | .Y.L@I$M.Z[.0A ...K#.t.0+.G(.j | 0x18044b20
    131376 | IEND  |       0 |                                | 0xae426082
 : Standard output does not match

how strange...

@neheb
Copy link
Collaborator Author

neheb commented Feb 19, 2025

Now this is interesting. I assume it's just called python there. But runner.py uses python3 as the binary name. And I guess meson's find_program doesn't rewrite it.
@eli-schwartz any thoughts?

On FreeBSD, they consider it "sneaky" and bad behavior for any software to try to run python without installing as a port. So there is no "python" program and no "python3" program either, you have to invoke it as "python3.11" or whatever.

I think there may be a non-default package you can install that provides a symlink for you.

so how is meson ran then?

@eli-schwartz
Copy link
Contributor

so how is meson ran then?

Since you ran pkg install -y meson, it installed a FreeBSD port of meson, which built using Mk/Uses/python.mk and has access to PYTHON_CMD as set by the BSD Ports "flavor" system.'

Hence, the shebang of /usr/local/bin/meson, is /usr/local/bin/python3.11 (but at any time might be rebuilt to use python3.12).

As I said, you can install this: https://www.freshports.org/lang/python/

It should provide the "python" and "python3" symlinks "for interactive use" or whatever their silliness is.

Copy link

codecov bot commented Feb 19, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 64.01%. Comparing base (c71a80b) to head (7ac738c).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3176   +/-   ##
=======================================
  Coverage   64.01%   64.01%           
=======================================
  Files         104      104           
  Lines       21832    21832           
  Branches    10691    10691           
=======================================
  Hits        13975    13975           
  Misses       5643     5643           
  Partials     2214     2214           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@neheb
Copy link
Collaborator Author

neheb commented Feb 19, 2025

@kmilos so the MSYS2 failures look like an actual bug. I don't know why the exiv2 prints the wrong output.

@kmilos
Copy link
Collaborator

kmilos commented Feb 19, 2025

No idea... looks like null is replaced by a tab (randomly)?!

At least it looks like the right Python version is being picked up by Meson (CMake would randomly use the default runner one instead of the MSYS2 one if not pointed to explicitly...)

@neheb
Copy link
Collaborator Author

neheb commented Feb 19, 2025

@kmilos what's more interesting is that the failing files have Syntax warnings on them.

Nevertheless, it looks like exiv2 printing the wrong stuff.

I'm curious why the CMake CI doesn't catch this.

@kmilos
Copy link
Collaborator

kmilos commented Feb 19, 2025

I'm curious why the CMake CI doesn't catch this.

Indeed. Could be CMake and Meson are spawning processes in different ways/shells...

@neheb
Copy link
Collaborator Author

neheb commented Feb 19, 2025

meson on MSYS2 uses libiconv whereas cmake does not. Let's see if this works...

@neheb neheb force-pushed the mesont branch 3 times, most recently from faa7f99 to 8d0e368 Compare February 20, 2025 00:42
@neheb
Copy link
Collaborator Author

neheb commented Feb 20, 2025

Alright partial fix. std::isprint looks to be unreliable and influenced by locale.

@kmilos
Copy link
Collaborator

kmilos commented Feb 20, 2025

Interesting... Why would Meson be running in a different locale?

@neheb
Copy link
Collaborator Author

neheb commented Feb 20, 2025

Either the setlocale call does nothing or LC_ALL is different under MinGW

@neheb neheb force-pushed the mesont branch 2 times, most recently from cf9f156 to ac748e1 Compare February 21, 2025 02:31
@neheb
Copy link
Collaborator Author

neheb commented Feb 22, 2025

example of a difference

20040329_224245.jpg   Exif.Nikon3.Quality                          Ascii       8  FINE
20040329_224245.jpg   Exif.Nikon3.Quality                          Ascii       8  FINE   

something is removing the whitespace.

@neheb neheb force-pushed the mesont branch 2 times, most recently from 6aa628e to 97be896 Compare February 22, 2025 23:52
Cleanest to use raw strings.

Signed-off-by: Rosen Penev <[email protected]>
It's influenced by locale, which can cause problems.

Signed-off-by: Rosen Penev <[email protected]>
For some reason, this unused variable causes thread sanitizer to
complain on destruction of the std::string. Simple enough to remove.

Signed-off-by: Rosen Penev <[email protected]>
Localization is not implemented.

Signed-off-by: Rosen Penev <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants