Commit Graph

3687 Commits

Author SHA1 Message Date
zdenop
9e47105977
Merge pull request #2192 from stweil/unittest
unittest: Skip test is traineddata is missing in applybox_test
2019-01-24 16:35:56 +01:00
Stefan Weil
86b0f3625e unittest: Skip test is traineddata is missing in applybox_test
Many tests have preconditions like a correct version of the test submodule
or installed traineddata files at the right location. They fail or even
crash if those preconditions are not met.

The latest version of Googletest supports skipping single tests with
GTEST_SKIP which is used here to skip tests in applybox_test when
tessdata/eng.traineddata is missing.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-01-24 16:10:52 +01:00
Shree Devi Kumar
36906064a5 Add LF to INFO msgs in lstm_test 2019-01-24 11:40:53 +00:00
Stefan Weil
87a4fbac05 Update test submodule
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-01-24 11:29:22 +01:00
Stefan Weil
14086af474 unittest: Add missing Leptonica library for stringrenderer_test
It is needed for builds without `--disable-shared`.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-01-24 11:29:22 +01:00
Stefan Weil
6b7f7db63e Fix and enable shapetable_test
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-01-24 11:23:20 +01:00
Shreeshrii
bbd23bbfd2 Fix and enable lstm related unittests (#2180)
* Fix and build lstm related unittests
* Use ./tmp instead of ./ for files created by unittests
2019-01-24 08:01:19 +01:00
zdenop
12c1abcb6b
Merge pull request #2189 from stweil/fix
Fix memory leak for PNG images
2019-01-24 07:59:55 +01:00
zdenop
059c50be8c
Merge pull request #2184 from stweil/tests
Fix and enable stringrenderer_test
2019-01-24 07:59:07 +01:00
zdenop
093efcde0f
Merge pull request #2188 from diegodlh/shape_clustering_flag
tesstrain.sh was failing with line 81: ENABLE_SHAPE_CLUSTERING: unbound variable
2019-01-24 07:54:48 +01:00
Stefan Weil
9e6e3a0232 Fix memory leak for PNG images
Commit 5fe1390748 used an implementation
which created a new Pix object. That object was never destroyed.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-01-23 20:05:10 +01:00
Diego de la Hera
1a398a5b5d removed reference to unbound variable 2019-01-23 15:04:16 -03:00
Stefan Weil
daf61f75db automake: Add missing dependency for "check" target (fix parallel build)
Some unit tests use code from training. Those tests are enabled
if training is enabled, so for that case the "check" target
depends on the "training" target.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-01-23 17:29:51 +01:00
Stefan Weil
ecf73f5bc7 training: Don't terminate after processing 8 fonts or 8 images
tesstrain_utils.sh sets the shell flag -e, so it exits immediately
if a command exits with a non-zero status.

The following command returns a non-zero status as soon as counter is a
multiple of par_factor (par_factor=8, that means as soon as 8 fonts or
images are processed):

    let rem=counter%par_factor

The new code fixes this undesired exit.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-01-23 17:26:40 +01:00
Stefan Weil
32e9d7c8f5 training: Fix some compiler warnings (signed/unsigned)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-01-23 13:55:13 +01:00
Stefan Weil
e4b862d588 pango_font_info: Fix runtime error messages from Pango
pango_coverage_get and pango_coverage_unref should not be called
with coverage == nullptr.

pango_font_get_coverage should not be called with font == nullptr.

Otherwise Pango prints runtime error messages:

    (process:12657): Pango-CRITICAL **: pango_coverage_get: assertion 'coverage != NULL' failed
    (process:12657): Pango-CRITICAL **: pango_coverage_unref: assertion 'coverage != NULL' failed
    (process:12657): Pango-CRITICAL **: pango_font_get_coverage: assertion 'font != NULL' failed
    (process:12657): GLib-GObject-CRITICAL **: g_object_unref: assertion 'G_IS_OBJECT (object)' failed

Typically those errors occur if a required font is not installed,
so this can be a quite common error.

Fix also a potential resource leak in PangoFontInfo::CoversUTF8Text.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-01-23 13:55:13 +01:00
Stefan Weil
4b24d8cdf6 Fix and enable stringrenderer_test
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-01-23 13:55:13 +01:00
Stefan Weil
a6da64234e unittest: Fix and enable validate_myanmar_test
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-01-23 13:54:27 +01:00
Stefan Weil
d67287a5d9 unittest: Fix and enable validate_khmer_test
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-01-23 13:54:27 +01:00
Stefan Weil
611d5e6358 unittest: Fix and enable validate_indic_test
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-01-23 13:54:27 +01:00
Stefan Weil
d97f67da63 unittest: Fix and enable validate_grapheme_test
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-01-23 13:54:27 +01:00
Stefan Weil
a702f2d2aa unittest: Replace ABSL_ARRAYSIZE by ARRAYSIZE
Remove the local definition of ABSL_ARRAYSIZE
to avoid a conflict with Abseil.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-01-23 13:54:27 +01:00
Shree Devi Kumar
77d0b6ce8e fix WORDLIST filename 2019-01-22 15:49:55 +01:00
zdenop
f62181c86e
Merge pull request #2178 from stweil/master
Update file paths in dawg_test
2019-01-21 20:16:20 +01:00
Stefan Weil
2c0ddb4220 Update file paths in dawg_test
Get unicharset and wordlist files from test/testing and use the latest
test submodule which provides those files.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-01-21 20:08:11 +01:00
Shree Devi Kumar
57f74d2b73 Fix file location for unicharset for mastertrainer_test 2019-01-21 17:36:08 +01:00
Shree Devi Kumar
0ee4f63019 Formatting LOG messages from layout_test 2019-01-21 17:36:08 +01:00
Stefan Weil
4edc61fd3f unittest: Add missing license headers for dawg_test and layout_test
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-01-21 17:36:08 +01:00
Stefan Weil
05cdbc7c9c Fix and enable dawg_test
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-01-21 17:36:08 +01:00
Stefan Weil
aec992ebf8 Update test submmodule and enable additional test in layout_test
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-01-21 17:36:08 +01:00
Stefan Weil
4b821b2c6b Fix and enable layout_test
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-01-21 17:36:08 +01:00
Shree Devi Kumar
0d6d8108c8 Add sources for layout_test and dawg_test to Makefile 2019-01-21 17:36:08 +01:00
Shree Devi Kumar
0f0eaa9f30 Partial fix for layout_test and dawg_test 2019-01-21 17:36:08 +01:00
zdenop
633ccbc4b5
Merge pull request #2174 from stweil/fix
Fix selection of IntSimdMatrix method
2019-01-21 08:41:27 +01:00
Stefan Weil
564482db30 Fix selection of IntSimdMatrix method
Commit d36231e3e4 did not distinguish
between AVX and AVX2, so AVX2 code was enabled for IntSimdMatrix
even when only AVX was supported.

This resulted in an illegal instruction.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-01-20 22:13:04 +01:00
Egor Pugin
277457ff3d
Update appveyor.yml 2019-01-20 15:59:55 +03:00
zdenop
d345bf1012
Merge pull request #2170 from stweil/fix
OpenCL: Fix two issues reported by AddressSanitizer
2019-01-19 18:22:48 +01:00
Stefan Weil
9d6978b258
Merge pull request #2169 from Shreeshrii/master
Fix for unicharcompress_test
2019-01-19 09:05:39 +01:00
Stefan Weil
0ae8fdc859 Fix build for unicharcompress_test
* Add abseil library
* Add minimalistic implementation for WriteStringToFile
* Add missing namespace for std::string

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-01-19 08:34:00 +01:00
Stefan Weil
66e31bfd8c OpenCL: Fix alloc-dealloc mismatch
Bug message from AddressSanitizer:

    ==7153==ERROR: AddressSanitizer: alloc-dealloc-mismatch (operator new [] vs free) on 0x602000072cb0
        #0 0x7ffff70c6a10 in free (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xc1a10)
        #1 0x555557188638 in writeProfileToFile ../../../../../src/opencl/openclwrapper.cpp:541

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-01-19 08:06:26 +01:00
Stefan Weil
ad19183b92 OpenCL: Fix heap buffer overflow
Bug message from AddressSanitizer:

    ==6158==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x7fffe774b7fc at pc 0x555557086b54 bp 0x7fffffffcee0 sp 0x7fffffffced8
    READ of size 1 at 0x7fffe774b7fc thread T0
        #0 0x555557086b53 in tesseract::HistogramRect(Pix*, int, int, int, int, int, int*) ../../../../../src/ccstruct/otsuthr.cpp:163

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-01-19 07:58:16 +01:00
Shree Devi Kumar
e67ad46fca fix typo 2019-01-19 05:24:17 +00:00
Shree Devi Kumar
9e599e1e54 Partial fix for unicharcompress_test 2019-01-19 05:13:03 +00:00
zdenop
58447c0d52
Merge pull request #2168 from stweil/fix
Fix build for unichar_test
2019-01-18 21:26:41 +01:00
Stefan Weil
9b2bf10391 Fix build for unichar_test
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-01-18 21:15:33 +01:00
zdenop
8955daa219
Merge pull request #2167 from Shreeshrii/master
Fixes unicharset_test
2019-01-18 20:52:37 +01:00
Shree Devi Kumar
20ed60b31f Fix unicharset_test 2019-01-18 16:41:29 +00:00
Egor Pugin
db3ed5d656 Run travis builds without cppan. 2019-01-16 13:16:51 +03:00
Egor Pugin
a1ec977f1e Revert "Fix broken builds"
This reverts commit 0c5f81947e.
2019-01-16 13:15:56 +03:00
Stefan Weil
0c5f81947e Fix broken builds
Don't use CPPAN by default because it fails with an error message:

    /usr/bin/ld: cannot find -lpvt.cppan.demo.danbloomberg.leptonica

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-01-16 09:25:28 +01:00