Skip to content

Commit 67315b0

Browse files
committed
Fix test_openjpeg under wasm64. NFC
openjpeg was assuming a different signature for getopt_long which was not problem under wasm32.
1 parent 72d980b commit 67315b0

File tree

2 files changed

+26
-20
lines changed

2 files changed

+26
-20
lines changed

test/test_core.py

+11-13
Original file line numberDiff line numberDiff line change
@@ -6811,7 +6811,6 @@ def test_poppler(self):
68116811
args=['-scale-to', '512', 'paper.pdf', 'filename'])
68126812

68136813
@needs_make('make')
6814-
@no_wasm64('MEMORY64 does not yet support SJLJ')
68156814
@is_slow_test
68166815
def test_openjpeg(self):
68176816
def line_splitter(data):
@@ -6853,6 +6852,7 @@ def line_splitter(data):
68536852
[Path('codec/CMakeFiles/j2k_to_image.dir/index.c.o'),
68546853
Path('codec/CMakeFiles/j2k_to_image.dir/convert.c.o'),
68556854
Path('codec/CMakeFiles/j2k_to_image.dir/__/common/color.c.o'),
6855+
Path('codec/CMakeFiles/j2k_to_image.dir/__/common/getopt.c.o'),
68566856
Path('bin/libopenjpeg.a')],
68576857
configure=['cmake', '.'],
68586858
# configure_args=['--enable-tiff=no', '--enable-jp3d=no', '--enable-png=no'],
@@ -6890,21 +6890,19 @@ def image_compare(output):
68906890
assert abs(true_mean - image_mean) < 0.01, [true_mean, image_mean]
68916891
assert diff_mean < 0.01, diff_mean
68926892

6893-
return output
6894-
68956893
self.emcc_args += ['--minify=0'] # to compare the versions
68966894
self.emcc_args += ['--pre-js', 'pre.js']
68976895

6898-
self.do_runf('third_party/openjpeg/codec/j2k_to_image.c',
6899-
'Successfully generated', # The real test for valid output is in image_compare
6900-
args='-i image.j2k -o image.raw'.split(),
6901-
emcc_args=['-sUSE_LIBPNG'],
6902-
libraries=lib,
6903-
includes=[test_file('third_party/openjpeg/libopenjpeg'),
6904-
test_file('third_party/openjpeg/codec'),
6905-
test_file('third_party/openjpeg/common'),
6906-
Path(self.get_build_dir(), 'third_party/openjpeg')],
6907-
output_nicerizer=image_compare)
6896+
output = self.do_runf('third_party/openjpeg/codec/j2k_to_image.c',
6897+
'Successfully generated', # The real test for valid output is in image_compare
6898+
args='-i image.j2k -o image.raw'.split(),
6899+
emcc_args=['-sUSE_LIBPNG'],
6900+
libraries=lib,
6901+
includes=[test_file('third_party/openjpeg/libopenjpeg'),
6902+
test_file('third_party/openjpeg/codec'),
6903+
test_file('third_party/openjpeg/common'),
6904+
Path(self.get_build_dir(), 'third_party/openjpeg')])
6905+
image_compare(output)
69086906

69096907
@also_with_standalone_wasm(impure=True)
69106908
@no_asan('autodebug logging interferes with asan')

test/third_party/openjpeg/CMake/CheckHaveGetopt.cmake

+15-7
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
11
# Check if getopt is present:
22
INCLUDE (${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake)
33
SET(DONT_HAVE_GETOPT 1)
4-
IF(UNIX) #I am pretty sure only *nix sys have this anyway
5-
CHECK_INCLUDE_FILE("getopt.h" CMAKE_HAVE_GETOPT_H)
6-
# Seems like we need the contrary:
7-
IF(CMAKE_HAVE_GETOPT_H)
8-
SET(DONT_HAVE_GETOPT 0)
9-
ENDIF(CMAKE_HAVE_GETOPT_H)
10-
ENDIF(UNIX)
4+
5+
## Force the use of the openjpeg version of getopt_long since the system
6+
## version has a differnet signature. This was fixed in the more recent
7+
## upstream version of openjpeg:
8+
## https://github.com/uclouvain/openjpeg/commit/aba0e602
9+
##
10+
##
11+
## IF(UNIX) #I am pretty sure only *nix sys have this anyway
12+
## CHECK_INCLUDE_FILE("getopt.h" CMAKE_HAVE_GETOPT_H)
13+
## # Seems like we need the contrary:
14+
## IF(CMAKE_HAVE_GETOPT_H)
15+
## SET(DONT_HAVE_GETOPT 0)
16+
## ENDIF(CMAKE_HAVE_GETOPT_H)
17+
## ENDIF(UNIX)
18+
##
1119

1220
IF(DONT_HAVE_GETOPT)
1321
ADD_DEFINITIONS(-DDONT_HAVE_GETOPT)

0 commit comments

Comments
 (0)